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 <gcu/object.h>
00029 #include <gccv/structs.h>
00030 #include <list>
00031 #include <map>
00032
00034 namespace gcp {
00035
00036 class Application;
00037 class View;
00038
00045 extern guint ClipboardDataType, ClipboardDataType1;
00050 extern xmlChar* ClipboardData;
00054 extern char* ClipboardTextData;
00062 void on_receive_targets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App);
00069 void on_clear_data (GtkClipboard *clipboard, gcu::Object *obj);
00070
00074 enum SelectionState
00075 {
00079 SelStateUnselected = 0,
00083 SelStateSelected,
00087 SelStateUpdating,
00091 SelStateErasing
00092 };
00093
00099 class WidgetData
00100 {
00101 public:
00105 View* m_View;
00109 GtkWidget *Canvas;
00113 double Zoom;
00117
00121 std::list<gcu::Object*>SelectedObjects;
00122
00127 bool IsSelected (gcu::Object const *obj) const;
00134 void SetSelected (gcu::Object *obj, int state = gcp::SelStateSelected);
00140 void Unselect (gcu::Object *obj);
00144 void UnselectAll ();
00153 void MoveSelectedItems (double dx, double dy);
00161 void MoveSelection (double dx, double dy);
00169 void RotateSelection (double x, double y, double angle);
00173 void ClearSelection () {SelectedObjects.clear();}
00179 void Copy (GtkClipboard* clipboard);
00185 void GetSelectionBounds (gccv::Rect &rect) const;
00189 bool HasSelection () {return !(SelectedObjects.empty());}
00193 void SelectAll ();
00198 static xmlDocPtr GetXmlDoc (GtkClipboard* clipboard);
00205 void ShowSelection (bool state);
00212 void GetObjectBounds (gcu::Object const *obj, gccv::Rect *rect) const;
00213
00214 private:
00215 void MoveItems (gcu::Object *obj, double dx, double dy);
00216 void GetObjectBounds (gcu::Object const* obj, gccv::Rect &rect) const;
00217 };
00218
00219 }
00220
00221 #endif //GCHEMPAINT_WIDGET_DATA_H