fix compile against newer giflib
[rofl0r-obeditor.git] / src / common__modalsFrames.h
blob4de23420ab42f4666c0cdc2612e38a575afcf86c
1 #ifndef MYMODALSFRAMES_H_
2 #define MYMODALSFRAMES_H_
4 #include <wx/event.h>
5 #include <wx/grid.h>
7 #include "common__globals.h"
9 //*****************************************************************
10 //*****************************************************************
11 class prObFileChooserCtrl;
12 class ob_object;
14 //*****************************************************************
15 // propsNames examples:
16 // "_NAME_" -> the object name
17 // "_TOKEN_3" -> the 3rd token of the object
18 // "_SUBOBJ_NUM%4%PROP%shape" -> the shape property of the 4d subobject
19 // "_SUBOBJ_NAME%boule%TOKEN%3" -> the 3rd token of the subobject "boule"
20 // "_SUBOBJ_NAME%boule%NUM%4%PROP%shape" -> the shape property of the 4d boule subobject
21 // "_SUBOBJ_TYPE%balon%NUM%4%TOKEN%3" -> the 3rd token of the 4d subobject of type balon
22 //*****************************************************************
24 const wxArrayString arrStr_empty;
26 class frameEdit_request
28 public:
29 frameEdit_request(
30 const wxString& _propname = wxT("UNNAMED"),
31 const wxString& _label = wxT("NO-LABEL"),
32 int _type = PROPTYPE_UNDEF,
33 const wxString& _request = wxT("_TOKEN_0"),
34 bool _b_del_ifempty = false,
35 wxArrayString _enums = arrStr_empty,
36 int _labelw = wxDefaultCoord,
37 int _fieldw = wxDefaultCoord
39 void Set(
40 const wxString _propname = wxT("UNNAMED"),
41 const wxString _label = wxT("NO-LABEL"),
42 int _type = PROPTYPE_STRING_NO_WS,
43 const wxString _request = wxT("_TOKEN_0"),
44 bool _b_del_ifempty = true,
45 wxArrayString _enums = arrStr_empty,
46 int _labelw = wxDefaultCoord,
47 int _fieldw = wxDefaultCoord
50 ~frameEdit_request();
52 void SetPropType( int _proptype );
53 int GetPropType();
55 wxString request;
56 wxString label;
57 bool b_del_ifempty;
58 wxString name;
59 wxArrayString enums;
60 wxWindow* ctrl;
61 int labelw;
62 int fieldw;
63 wxString defVal;
64 bool b_optional;
65 wxString* missing_tokens;
66 size_t nb_missing_tokens;
68 protected:
69 int type;
72 class FrameEditProperties : public wxDialog
74 public:
75 FrameEditProperties(wxWindow *_parent, ob_object* _theObj = NULL,
76 const wxString& _title = wxT("NO-TITLE"),
77 int more_style = 0 );
78 ~FrameEditProperties();
80 void EvtClose( wxCloseEvent& event );
81 void EvtClickOK(wxCommandEvent& evt );
82 void EvtClickCancel(wxCommandEvent& evt );
84 ob_object* theObj;
85 bool b_newObj;
86 bool b_chg;
88 protected:
89 virtual wxString GetObjValue( int ind );
90 virtual bool SetObjValue( int ind, const wxString& val, const wxString& origin_val );
92 virtual bool IsChanged();
93 virtual int WriteChangesToObject();
95 virtual void Clicked_OK(bool b_close = true);
96 virtual void Clicked_Cancel(bool b_close = true);
98 void Init();
99 virtual void InitControls();
100 virtual void InitProps();
101 virtual void InitObj();
102 void SetDatas();
105 wxSizer *sizerMain;
106 wxBoxSizer *sizerTop;
108 int nb_props;
109 frameEdit_request* reqs;
110 wxString wndSavingName; // For save and restore coords
112 bool b_ok;
113 bool b_creation; //True -> an subobject will be create on write
115 DECLARE_EVENT_TABLE()
123 //*****************************************************************
124 // Init these var before create the GridPropFrame
125 #define MAXGRIDPROPFRAME_PROPSSIZE 200
127 class wxGridEvent;
128 class GridOb_ObjectProperties;
130 class GridPropFrame : public wxDialog
132 public:
133 GridPropFrame( wxWindow *parent,
134 ob_object* _theObj,
135 const wxString& Title =wxT("Set some properties"),
136 const wxString& _intro =wxT("You can change/add/del properties here"),
137 long style = wxDEFAULT_DIALOG_STYLE, bool b_sort = true );
138 ~GridPropFrame();
140 void SetFilter_Properties( wxArrayString& _filter, bool b__exclude = true);
141 void SetFilter_Properties( int* arrObjIDs, int nb_ids);
143 void EvtClose( wxCloseEvent& event );
144 void EvtSize(wxSizeEvent& event);
145 void EvtCharPress(wxKeyEvent& event);
146 void EvtOkClicked( wxCommandEvent& event);
147 int Changed();
149 protected:
150 wxStaticText *txtMessage;
151 GridOb_ObjectProperties *list_Props;
153 DECLARE_EVENT_TABLE()
157 class GridOb_ObjectProperties : public wxGrid
159 public:
160 GridOb_ObjectProperties( wxWindow *parent, bool b_sort = true);
161 ~GridOb_ObjectProperties();
163 void SetFilter_Properties( wxArrayString& _filter, bool b__exclude = true);
164 void SetFilter_Properties( int* arrObjIDs, int nb_ids);
165 void SetObjectHandled( ob_object* _theObj );
166 void Clear();
167 void RefreshProperties();
169 bool changed;
171 protected:
172 void _AppendProp( ob_object* theProp, int& row_num );
173 void UpdatePropGridSize();
174 void Init( bool b_sort = true);
176 void EvtSize(wxSizeEvent& event);
177 void EvtPropertyChange( wxGridEvent& event );
178 void EvtAddRow(wxCommandEvent& event);
179 void EvtClose( wxCloseEvent& event );
180 void EvtReposCursor( wxCommandEvent& event );
181 void EvtCharPress(wxKeyEvent& event);
182 void EvtSelectChg( wxGridEvent& event );
183 void EvtRgSelectChg( wxGridRangeSelectEvent& event );
185 void DeletePropAtRow( int j );
186 bool SetObjProperty_fromRow( int _row );
187 wxString GetPrevPropertyName( int _row );
188 void ExpandArrObj();
189 bool IsToExclude( const wxString& _name, ob_object* t = NULL );
191 int new_row_pos;
192 int new_col_pos;
194 bool b_sort;
195 bool b_sizing;
196 bool b_changing_prop;
197 bool b_destroying;
198 wxArrayString filter;
199 int nb_filter_IDs;
200 int* filter_IDs;
202 bool b_Filter_exclude;
204 ob_object* theObj;
205 ob_object** arr_Props;
206 size_t arr_Props_size;
207 size_t nb_Props;
209 virtual bool ProcessEvent( wxEvent& event );
211 DECLARE_EVENT_TABLE()
214 class WndFromText : public wxDialog
216 public:
217 WndFromText( wxWindow* _parent, const wxString& _title, const wxString& path );
218 ~WndFromText();
222 //-----------------------------------------------------------
223 class WndImgShow : public wxDialog
225 public:
226 WndImgShow( wxWindow* parent, const wxString& _title
227 , wxImage* _theImg, const wxString& some_text = wxString() );
230 #endif /*MYMODALSFRAMES_H_*/