]> git.saurik.com Git - wxWidgets.git/blame - samples/validate/validate.h
use wxDC::GetMultiLineTextExtent() instead of duplicating its code in wxButton::DoGet...
[wxWidgets.git] / samples / validate / validate.h
CommitLineData
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
830f7bc4 12#if defined(__GNUG__) && !defined(__APPLE__)
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
25class MyApp : public wxApp
26{
27public:
28 bool OnInit();
457814b5
JS
29};
30
31// Define a new frame type
a994f81b
VZ
32class MyFrame : public wxFrame
33{
34public:
7df07b10 35 MyFrame(wxFrame *frame, const wxString&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
41private:
42 wxListBox *m_listbox;
43 bool m_silent;
457814b5 44
a994f81b 45 DECLARE_EVENT_TABLE()
457814b5
JS
46};
47
a994f81b 48class MyDialog : public wxDialog
457814b5
JS
49{
50public:
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
60class MyData
61{
a994f81b 62public:
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