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 #include <set>
00033
00035 namespace gcp {
00036
00037 class Application;
00038 class View;
00039
00046 extern guint ClipboardDataType, ClipboardDataType1;
00051 extern xmlChar* ClipboardData;
00055 extern char* ClipboardTextData;
00063 void on_receive_targets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App);
00070 void on_clear_data (GtkClipboard *clipboard, gcu::Object *obj);
00071
00075 enum SelectionState
00076 {
00080 SelStateUnselected = 0,
00084 SelStateSelected,
00088 SelStateUpdating,
00092 SelStateErasing
00093 };
00094
00100 class WidgetData
00101 {
00102 public:
00106 View* m_View;
00110 GtkWidget *Canvas;
00114 double Zoom;
00118
00122 std::list<gcu::Object*>SelectedObjects;
00123
00128 bool IsSelected (gcu::Object const *obj) const;
00129
00135 bool ChildrenSelected (gcu::Object const *obj) const;
00136
00137
00143 gcu::Object *GetSelectedAncestor (gcu::Object *obj);
00144
00151 void SetSelected (gcu::Object *obj, int state = gcp::SelStateSelected);
00157 void Unselect (gcu::Object *obj);
00161 void UnselectAll ();
00170 void MoveSelectedItems (double dx, double dy);
00178 void MoveSelection (double dx, double dy);
00186 void RotateSelection (double x, double y, double angle);
00190 void ClearSelection () {SelectedObjects.clear();}
00196 void Copy (GtkClipboard* clipboard);
00202 void GetSelectionBounds (gccv::Rect &rect) const;
00206 bool HasSelection () {return !(SelectedObjects.empty());}
00210 void SelectAll ();
00215 static xmlDocPtr GetXmlDoc (GtkClipboard* clipboard);
00222 void ShowSelection (bool state);
00229 void GetObjectBounds (gcu::Object const *obj, gccv::Rect *rect) const;
00236 void GetObjectsBounds (std::set <gcu::Object const *> const &objects, gccv::Rect *rect) const;
00237
00242 void SimplifySelection ();
00243
00244 private:
00245 void MoveItems (gcu::Object *obj, double dx, double dy);
00246 void GetObjectBounds (gcu::Object const* obj, gccv::Rect &rect) const;
00247 };
00248
00249 }
00250
00251 #endif //GCHEMPAINT_WIDGET_DATA_H