00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef INC_MGUI_FORM_EDIT_OBJNAME_H
00021 #define INC_MGUI_FORM_EDIT_OBJNAME_H
00022
00023 #ifndef INC_MGUI_FORM_H
00024 #include <mgui/form.h>
00025 #endif
00026
00027 #ifndef INC_MGUI_CTRL_H
00028 #include <mgui/ctrl.h>
00029 #endif
00030
00031 #ifndef INC_RVCDEFNS_H
00032 #include <mi32/rvcdefns.h>
00033 #endif
00034
00035 namespace MGUI {
00036
00037
00038 class CTRL_EDIT_OBJECTNAME : public MGUI::CTRL_EDIT_BASE {
00039 public:
00040
00041
00042 CTRL_EDIT_OBJECTNAME (
00043 );
00044
00045
00046 virtual ~CTRL_EDIT_OBJECTNAME (
00047 );
00048
00049
00050 void ClearValue (
00051 bool notify = true
00052 );
00053
00054
00055 void Create (
00056 MGUI::LAYOUT_PANE_BASE& ParentPane,
00057 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize
00058 );
00059
00060
00061 const RVC::OBJECTNAME& GetValue (
00062 ) const { return (m_value); }
00063
00064
00065
00066 void IniRead (
00067 INIHANDLE IniHandle,
00068 const char *IniGroup,
00069 const char *IniField,
00070 bool notify = true
00071 );
00072
00073
00074 void IniWrite (
00075 INIHANDLE IniHandle,
00076 const char *IniGroup,
00077 const char *IniField
00078 ) const { ::IniWrite(IniHandle,IniGroup,IniField,m_value); }
00079
00080
00081 void SetSelection (
00082 int StartChar = 0,
00083 int EndChar = -1,
00084 bool NoScroll = true
00085 )
00086 #ifdef WIN32_MFC
00087 { m_ctrl.SetSel(StartChar,EndChar,NoScroll); }
00088 #endif
00089 ;
00090
00091
00092
00093
00094 void SetValue (
00095 const RVC::OBJECTNAME& name,
00096 bool notify = true
00097 );
00098
00099 protected:
00100
00101
00102
00103
00104 virtual bool OnValidate (
00105 MISTRING& string
00106 );
00107
00108 private:
00109
00110 RVC::OBJECTNAME m_value;
00111
00112
00113 virtual void OnUserEdit ();
00114 virtual void UpdateValue (bool notify = true);
00115
00116 CTRL_EDIT_OBJECTNAME (const CTRL_EDIT_OBJECTNAME&);
00117 CTRL_EDIT_OBJECTNAME& operator= (const CTRL_EDIT_OBJECTNAME&);
00118 };
00119
00120
00121
00122
00123
00124 template <class _CT> class CTRL_EDIT_OBJECTNAME_T : public MGUI::CTRL_EDIT_OBJECTNAME {
00125 public:
00126
00127
00128 explicit CTRL_EDIT_OBJECTNAME_T (
00129 ): m_pContainer(0), m_pfOnChangeValue(0), m_pfOnValidate(0)
00130 { }
00131
00132
00133 void Create (
00134 MGUI::LAYOUT_PANE_BASE& ParentPane,
00135 _CT *pContainer,
00136 void (_CT::*pfOnChangeValue)(),
00137 bool (_CT::*pfOnValidate)(MISTRING& string),
00138 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize
00139 ) {
00140 m_pContainer = pContainer;
00141 m_pfOnChangeValue = pfOnChangeValue;
00142 m_pfOnValidate = pfOnValidate;
00143 CTRL_EDIT_OBJECTNAME::Create(ParentPane, sizealign);
00144 }
00145
00146 private:
00147 _CT *m_pContainer;
00148 void (_CT::*m_pfOnChangeValue)();
00149 bool (_CT::*m_pfOnValidate)(MISTRING&);
00150
00151 virtual void OnChangeValue (
00152 ) {
00153 if (m_pContainer != 0) (m_pContainer->*m_pfOnChangeValue)();
00154 }
00155
00156 virtual bool OnValidate (
00157 MISTRING& str
00158 ) {
00159 if (m_pContainer != 0 && m_pfOnValidate != 0) return((m_pContainer->*m_pfOnValidate)(str));
00160 return (CTRL_EDIT_OBJECTNAME::OnValidate(str));
00161 }
00162 };
00163
00164
00165
00166
00167 class FORM_EDIT_OBJECTNAME : public MGUI::FORM_COMPOSITE {
00168 public:
00169
00170 FORM_EDIT_OBJECTNAME (
00171 );
00172
00173
00174 virtual ~FORM_EDIT_OBJECTNAME (
00175 );
00176
00177
00178 void ClearValue (
00179 bool notify = true
00180 ) { m_editctrl.ClearValue(notify); }
00181
00182
00183 void Create (
00184 MGUI::LAYOUT_PANE_BASE& ParentPane,
00185 const MISTRING& label,
00186 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize,
00187 MGUI::CTRL_LABEL::STYLE labelstyle = MGUI::CTRL_LABEL::STYLE_LeftNoWrap
00188 );
00189
00190
00191 MGUI::CTRL_EDIT_OBJECTNAME& GetEditCtrl (
00192 ) { return (m_editctrl); }
00193
00194
00195
00196 MGUI::CTRL_LABEL& GetLabel (
00197 ) { return (m_label); }
00198
00199
00200 const RVC::OBJECTNAME& GetValue (
00201 ) const { return (m_editctrl.GetValue()); }
00202
00203
00204
00205 void IniRead (
00206 INIHANDLE IniHandle,
00207 const char *IniGroup,
00208 const char *IniField,
00209 bool notify = true
00210 ) { m_editctrl.IniRead(IniHandle,IniGroup,IniField,notify); }
00211
00212
00213 void IniWrite (
00214 INIHANDLE IniHandle,
00215 const char *IniGroup,
00216 const char *IniField
00217 ) const { m_editctrl.IniWrite(IniHandle,IniGroup,IniField); }
00218
00219
00220 void SetLabel (
00221 const MISTRING& label
00222 ) { m_label.SetLabel(label); }
00223
00224
00225 void SetSelection (
00226 int StartChar = 0,
00227 int EndChar = -1,
00228 bool NoScroll = true
00229 ) { m_editctrl.SetSelection(StartChar,EndChar,NoScroll); }
00230
00231
00232
00233 void SetValidChars (
00234 const UNICODE* string,
00235 bool invert = false
00236 ) { m_editctrl.SetValidChars(string,invert); }
00237
00238
00239
00240
00241 void SetValue (
00242 const RVC::OBJECTNAME& name,
00243 bool notify = true
00244 ) { m_editctrl.SetValue(name, notify); }
00245
00246 protected:
00247
00248
00249
00250
00251 virtual void OnChangeValue ();
00252
00253
00254
00255
00256 virtual bool OnValidate (
00257 MISTRING& string
00258 );
00259
00260 private:
00261 CTRL_LABEL m_label;
00262 CTRL_EDIT_OBJECTNAME_T<FORM_EDIT_OBJECTNAME> m_editctrl;
00263 };
00264
00265
00266
00267
00268 template <class _CT> class FORM_EDIT_OBJECTNAME_T : public MGUI::FORM_EDIT_OBJECTNAME {
00269 public:
00270
00271
00272 explicit FORM_EDIT_OBJECTNAME_T (
00273 ): m_pContainer(0), m_pfOnChangeValue(0), m_pfOnValidate(0)
00274 { }
00275
00276
00277 void Create (
00278 MGUI::LAYOUT_PANE_BASE& ParentPane,
00279 const MISTRING& label,
00280 _CT *pContainer,
00281 void (_CT::*pfOnChangeValue)(),
00282 bool (_CT::*pfOnValidate)(MISTRING& string),
00283 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize,
00284 MGUI::CTRL_LABEL::STYLE labelstyle = MGUI::CTRL_LABEL::STYLE_LeftNoWrap
00285 ) {
00286 m_pContainer = pContainer;
00287 m_pfOnChangeValue = pfOnChangeValue;
00288 m_pfOnValidate = pfOnValidate;
00289 FORM_EDIT_OBJECTNAME::Create(ParentPane,label,sizealign,labelstyle);
00290 }
00291
00292 private:
00293
00294 _CT *m_pContainer;
00295 void (_CT::*m_pfOnChangeValue)();
00296 bool (_CT::*m_pfOnValidate)(MISTRING&);
00297
00298 virtual void OnChangeValue (
00299 ) { if (m_pfOnChangeValue != 0) (m_pContainer->*m_pfOnChangeValue)(); }
00300 virtual bool OnValidate (
00301 MISTRING& string
00302 ) { return ((m_pfOnValidate != 0) ? (m_pContainer->*m_pfOnValidate)(string) : true); }
00303 };
00304
00305 }
00306
00307 #endif // INC_MGUI_FORM_EDIT_OBJNAME_H
00308