X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0bcd4039e21badaad41a48f25ab0472b68c94326..f155075229d771430f0793700f5048ad4be00e9d:/samples/validate/validate.h diff --git a/samples/validate/validate.h b/samples/validate/validate.h index 09f7db7bda..beb50de15d 100644 --- a/samples/validate/validate.h +++ b/samples/validate/validate.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #include "wx/app.h" @@ -48,36 +48,69 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const long style = wxDEFAULT_DIALOG_STYLE); + bool TransferDataToWindow(); - wxTextCtrl *text; - wxComboBox *combobox; + wxTextCtrl *m_text; + wxComboBox *m_combobox; + + wxTextCtrl *m_numericTextInt; + wxTextCtrl *m_numericTextDouble; }; class MyData { public: MyData(); + // These data members are designed for transfer to and from // controls, via validators. For instance, a text control's // transferred value is a string: - wxString m_string; + wxString m_string, m_string2; + // Listboxes may permit multiple selections, so their state // is transferred to an integer-array class. wxArrayInt m_listbox_choices; - bool m_checkbox_state; + // Comboboxes differ from listboxes--validators transfer // the string entered in the combobox's text-edit field. wxString m_combobox_choice; + + // variables handled by wxNumericTextValidator + int m_intValue; + double m_doubleValue; + + bool m_checkbox_state; int m_radiobox_choice; }; -enum { +class MyComboBoxValidator : public wxValidator +{ +public: + MyComboBoxValidator(const MyComboBoxValidator& tocopy) { m_var=tocopy.m_var; } + MyComboBoxValidator(wxString* var) { m_var=var; } + + virtual bool Validate(wxWindow* parent); + virtual wxObject* Clone() const { return new MyComboBoxValidator(*this); } + + // Called to transfer data to the window + virtual bool TransferToWindow(); + + // Called to transfer data from the window + virtual bool TransferFromWindow(); + +protected: + wxString* m_var; +}; + +enum +{ VALIDATE_DIALOG_ID = wxID_HIGHEST, VALIDATE_TEST_DIALOG, VALIDATE_TOGGLE_BELL, VALIDATE_TEXT, + VALIDATE_TEXT2, VALIDATE_LIST, VALIDATE_CHECK, VALIDATE_COMBO,