]> git.saurik.com Git - wxWidgets.git/blame - include/wx/validate.h
Fixed property list OnClose problem that caused Dialog Editor problem
[wxWidgets.git] / include / wx / validate.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: validate.h
3// Purpose: wxValidator class
4// Author: Julian Smart
5// Modified by:
6// Created: 29/01/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Julian Smart
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_VALIDATEH__
13#define _WX_VALIDATEH__
c801d85f
KB
14
15#ifdef __GNUG__
16#pragma interface "validate.h"
17#endif
18
19#include "wx/event.h"
20
21class WXDLLEXPORT wxWindow;
22
23/*
24 A validator has up to three purposes:
25
26 1) To validate the data in the window that's associated
27 with the validator.
28 2) To transfer data to and from the window.
29 3) To filter input, using its role as a wxEvtHandler
30 to intercept e.g. OnChar.
31
32 Note that wxValidator and derived classes use reference counting.
33 */
34
35class WXDLLEXPORT wxValidator: public wxEvtHandler
36{
37DECLARE_DYNAMIC_CLASS(wxValidator)
38public:
39 wxValidator(void);
40 ~wxValidator();
41
42 // Make a clone of this validator (or return NULL) - currently necessary
43 // if you're passing a reference to a validator.
44 // Another possibility is to always pass a pointer to a new validator
45 // (so the calling code can use a copy constructor of the relevant class).
c67daf87 46 virtual wxValidator *Clone(void) const { return (wxValidator *) NULL; }
c801d85f
KB
47 inline bool Copy(const wxValidator& val) { m_validatorWindow = val.m_validatorWindow; return TRUE; }
48
49 // Called when the value in the window must be validated.
50 // This function can pop up an error message.
51 virtual bool Validate(wxWindow *WXUNUSED(parent)) { return FALSE; };
52
53 // Called to transfer data to the window
54 virtual bool TransferToWindow(void) { return FALSE; }
55
56 // Called to transfer data from the window
57 virtual bool TransferFromWindow(void) { return FALSE; };
58
59 // ACCESSORS
60 inline wxWindow *GetWindow(void) const { return m_validatorWindow; }
61 inline void SetWindow(wxWindow *win) { m_validatorWindow = win; }
62
63protected:
64 wxWindow *m_validatorWindow;
65};
66
67WXDLLEXPORT_DATA(extern const wxValidator) wxDefaultValidator;
68
69#endif
34138703 70 // _WX_VALIDATEH__