]>
Commit | Line | Data |
---|---|---|
457814b5 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: validate.h | |
be5a51fb | 3 | // Purpose: wxWidgets validation sample |
457814b5 JS |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
a994f81b | 9 | // Licence: wxWindows license |
457814b5 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
2b61c41b VZ |
12 | #include "wx/app.h" |
13 | #include "wx/combobox.h" | |
14 | #include "wx/dialog.h" | |
15 | #include "wx/dynarray.h" | |
16 | #include "wx/frame.h" | |
17 | #include "wx/listbox.h" | |
18 | #include "wx/string.h" | |
19 | ||
457814b5 | 20 | // Define a new application type |
a994f81b VZ |
21 | class MyApp : public wxApp |
22 | { | |
23 | public: | |
24 | bool OnInit(); | |
457814b5 JS |
25 | }; |
26 | ||
27 | // Define a new frame type | |
a994f81b VZ |
28 | class MyFrame : public wxFrame |
29 | { | |
30 | public: | |
7df07b10 | 31 | MyFrame(wxFrame *frame, const wxString&title, int x, int y, int w, int h); |
a994f81b | 32 | |
457814b5 JS |
33 | void OnQuit(wxCommandEvent& event); |
34 | void OnTestDialog(wxCommandEvent& event); | |
2b61c41b VZ |
35 | void OnToggleBell(wxCommandEvent& event); |
36 | ||
37 | private: | |
38 | wxListBox *m_listbox; | |
39 | bool m_silent; | |
457814b5 | 40 | |
a994f81b | 41 | DECLARE_EVENT_TABLE() |
457814b5 JS |
42 | }; |
43 | ||
a994f81b | 44 | class MyDialog : public wxDialog |
457814b5 JS |
45 | { |
46 | public: | |
2b61c41b VZ |
47 | MyDialog(wxWindow *parent, const wxString& title, |
48 | const wxPoint& pos = wxDefaultPosition, | |
49 | const wxSize& size = wxDefaultSize, | |
a994f81b | 50 | const long style = wxDEFAULT_DIALOG_STYLE); |
2b61c41b VZ |
51 | bool TransferDataToWindow(); |
52 | wxTextCtrl *text; | |
53 | wxComboBox *combobox; | |
457814b5 JS |
54 | }; |
55 | ||
56 | class MyData | |
57 | { | |
a994f81b | 58 | public: |
2b61c41b VZ |
59 | MyData(); |
60 | // These data members are designed for transfer to and from | |
61 | // controls, via validators. For instance, a text control's | |
62 | // transferred value is a string: | |
457814b5 | 63 | wxString m_string; |
2b61c41b VZ |
64 | // Listboxes may permit multiple selections, so their state |
65 | // is transferred to an integer-array class. | |
66 | wxArrayInt m_listbox_choices; | |
67 | bool m_checkbox_state; | |
68 | // Comboboxes differ from listboxes--validators transfer | |
69 | // the string entered in the combobox's text-edit field. | |
70 | wxString m_combobox_choice; | |
71 | int m_radiobox_choice; | |
457814b5 JS |
72 | }; |
73 | ||
74 | #define VALIDATE_DIALOG_ID 200 | |
75 | ||
2b61c41b VZ |
76 | #define VALIDATE_TEST_DIALOG 2 |
77 | #define VALIDATE_TOGGLE_BELL 3 | |
78 | ||
457814b5 | 79 | #define VALIDATE_TEXT 101 |
2b61c41b VZ |
80 | #define VALIDATE_LIST 102 |
81 | #define VALIDATE_CHECK 103 | |
82 | #define VALIDATE_COMBO 105 | |
83 | #define VALIDATE_RADIO 106 | |
457814b5 | 84 |