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