widgetdata.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GCHEMPAINT_WIDGET_DATA_H
00026 #define GCHEMPAINT_WIDGET_DATA_H
00027
00028 #include <libgnomecanvas/gnome-canvas.h>
00029 #include <map>
00030 #include <list>
00031 #include <gcu/object.h>
00032
00034 namespace gcp {
00035
00036 class Application;
00037 class View;
00038
00039 extern guint ClipboardDataType, ClipboardDataType1;
00040 extern xmlChar* ClipboardData;
00041 extern bool cleared;
00042 void on_receive_targets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App);
00043 void on_clear_data (GtkClipboard *clipboard, Application *App);
00044
00048 enum SelectionState
00049 {
00053 SelStateUnselected = 0,
00057 SelStateSelected,
00061 SelStateUpdating,
00065 SelStateErasing
00066 };
00067
00073 class WidgetData
00074 {
00075 public:
00079 View* m_View;
00083 GtkWidget *Canvas;
00087 GnomeCanvasGroup *Group;
00091 GnomeCanvasItem* Background;
00095 double Zoom;
00099 std::map<gcu::Object const*, GnomeCanvasGroup*>Items;
00103 std::list<gcu::Object*>SelectedObjects;
00104
00109 bool IsSelected (gcu::Object const *obj) const;
00115 void SetSelected (gcu::Object *obj);
00121 void Unselect (gcu::Object *obj);
00125 void UnselectAll ();
00134 void MoveSelectedItems (double dx, double dy);
00142 void MoveSelection (double dx, double dy);
00150 void RotateSelection (double x, double y, double angle);
00154 void ClearSelection () {SelectedObjects.clear();}
00160 void Copy (GtkClipboard* clipboard);
00166 void GetSelectionBounds (ArtDRect &rect) const;
00170 bool HasSelection () {return !(SelectedObjects.empty());}
00174 void SelectAll ();
00179 static xmlDocPtr GetXmlDoc (GtkClipboard* clipboard);
00186 void ShowSelection (bool state);
00193 void GetObjectBounds (gcu::Object const *obj, ArtDRect *rect) const;
00194
00195 private:
00196 void MoveItems (gcu::Object *obj, double dx, double dy);
00197 void GetObjectBounds (gcu::Object const* obj, ArtDRect &rect) const;
00198 };
00199
00200 }
00201
00202 #endif //GCHEMPAINT_WIDGET_DATA_H