wxWidgets/samples/validate/validate.h
Vadim Zeitlin 3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00

118 lines
2.8 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: validate.h
// Purpose: wxWidgets validation sample
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#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"
// Define a new application type
class MyApp : public wxApp
{
public:
bool OnInit();
};
// Define a new frame type
class MyFrame : public wxFrame
{
public:
MyFrame(wxFrame *frame, const wxString&title, int x, int y, int w, int h);
void OnQuit(wxCommandEvent& event);
void OnTestDialog(wxCommandEvent& event);
void OnToggleBell(wxCommandEvent& event);
private:
wxListBox *m_listbox;
bool m_silent;
DECLARE_EVENT_TABLE()
};
class MyDialog : public wxDialog
{
public:
MyDialog(wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const long style = wxDEFAULT_DIALOG_STYLE);
bool TransferDataToWindow();
wxTextCtrl *m_text;
wxComboBox *m_combobox;
wxTextCtrl *m_numericTextInt;
wxTextCtrl *m_numericTextDouble;
};
class MyData
{
public:
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:
wxString m_string, m_string2;
// Listboxes may permit multiple selections, so their state
// is transferred to an integer-array class.
wxArrayInt m_listbox_choices;
// Comboboxes differ from listboxes--validators transfer
// the string entered in the combobox's text-edit field.
wxString m_combobox_choice;
// variables handled by wxNumericTextValidator
int m_intValue;
double m_doubleValue;
bool m_checkbox_state;
int m_radiobox_choice;
};
class MyComboBoxValidator : public wxValidator
{
public:
MyComboBoxValidator(const MyComboBoxValidator& tocopy) { m_var=tocopy.m_var; }
MyComboBoxValidator(wxString* var) { m_var=var; }
virtual bool Validate(wxWindow* parent);
virtual wxObject* Clone() const { return new MyComboBoxValidator(*this); }
// Called to transfer data to the window
virtual bool TransferToWindow();
// Called to transfer data from the window
virtual bool TransferFromWindow();
protected:
wxString* m_var;
};
enum
{
VALIDATE_DIALOG_ID = wxID_HIGHEST,
VALIDATE_TEST_DIALOG,
VALIDATE_TOGGLE_BELL,
VALIDATE_TEXT,
VALIDATE_TEXT2,
VALIDATE_LIST,
VALIDATE_CHECK,
VALIDATE_COMBO,
VALIDATE_RADIO
};