00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _AX_MENU_RANGE_H_
00013 #define _AX_MENU_RANGE_H_
00014
00015
00016
00017
00018
00019 #include "ax/ax_activator.h"
00020 #include "ax/ax_menu_modal.h"
00021 #include "ax/ax_validator.h"
00022
00023
00024
00025
00026
00027 class AxRangeActivator;
00028 class AxRangeMenuItem;
00029
00039 class AxRangeActivator: public AxAutoUpdateActivator
00040 {
00041 public:
00042
00043 DECLARE_DYNAMIC_CLASS( AxRangeActivator )
00044
00045 typedef enum
00046 {
00047 AxRangeCommandUnknown,
00048 AxRangeCommandUp,
00049 AxRangeCommandDown,
00050 AxRangeCommandEnterValue,
00051 AxRangeCommandMain
00052
00053 } AxRangeCommand;
00054
00055 public:
00056
00057
00058 AxRangeActivator() { Init(); }
00059
00060 AxRangeActivator(
00061 const wxString& labelSpec,
00062 const wxString& descriptionSpec,
00063 AxRangeCommand cmd,
00064 AxRangeActivator* mainActivator,
00065 AxMenuController* controller,
00066 AxMenuItem* item);
00067
00068 AxRangeActivator(const AxRangeActivator& activator) { Init(); Copy(activator); }
00069
00070 void Init();
00071
00072 void Copy(const AxRangeActivator& activator);
00073
00074 virtual AxActivator* Clone() const { return new AxRangeActivator(* this); }
00075
00077 virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);
00078
00080 virtual wxString CreateString(const wxString& spec, bool isLabel);
00081
00083 virtual bool BumpValue(int by);
00084
00086 virtual bool EnterValue();
00087
00088 AxRangeActivator* GetMainActivator() const { return m_mainActivator; }
00089 void SetMainActivator(AxRangeActivator* activator) { m_mainActivator = activator; }
00090
00091 AxRangeMenuItem* GetRangeMenuItem() const;
00092
00093 protected:
00094 AxRangeActivator* m_mainActivator;
00095 AxRangeCommand m_command;
00096 AxMenuController* m_controller;
00097 AxMenuItem* m_item;
00098 };
00099
00110 class AxRangeMenuItem: public AxMenuItem
00111 {
00112 DECLARE_DYNAMIC_CLASS( AxRangeMenuItem )
00113
00114 public:
00115
00116
00117 AxRangeMenuItem(const AxRangeMenuItem& item) { Copy(item); }
00118 AxRangeMenuItem() {}
00119 AxRangeMenuItem(const wxString& label, const wxString& description,
00120 const wxString& id,
00121 int minValue,
00122 int maxValue,
00123 int value);
00124 bool Create(const wxString& label, const wxString& description,
00125 const wxString& id,
00126 int minValue,
00127 int maxValue,
00128 int value);
00129
00130 void Copy(const AxRangeMenuItem& item);
00131
00132 virtual AxMenuItem* Clone() { return new AxRangeMenuItem(* this); }
00133
00134 void SetValue(int value);
00135 int GetValue() const { return m_value; }
00136
00137 void SetMinValue(int minValue) { m_minValue = minValue; }
00138 int GetMinValue() const { return m_minValue; }
00139
00140 void SetMaxValue(int maxValue) { m_maxValue = maxValue; }
00141 int GetMaxValue() const { return m_maxValue; }
00142
00143 wxString CreateString(const wxString& spec, bool isLabel);
00144
00145 void SendRangeUpdate(int value);
00146
00147 protected:
00148 int m_minValue;
00149 int m_maxValue;
00150 int m_value;
00151 };
00152
00157 class AxRangeValidator: public AxValidator
00158 {
00159 DECLARE_DYNAMIC_CLASS( AxRangeValidator )
00160
00161 public:
00162
00163
00164 AxRangeValidator(const AxRangeValidator& validator) { Init(); Copy(validator); }
00165 AxRangeValidator(int* ptr) { Init(); m_intPtr = ptr; }
00166 AxRangeValidator() { Init(); }
00167 ~AxRangeValidator() {}
00168
00169
00170
00171 void Copy(const AxRangeValidator& validator)
00172 {
00173 AxValidator::Copy(validator);
00174
00175 m_intPtr = validator.m_intPtr;
00176 }
00177
00178 virtual AxValidator* Clone() const { return new AxRangeValidator(*this); }
00179
00181 virtual bool TransferDataFromMenu();
00182
00184 virtual bool TransferDataToMenu();
00185
00187 void Init() { m_intPtr = NULL; }
00188
00189 protected:
00190 int* m_intPtr;
00191 };
00192
00193
00194 #endif
00195