00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __WXCANPROPEDIT_H__
00018 #define __WXCANPROPEDIT_H__
00019
00020 #ifndef WX_PRECOMP
00021 #include "wx/wx.h"
00022 #endif
00023
00024 #include "wx/general/gen.h"
00025 #include "wx/canvas/canglob.h"
00026 #include "wx/editor/sttool.h"
00027
00028
00029
00030 #include "wx/grid.h"
00031
00032
00033
00034
00035 #define ID_DIALOG 10000
00036 #define SYMBOL_A2DEDITPROPERTIES_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
00037 #define SYMBOL_A2DEDITPROPERTIES_TITLE _("Edit Properties")
00038 #define SYMBOL_A2DEDITPROPERTIES_IDNAME ID_DIALOG
00039 #define SYMBOL_A2DEDITPROPERTIES_SIZE wxSize(400, 300)
00040 #define SYMBOL_A2DEDITPROPERTIES_POSITION wxDefaultPosition
00041 #define ID_GRID 10001
00042 #define ID_ADD 10002
00043 #define ID_CUT 10003
00044 #define ID_PASTE 10004
00045 #define ID_CANCEL 10006
00046 #define ID_OKE 10005
00047
00048 enum PropertyType
00049 {
00050 pt_string,
00051 pt_integer,
00052 pt_real,
00053 pt_bool
00054 };
00055
00056 class PropGridData
00057 {
00058 public:
00059 PropGridData()
00060 {
00061 m_name = wxT("");
00062 m_type = pt_string;
00063 m_val_str = wxT("");
00064 m_val_integer = 0;
00065 m_val_real = 0.0;
00066 m_val_boolean = true;
00067 m_prop = NULL;
00068 m_remove = false;
00069 }
00070
00071 wxString m_name;
00072 PropertyType m_type;
00073 wxString m_val_str;
00074 int m_val_integer;
00075 float m_val_real;
00076 bool m_val_boolean;
00077 a2dNamedPropertyPtr m_prop;
00078 bool m_remove;
00079 };
00080
00081 typedef std::vector<PropGridData> PropGridDataVec;
00082
00083
00084
00085
00086 class a2dEditProperties: public wxDialog
00087 {
00088 DECLARE_DYNAMIC_CLASS( a2dEditProperties )
00089 DECLARE_EVENT_TABLE()
00090
00091 friend class PropertyTable;
00092
00093 public:
00094
00095 a2dEditProperties( );
00096 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 );
00097
00098
00099 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 );
00100
00101
00102 void CreateControls();
00103
00104
00105 static bool ShowToolTips();
00106
00107 private:
00108
00109
00110 void OnCloseWindow( wxCloseEvent& event );
00111
00112
00113 void OnSize( wxSizeEvent& event );
00114
00115
00116 void OnAddClick( wxCommandEvent& event );
00117
00118
00119 void OnCutClick( wxCommandEvent& event );
00120
00121
00122 void OnPasteClick( wxCommandEvent& event );
00123
00124
00125 void OnCancelClick( wxCommandEvent& event );
00126
00127
00128 void OnOkeClick( wxCommandEvent& event );
00129
00130
00131 a2dObject* m_propobject;
00132
00133
00134 a2dNamedPropertyList *m_propertylist;
00135
00136 PropGridDataVec m_propdata;
00137
00138 wxGrid* m_grid;
00139 wxButton* m_add;
00140 wxButton* m_cut;
00141 wxButton* m_cancel;
00142 wxButton* m_oke;
00143 };
00144
00145
00146
00147
00148 class A2DEDITORDLLEXP a2dPropertyEditorDlg: public wxDialog
00149 {
00150 public:
00151
00152
00153 a2dPropertyEditorDlg( wxFrame* parent, a2dNamedPropertyList* propertylist );
00154
00155
00156 ~a2dPropertyEditorDlg();
00157
00158
00159 void CmOk( wxCommandEvent& );
00160
00161
00162 void CmCancel( wxCommandEvent& );
00163
00164
00165 void OnCloseWindow(wxCloseEvent& event);
00166
00167 protected:
00168
00169 wxListBox* m_listbox;
00170
00171 wxButton* m_button1;
00172
00173 wxButton* m_button2;
00174
00175 a2dNamedPropertyList *m_propertylist;
00176
00177
00178 DECLARE_EVENT_TABLE()
00179 };
00180
00181
00182 #endif
00183