The Gnome Chemistry Utils  0.12.11
widgetdata.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * GChemPaint library
5  * widgetdata.h
6  *
7  * Copyright (C) 2002-2008 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef GCHEMPAINT_WIDGET_DATA_H
26 #define GCHEMPAINT_WIDGET_DATA_H
27 
28 #include <gcu/object.h>
29 #include <gccv/structs.h>
30 #include <list>
31 #include <map>
32 
34 namespace gcp {
35 
36 class Application;
37 class View;
38 
45 extern guint ClipboardDataType, ClipboardDataType1;
50  extern xmlChar* ClipboardData;
54 extern char* ClipboardTextData;
62 void on_receive_targets (GtkClipboard *clipboard, GtkSelectionData *selection_data, Application *App);
69 void on_clear_data (GtkClipboard *clipboard, gcu::Object *obj);
70 
75 {
92 };
93 
100 {
101 public:
109  GtkWidget *Canvas;
113  double Zoom;
117 // std::map<gcu::Object const*, GnomeCanvasGroup*>Items;
121  std::list<gcu::Object*>SelectedObjects;
122 
127  bool IsSelected (gcu::Object const *obj) const;
134  void SetSelected (gcu::Object *obj, int state = gcp::SelStateSelected);
140  void Unselect (gcu::Object *obj);
144  void UnselectAll ();
153  void MoveSelectedItems (double dx, double dy);
161  void MoveSelection (double dx, double dy);
169  void RotateSelection (double x, double y, double angle);
173  void ClearSelection () {SelectedObjects.clear();}
179  void Copy (GtkClipboard* clipboard);
185  void GetSelectionBounds (gccv::Rect &rect) const;
189  bool HasSelection () {return !(SelectedObjects.empty());}
193  void SelectAll ();
198  static xmlDocPtr GetXmlDoc (GtkClipboard* clipboard);
205  void ShowSelection (bool state);
212  void GetObjectBounds (gcu::Object const *obj, gccv::Rect *rect) const;
213 
214 private:
215  void MoveItems (gcu::Object *obj, double dx, double dy);
216  void GetObjectBounds (gcu::Object const* obj, gccv::Rect &rect) const;
217 };
218 
219 } // namespace gcp
220 
221 #endif //GCHEMPAINT_WIDGET_DATA_H