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