00001 00027 #ifndef INC_RVC_UIDLGDBFIELDREVALUE_H 00028 #define INC_RVC_UIDLGDBFIELDREVALUE_H 00029 00030 #ifndef INC_MGUI_DLGSHELL_H 00031 #include <mgui/dlgshell.h> 00032 #endif 00033 00034 #ifndef INC_MGUI_STATUSBAR_H 00035 #include <mgui/statusbar.h> 00036 #endif 00037 00038 #ifndef INC_RVC_UIFORMDBFIELDPICKLIST_H 00039 #include <rvc/uiformdbfieldpicklist.h> 00040 #endif 00041 00042 namespace RVC { 00043 namespace UI { 00044 //===================================================================================================================== 00045 00049 class DLG_DB_FIELD_REVALUE : public MGUI::DLGSHELL { 00050 public: 00051 00052 enum DLGSTYLE { 00053 DLGSTYLE_Default = 0, 00054 DLGSTYLE_AllowRedrawOnApply = 0x01, 00055 }; 00056 00058 explicit DLG_DB_FIELD_REVALUE ( 00059 const MISTRING& title, 00060 DLGSTYLE dlgstyle = DLGSTYLE_Default 00061 ); 00062 00064 virtual ~DLG_DB_FIELD_REVALUE (); 00065 00068 bool ApplyToRecord ( 00069 RVC::DBTABLE::RECORD& record 00070 ) const; 00071 00074 int ApplyToRecordNum ( 00075 INT32 RecordNum 00076 ); 00077 00079 bool CanApply () const 00080 { return (m_FormChangeFrom.HasSelection() && m_FormChangeTo.HasSelection()); } 00081 00083 INT32 GetFieldNumFor ( 00084 ) const { return (m_FieldNumFor); } 00085 00087 bool GetRedrawOnApply () const 00088 { return ((m_dlgstyle & DLGSTYLE_AllowRedrawOnApply) && m_Settings.GetRedrawOnApply()); }; 00089 00091 const RVC::DBTABLE& GetTableFor ( 00092 ) const { return (m_ObjTableFor); } 00093 00095 MGUI::CTRL_STATUSBAR& GetStatusBar ( 00096 ) { return (m_StatusBar); } 00097 00099 void SaveSettings (); 00100 00104 ERRVALUE Setup ( 00105 const RVC::DBTABLE& ObjTable, 00106 INT32 FieldNum, 00107 INT32 RelFieldDisplay = -1, 00108 INT32 RelFieldSortBy = -1 00109 ); 00110 00111 protected: 00112 00114 virtual void v_OnClose (); 00115 00116 private: 00117 #ifndef GENERATING_DOXYGEN_OUTPUT 00118 00119 typedef DLG_DB_FIELD_REVALUE THISCLASS; 00120 00121 class SETTINGS { 00122 public: 00123 static const SERIALIZERITEM* SerialGetItemDef (); 00124 00125 SETTINGS ( 00126 ); 00127 ~SETTINGS (); 00128 00129 const RVC::UI::FORM_DB_FIELD_PICKLIST::SETTINGS& GetChangeFrom ( 00130 ) const { return (m_SettingsChangeFrom); } 00131 const RVC::UI::FORM_DB_FIELD_PICKLIST::SETTINGS& GetChangeTo ( 00132 ) const { return (m_SettingsChangeTo); } 00133 const LPOINT2D& GetPosition ( 00134 ) const { return (m_Position); } 00135 bool GetRedrawOnApply () const 00136 { return (m_RedrawOnApply); } 00137 bool HasPosition ( 00138 ) const { return (m_Position.x >= 0 && m_Position.y >= 0); } 00139 bool IsChanged ( 00140 ) const { return (m_IsChanged); } 00141 void ResetChanged ( 00142 ) { m_IsChanged = false; } 00143 void SetChangeFrom (const RVC::UI::FORM_DB_FIELD_PICKLIST::SETTINGS& ChangeFrom); 00144 void SetChangeTo (const RVC::UI::FORM_DB_FIELD_PICKLIST::SETTINGS& ChangeTo); 00145 void SetFieldNumDisplay (INT32 FieldNum); 00146 void SetFieldNumSortBy (INT32 FieldNum); 00147 void SetPosition ( 00148 INT32 x, 00149 INT32 y 00150 ) { if (x != m_Position.x || y != m_Position.y) { m_IsChanged = true; m_Position.x = x; m_Position.y = y; } } 00151 void SetRedrawOnApply ( 00152 bool RedrawOnApply 00153 ) { if (RedrawOnApply != m_RedrawOnApply) { m_IsChanged = true; m_RedrawOnApply = RedrawOnApply; } } 00154 private: 00155 typedef SETTINGS THISCLASS; 00156 bool m_IsChanged; 00157 bool m_RedrawOnApply; 00158 LPOINT2D m_Position; 00159 RVC::UI::FORM_DB_FIELD_PICKLIST::SETTINGS m_SettingsChangeFrom; 00160 RVC::UI::FORM_DB_FIELD_PICKLIST::SETTINGS m_SettingsChangeTo; 00161 }; 00162 00163 DLGSTYLE m_dlgstyle; 00164 MISTRING m_ObjNameSettings; 00165 SETTINGS m_Settings; 00166 RVC::DBTABLE m_ObjTableFor; 00167 RVC::DBTABLE::RECORD m_RecordFor; 00168 INT32 m_FieldNumFor; 00169 RVC::DBTABLE m_ObjTablePickFrom; 00170 INT32 m_FieldNumPickFrom; 00171 bool m_AllowNone; 00172 RVC::UI::FORM_DB_FIELD_PICKLIST m_FormChangeFrom; 00173 RVC::UI::FORM_DB_FIELD_PICKLIST m_FormChangeTo; 00174 MGUI::CTRL_TOGGLEBUTTON m_TglRedrawOnApply; 00175 MGUI::CTRL_STATUSBAR m_StatusBar; 00176 00177 void EnableButtons (); 00178 void LoadSettings (); 00179 void OnTglRedrawOnApply (); 00180 00181 // SHELL/DLGSHELL overrides. 00182 virtual ERRVALUE v_CreateContent (); 00183 00184 #endif 00185 }; 00186 00187 //===================================================================================================================== 00188 } // End namespace UI 00189 } // End namespace RVC 00190 00191 #endif // INC_RVC_UIDLGDBFIELDREVALUE_H 00192
1.6.1