1998-05-22 15:57:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: validate.h
|
2004-05-25 07:20:37 -04:00
|
|
|
// Purpose: wxWidgets validation sample
|
1998-05-22 15:57:05 -04:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 06:55:54 -05:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-02-25 09:47:18 -05:00
|
|
|
// Licence: wxWindows license
|
1998-05-22 15:57:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2003-01-26 19:19:36 -05:00
|
|
|
#include "wx/app.h"
|
|
|
|
#include "wx/combobox.h"
|
|
|
|
#include "wx/dialog.h"
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
#include "wx/frame.h"
|
|
|
|
#include "wx/listbox.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
|
1998-05-22 15:57:05 -04:00
|
|
|
// Define a new application type
|
1999-02-25 09:47:18 -05:00
|
|
|
class MyApp : public wxApp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool OnInit();
|
1998-05-22 15:57:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Define a new frame type
|
1999-02-25 09:47:18 -05:00
|
|
|
class MyFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
2003-07-23 15:04:42 -04:00
|
|
|
MyFrame(wxFrame *frame, const wxString&title, int x, int y, int w, int h);
|
1999-02-25 09:47:18 -05:00
|
|
|
|
1998-05-22 15:57:05 -04:00
|
|
|
void OnQuit(wxCommandEvent& event);
|
|
|
|
void OnTestDialog(wxCommandEvent& event);
|
2003-01-26 19:19:36 -05:00
|
|
|
void OnToggleBell(wxCommandEvent& event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxListBox *m_listbox;
|
|
|
|
bool m_silent;
|
1998-05-22 15:57:05 -04:00
|
|
|
|
1999-02-25 09:47:18 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-22 15:57:05 -04:00
|
|
|
};
|
|
|
|
|
1999-02-25 09:47:18 -05:00
|
|
|
class MyDialog : public wxDialog
|
1998-05-22 15:57:05 -04:00
|
|
|
{
|
|
|
|
public:
|
2003-01-26 19:19:36 -05:00
|
|
|
MyDialog(wxWindow *parent, const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1999-02-25 09:47:18 -05:00
|
|
|
const long style = wxDEFAULT_DIALOG_STYLE);
|
2003-01-26 19:19:36 -05:00
|
|
|
bool TransferDataToWindow();
|
|
|
|
wxTextCtrl *text;
|
|
|
|
wxComboBox *combobox;
|
1998-05-22 15:57:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class MyData
|
|
|
|
{
|
1999-02-25 09:47:18 -05:00
|
|
|
public:
|
2003-01-26 19:19:36 -05:00
|
|
|
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:
|
1998-05-22 15:57:05 -04:00
|
|
|
wxString m_string;
|
2003-01-26 19:19:36 -05:00
|
|
|
// 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;
|
|
|
|
int m_radiobox_choice;
|
1998-05-22 15:57:05 -04:00
|
|
|
};
|
|
|
|
|
2006-07-20 07:57:15 -04:00
|
|
|
enum {
|
|
|
|
VALIDATE_DIALOG_ID = wxID_HIGHEST,
|
1998-05-22 15:57:05 -04:00
|
|
|
|
2006-07-20 07:57:15 -04:00
|
|
|
VALIDATE_TEST_DIALOG,
|
|
|
|
VALIDATE_TOGGLE_BELL,
|
1998-05-22 15:57:05 -04:00
|
|
|
|
2006-07-20 07:57:15 -04:00
|
|
|
VALIDATE_TEXT,
|
|
|
|
VALIDATE_LIST,
|
|
|
|
VALIDATE_CHECK,
|
|
|
|
VALIDATE_COMBO,
|
|
|
|
VALIDATE_RADIO
|
|
|
|
};
|