]> git.saurik.com Git - wxWidgets.git/blob - samples/validate/validate.h
Committing in .
[wxWidgets.git] / samples / validate / validate.h
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$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(__APPLE__)
13 # pragma interface
14 #endif
15
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
24 // Define a new application type
25 class MyApp : public wxApp
26 {
27 public:
28 bool OnInit();
29 };
30
31 // Define a new frame type
32 class MyFrame : public wxFrame
33 {
34 public:
35 MyFrame(wxFrame *frame, const wxString&title, int x, int y, int w, int h);
36
37 void OnQuit(wxCommandEvent& event);
38 void OnTestDialog(wxCommandEvent& event);
39 void OnToggleBell(wxCommandEvent& event);
40
41 private:
42 wxListBox *m_listbox;
43 bool m_silent;
44
45 DECLARE_EVENT_TABLE()
46 };
47
48 class MyDialog : public wxDialog
49 {
50 public:
51 MyDialog(wxWindow *parent, const wxString& title,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 const long style = wxDEFAULT_DIALOG_STYLE);
55 bool TransferDataToWindow();
56 wxTextCtrl *text;
57 wxComboBox *combobox;
58 };
59
60 class MyData
61 {
62 public:
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:
67 wxString m_string;
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;
76 };
77
78 #define VALIDATE_DIALOG_ID 200
79
80 #define VALIDATE_TEST_DIALOG 2
81 #define VALIDATE_TOGGLE_BELL 3
82
83 #define VALIDATE_TEXT 101
84 #define VALIDATE_LIST 102
85 #define VALIDATE_CHECK 103
86 #define VALIDATE_COMBO 105
87 #define VALIDATE_RADIO 106
88