1 #ifndef INKSCAPE_UI_VIEW_VIEWWIDGET_H
2 #define INKSCAPE_UI_VIEW_VIEWWIDGET_H
4 /** \file
5 * A widget is the UI context for a document view.
6 *
7 * Authors:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 * Ralf Stephan <ralf@ark.in-berlin.de>
10 *
11 * Copyright (C) 2001-2002 Lauris Kaplinski
12 * Copyright (C) 2001 Ximian, Inc.
13 *
14 * Released under GNU GPL, read the file 'COPYING' for more information
15 */
17 #include <gtk/gtkeventbox.h>
19 namespace Inkscape {
20 namespace UI {
21 namespace View {
22 class View;
23 }}}
24 class SPViewWidget;
25 class SPNamedView;
27 #define SP_TYPE_VIEW_WIDGET (sp_view_widget_get_type ())
28 #define SP_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_VIEW_WIDGET, SPViewWidget))
29 #define SP_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_VIEW_WIDGET, SPViewWidgetClass))
30 #define SP_IS_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_VIEW_WIDGET))
31 #define SP_IS_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_VIEW_WIDGET))
32 #define SP_VIEW_WIDGET_VIEW(w) (SP_VIEW_WIDGET (w)->view)
33 #define SP_VIEW_WIDGET_DOCUMENT(w) (SP_VIEW_WIDGET (w)->view ? ((SPViewWidget *) (w))->view->doc : NULL)
35 GType sp_view_widget_get_type (void);
37 void sp_view_widget_set_view (SPViewWidget *vw, Inkscape::UI::View::View *view);
39 /// Allows presenting 'save changes' dialog, FALSE - continue, TRUE - cancel
40 bool sp_view_widget_shutdown (SPViewWidget *vw);
42 /// Create a new SPViewWidget (which happens to be a SPDesktopWidget).
43 SPViewWidget *sp_desktop_widget_new (SPNamedView *namedview);
45 /**
46 * SPViewWidget is a GUI widget that contain a single View. It is also
47 * an abstract base class with little functionality of its own.
48 */
49 class SPViewWidget {
50 public:
51 GtkEventBox eventbox;
53 Inkscape::UI::View::View *view;
55 // C++ Wrappers
56 GType getType() const {
57 return sp_view_widget_get_type();
58 }
60 void setView(Inkscape::UI::View::View *view) {
61 sp_view_widget_set_view(this, view);
62 }
64 gboolean shutdown() {
65 return sp_view_widget_shutdown(this);
66 }
68 // void resized (double x, double y) = 0;
69 };
71 /**
72 * The Glib-style vtable for the SPViewWidget class.
73 */
74 class SPViewWidgetClass {
75 public:
76 GtkEventBoxClass parent_class;
78 /* Virtual method to set/change/remove view */
79 void (* set_view) (SPViewWidget *vw, Inkscape::UI::View::View *view);
80 /// Virtual method about view size change
81 void (* view_resized) (SPViewWidget *vw, Inkscape::UI::View::View *view, gdouble width, gdouble height);
83 gboolean (* shutdown) (SPViewWidget *vw);
84 };
86 #endif
88 /*
89 Local Variables:
90 mode:c++
91 c-file-style:"stroustrup"
92 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
93 indent-tabs-mode:nil
94 fill-column:99
95 End:
96 */
97 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :