include/ax/ax_menu_text.h

Go to the documentation of this file.
00001 
00002 // Name:        ax_menu_text.h
00003 // Purpose:     Text menu item class
00004 // Author:      Julian Smart
00005 // Modified by:
00006 // Created:     2009-03-20
00007 // RCS-ID:
00008 // Copyright:   (c) Julian Smart
00009 // Licence:     New BSD License
00011 
00012 #ifndef _AX_MENU_TEXT_H_
00013 #define _AX_MENU_TEXT_H_
00014 
00015 class AxTextMenuItem;
00016 
00017 /*
00018  * Includes
00019  */
00020 
00021 #include "ax/ax_menu.h"
00022 #include "ax/ax_activator.h"
00023 #include "ax/ax_validator.h"
00024 
00033 class AxTextActivator: public AxAutoUpdateActivator
00034 {
00035 public:
00036     
00037     DECLARE_DYNAMIC_CLASS( AxTextActivator )
00038 
00039 public:
00040 // Constructors
00041 
00042     AxTextActivator() {}
00043 
00044     AxTextActivator(
00045         const wxString& labelSpec,
00046         const wxString& descriptionSpec);
00047 
00048     AxTextActivator(const AxTextActivator& activator) { Init(); Copy(activator); }
00049 
00050     void Init();
00051 
00052     void Copy(const AxTextActivator& activator);
00053 
00054     virtual AxActivator* Clone() const { return new AxTextActivator(* this); }
00055 
00057     virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);
00058 
00060     virtual wxString CreateString(const wxString& spec, bool isLabel);
00061 
00062     AxTextMenuItem* GetTextMenuItem() const;
00063 
00064 protected:
00065 };
00066 
00083 #define axMENU_STYLE_MULTILINE_TEXT 0x0010
00084 
00085 class AxTextMenuItem: public AxMenuItem
00086 {
00087     DECLARE_DYNAMIC_CLASS( AxTextMenuItem )
00088 
00089 public:
00090 // Constructors
00091 
00092     AxTextMenuItem(const AxTextMenuItem& item) { Copy(item); }
00093     AxTextMenuItem() {}
00094     AxTextMenuItem(const wxString& label,
00095         const wxString& description,
00096         const wxString& id,
00097         const wxString& caption,
00098         const wxString& message,
00099         const wxString& value,
00100         int style = 0);
00101     bool Create(const wxString& label,
00102         const wxString& description,
00103         const wxString& id,
00104         const wxString& caption,
00105         const wxString& message,
00106         const wxString& value,
00107         int style = 0);
00108 
00109     void Init() {}
00110 
00111     void Copy(const AxTextMenuItem& item)
00112     {
00113         AxMenuItem::Copy(item);
00114 
00115         m_caption = item.m_caption;
00116         m_message = item.m_message;
00117         m_value = item.m_value;
00118     }
00119 
00120     AxMenuItem* Clone() const { return new AxTextMenuItem(*this); }
00121 
00123     void SetCaption(const wxString& caption) { m_caption = caption; }
00124 
00126     const wxString& GetCaption() const { return m_caption; }
00127 
00129     void SetMessage(const wxString& msg) { m_message = msg; }
00130 
00132     const wxString& GetMessage() const { return m_message; }
00133 
00135     void SetValue(const wxString& value);
00136 
00138     const wxString& GetValue() const { return m_value; }
00139 
00140     void SendTextUpdate(const wxString& value);
00141 
00142     wxString CreateString(const wxString& spec, bool isLabel);
00143 
00144 protected:
00145 
00146     wxString        m_caption;
00147     wxString        m_message;
00148     wxString        m_value;
00149 };
00150 
00155 class AxTextValidator: public AxValidator
00156 {
00157     DECLARE_DYNAMIC_CLASS( AxTextValidator )
00158 
00159 public:
00160 // Constructors
00161 
00162     AxTextValidator(const AxTextValidator& validator) { Init(); Copy(validator); }
00163     AxTextValidator(wxString* ptr) { Init(); m_stringPtr = ptr; }
00164     AxTextValidator() { Init(); }
00165     ~AxTextValidator() {}
00166 
00167 // Operations
00168 
00169     void Copy(const AxTextValidator& validator)
00170     {
00171         AxValidator::Copy(validator);
00172 
00173         m_stringPtr = validator.m_stringPtr;
00174     }
00175 
00176     virtual AxValidator* Clone() const { return new AxTextValidator(*this); }
00177 
00179     virtual bool TransferDataFromMenu();
00180 
00182     virtual bool TransferDataToMenu();
00183 
00185     void Init() { m_stringPtr = NULL; }
00186 
00187 protected:
00188     wxString*   m_stringPtr;
00189 };
00190 
00191 
00192 #endif
00193     // _AX_MENU_CHOICE_H_

Generated on Wed May 6 19:20:18 2009 for AxTk by  doxygen 1.5.1