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
00039 extern guint ClipboardDataType, ClipboardDataType1;
00040 extern xmlChar* ClipboardData;
00041 extern char* ClipboardTextData;
00042 extern bool cleared;
00043 void on_receive_targets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App);
00044 void on_clear_data (GtkClipboard *clipboard, gcu::Object *obj);
00045
00049 enum SelectionState
00050 {
00054 SelStateUnselected = 0,
00058 SelStateSelected,
00062 SelStateUpdating,
00066 SelStateErasing
00067 };
00068
00074 class WidgetData
00075 {
00076 public:
00080 View* m_View;
00084 GtkWidget *Canvas;
00088 double Zoom;
00092
00096 std::list<gcu::Object*>SelectedObjects;
00097
00102 bool IsSelected (gcu::Object const *obj) const;
00108 void SetSelected (gcu::Object *obj);
00114 void Unselect (gcu::Object *obj);
00118 void UnselectAll ();
00127 void MoveSelectedItems (double dx, double dy);
00135 void MoveSelection (double dx, double dy);
00143 void RotateSelection (double x, double y, double angle);
00147 void ClearSelection () {SelectedObjects.clear();}
00153 void Copy (GtkClipboard* clipboard);
00159 void GetSelectionBounds (gccv::Rect &rect) const;
00163 bool HasSelection () {return !(SelectedObjects.empty());}
00167 void SelectAll ();
00172 static xmlDocPtr GetXmlDoc (GtkClipboard* clipboard);
00179 void ShowSelection (bool state);
00186 void GetObjectBounds (gcu::Object const *obj, gccv::Rect *rect) const;
00187
00188 private:
00189 void MoveItems (gcu::Object *obj, double dx, double dy);
00190 void GetObjectBounds (gcu::Object const* obj, gccv::Rect &rect) const;
00191 };
00192
00193 }
00194
00195 #endif //GCHEMPAINT_WIDGET_DATA_H