Logo Search packages:      
Sourcecode: inkscape version File versions

static void sp_svg_view_widget_init ( SPSVGSPViewWidget vw  )  [static]

Callback to initialize SPSVGSPViewWidget object.

Definition at line 82 of file svg-view-widget.cpp.

References SPSVGSPViewWidget::canvas, SPSVGSPViewWidget::maxheight, SPSVGSPViewWidget::maxwidth, SPSVGSPViewWidget::resize, sp_canvas_item_new(), sp_canvas_new_aa(), sp_canvas_root(), sp_view_widget_set_view(), and SPSVGSPViewWidget::sw.

Referenced by sp_svg_view_widget_get_type().

{
      GtkStyle *style;
      SPCanvasItem *parent;

      /* Settings */
      vw->resize = FALSE;
      vw->maxwidth = 400.0;
      vw->maxheight = 400.0;

      /* ScrolledWindow */
      vw->sw = gtk_scrolled_window_new (NULL, NULL);
      gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(vw->sw), GTK_SHADOW_NONE);
      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vw->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
      gtk_container_add (GTK_CONTAINER (vw), vw->sw);
      gtk_widget_show (vw->sw);

      /* Canvas */
      gtk_widget_push_visual (gdk_rgb_get_visual ());
      gtk_widget_push_colormap (gdk_rgb_get_cmap ());
      vw->canvas = sp_canvas_new_aa ();
      gtk_widget_pop_colormap ();
      gtk_widget_pop_visual ();
      style = gtk_style_copy (vw->canvas->style);
      style->bg[GTK_STATE_NORMAL] = style->white;
      gtk_widget_set_style (vw->canvas, style);
      gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (vw->sw), vw->canvas);
      gtk_widget_show (vw->canvas);

      /* View */
      parent = sp_canvas_item_new (sp_canvas_root (SP_CANVAS (vw->canvas)), SP_TYPE_CANVAS_GROUP, NULL);
      Inkscape::UI::View::View *view = Inkscape::GC::release(new SPSVGView (SP_CANVAS_GROUP (parent)));
      sp_view_widget_set_view (SP_VIEW_WIDGET (vw), view);
}


Generated by  Doxygen 1.6.0   Back to index