widgetdata.h
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
00033 namespace gcp {
00034
00035 class Application;
00036 class View;
00037
00038 extern guint ClipboardDataType, ClipboardDataType1;
00039 extern xmlChar* ClipboardData;
00040 extern bool cleared;
00041 void on_receive_targets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App);
00042 void on_clear_data (GtkClipboard *clipboard, Application *App);
00043
00044 enum
00045 {
00046 SelStateUnselected = 0,
00047 SelStateSelected,
00048 SelStateUpdating,
00049 SelStateErasing
00050 };
00051
00052 class WidgetData
00053 {
00054 public:
00055 View* m_View;
00056 GtkWidget *Canvas;
00057 GnomeCanvasGroup *Group;
00058 GnomeCanvasItem* Background;
00059 double Zoom;
00060 std::map<gcu::Object const*, GnomeCanvasGroup*>Items;
00061 std::list<gcu::Object*>SelectedObjects;
00062
00063 bool IsSelected (gcu::Object const *obj) const;
00064 void SetSelected (gcu::Object *obj);
00065 void Unselect (gcu::Object *obj);
00066 void UnselectAll ();
00067 void MoveSelectedItems (double dx, double dy);
00068 void MoveSelection (double dx, double dy);
00069 void RotateSelection (double dx, double dy, double angle);
00070 void ClearSelection () {SelectedObjects.clear();}
00071 void Copy (GtkClipboard* clipboard);
00072 void GetSelectionBounds (ArtDRect &rect) const;
00073 bool HasSelection () {return !(SelectedObjects.empty());}
00074 void SelectAll ();
00075 static xmlDocPtr GetXmlDoc (GtkClipboard* clipboard);
00076 void ShowSelection (bool state);
00077 void GetObjectBounds (gcu::Object const *obj, ArtDRect *rect) const;
00078
00079 private:
00080 void MoveItems (gcu::Object *obj, double dx, double dy);
00081 void GetObjectBounds (gcu::Object const* obj, ArtDRect &rect) const;
00082 };
00083
00084 }
00085
00086 #endif //GCHEMPAINT_WIDGET_DATA_H