wxArt2D
canpropedit.h
Go to the documentation of this file.
1 /*! \file wx/editor/canpropedit.h
2  \brief for edting properties in a a2dNamedPropertyList
3 
4  The event for editing properties is intercepted, and the property list
5  recieved that way can be edited.
6 
7  \author Klaas Holwerda
8  \date Created 11/19/2003
9 
10  Copyright: 2003-2004 (c) Klaas Holwerda
11 
12  Licence: wxWidgets Licence
13 
14  RCS-ID: $Id: canpropedit.h,v 1.5 2006/12/13 21:43:29 titato Exp $
15 */
16 
17 #ifndef __WXCANPROPEDIT_H__
18 #define __WXCANPROPEDIT_H__
19 
20 #ifndef WX_PRECOMP
21 #include "wx/wx.h"
22 #endif
23 
24 #include "wx/general/gen.h"
25 #include "wx/canvas/canglob.h"
26 #include "wx/canvas/sttool.h"
27 
28 
29 
30 #include "wx/grid.h"
31 
32 /*!
33  * Control identifiers
34  */
35 #define ID_DIALOG 10000
36 #define SYMBOL_A2DEDITPROPERTIES_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
37 #define SYMBOL_A2DEDITPROPERTIES_TITLE _("Edit Properties")
38 #define SYMBOL_A2DEDITPROPERTIES_IDNAME ID_DIALOG
39 #define SYMBOL_A2DEDITPROPERTIES_SIZE wxSize(400, 300)
40 #define SYMBOL_A2DEDITPROPERTIES_POSITION wxDefaultPosition
41 #define ID_GRID 10001
42 #define ID_ADD 10002
43 #define ID_CUT 10003
44 #define ID_PASTE 10004
45 #define ID_CANCEL 10006
46 #define ID_OKE 10005
47 
48 enum PropertyType
49 {
50  pt_string,
51  pt_integer,
52  pt_real,
53  pt_bool
54 };
55 
57 {
58 public:
59  PropGridData()
60  {
61  m_name = wxT( "" );
62  m_type = pt_string;
63  m_val_str = wxT( "" );
64  m_val_integer = 0;
65  m_val_real = 0.0;
66  m_val_boolean = true;
67  m_prop = NULL;
68  m_remove = false;
69  }
70 
71  wxString m_name;
72  PropertyType m_type;
73  wxString m_val_str;
74  int m_val_integer;
75  float m_val_real;
76  bool m_val_boolean;
77  a2dNamedPropertyPtr m_prop;
78  bool m_remove;
79 };
80 
81 typedef std::vector<PropGridData> PropGridDataVec;
82 
83 /*!
84  * a2dEditProperties class declaration
85  */
86 class a2dEditProperties: public wxDialog
87 {
88  DECLARE_DYNAMIC_CLASS( a2dEditProperties )
89  DECLARE_EVENT_TABLE()
90 
91  friend class PropertyTable;
92 
93 public:
94  /// Constructors
96  a2dEditProperties( wxWindow* parent, a2dObject* propobject, a2dNamedPropertyList* propertylist, wxWindowID id = SYMBOL_A2DEDITPROPERTIES_IDNAME, const wxString& caption = SYMBOL_A2DEDITPROPERTIES_TITLE, const wxPoint& pos = SYMBOL_A2DEDITPROPERTIES_POSITION, const wxSize& size = SYMBOL_A2DEDITPROPERTIES_SIZE, long style = SYMBOL_A2DEDITPROPERTIES_STYLE );
97 
98  /// Creation
99  bool Create( wxWindow* parent, wxWindowID id = SYMBOL_A2DEDITPROPERTIES_IDNAME, const wxString& caption = SYMBOL_A2DEDITPROPERTIES_TITLE, const wxPoint& pos = SYMBOL_A2DEDITPROPERTIES_POSITION, const wxSize& size = SYMBOL_A2DEDITPROPERTIES_SIZE, long style = SYMBOL_A2DEDITPROPERTIES_STYLE );
100 
101  /// Creates the controls and sizers
102  void CreateControls();
103 
104  /// Should we show tooltips?
105  static bool ShowToolTips();
106 
107 private:
108 
109  /// wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
110  void OnCloseWindow( wxCloseEvent& event );
111 
112  /// wxEVT_SIZE event handler for ID_DIALOG
113  void OnSize( wxSizeEvent& event );
114 
115  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ADD
116  void OnAddClick( wxCommandEvent& event );
117 
118  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CUT
119  void OnCutClick( wxCommandEvent& event );
120 
121  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PASTE
122  void OnPasteClick( wxCommandEvent& event );
123 
124  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CANCEL
125  void OnCancelClick( wxCommandEvent& event );
126 
127  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_OKE
128  void OnOkeClick( wxCommandEvent& event );
129 
130  //! properties defined on this object will be edited
131  a2dObject* m_propobject;
132 
133  //! all or subset of properties on object m_propobject
134  a2dNamedPropertyList* m_propertylist;
135 
136  PropGridDataVec m_propdata;
137 
138  wxGrid* m_grid;
139  wxButton* m_add;
140  wxButton* m_cut;
141  wxButton* m_cancel;
142  wxButton* m_oke;
143 };
144 
145 //! edit properties of a2dCanvasObject's
146 /*!
147 */
148 class A2DEDITORDLLEXP a2dPropertyEditorDlg: public wxDialog
149 {
150 public:
151 
152  //! constructor.
153  a2dPropertyEditorDlg( wxFrame* parent, a2dNamedPropertyList* propertylist );
154 
155  //! destructor.
157 
158  //! Close window if OK-button is pressed.
159  void CmOk( wxCommandEvent& );
160 
161  //! Close window if CANCEL-button is pressed.
162  void CmCancel( wxCommandEvent& );
163 
164  //! Close window if EXIT \-button is pressed.
165  void OnCloseWindow( wxCloseEvent& event );
166 
167 protected:
168 
169  wxListBox* m_listbox;
170 
171  wxButton* m_button1;
172 
173  wxButton* m_button2;
174 
175  a2dNamedPropertyList* m_propertylist;
176 
177  //! Declare used events.
178  DECLARE_EVENT_TABLE()
179 };
180 
181 
182 #endif
183 
a2dEditProperties()
Constructors.
fundamental classes used by all other modules.
Ref Counted base object.
Definition: gen.h:1045
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_A2DEDITPROPERTIES_IDNAME, const wxString &caption=SYMBOL_A2DEDITPROPERTIES_TITLE, const wxPoint &pos=SYMBOL_A2DEDITPROPERTIES_POSITION, const wxSize &size=SYMBOL_A2DEDITPROPERTIES_SIZE, long style=SYMBOL_A2DEDITPROPERTIES_STYLE)
Creation.
list of a2dNamedProperty objects
Definition: gen.h:804
static bool ShowToolTips()
Should we show tooltips?
edit properties of a2dCanvasObject&#39;s
Definition: canpropedit.h:148
void CreateControls()
Creates the controls and sizers.
stack based tools controller and tools for drawing and editing.
general canvas module declarations and classes
canpropedit.h Source File -- Sun Oct 12 2014 17:04:14 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation