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
|
|
|
};
|
|
|
|
|
|
|
|
#define VALIDATE_DIALOG_ID 200
|
|
|
|
|
2003-01-26 19:19:36 -05:00
|
|
|
#define VALIDATE_TEST_DIALOG 2
|
|
|
|
#define VALIDATE_TOGGLE_BELL 3
|
|
|
|
|
1998-05-22 15:57:05 -04:00
|
|
|
#define VALIDATE_TEXT 101
|
2003-01-26 19:19:36 -05:00
|
|
|
#define VALIDATE_LIST 102
|
|
|
|
#define VALIDATE_CHECK 103
|
|
|
|
#define VALIDATE_COMBO 105
|
|
|
|
#define VALIDATE_RADIO 106
|
1998-05-22 15:57:05 -04:00
|
|
|
|