]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/numdlgg.h
added wxQueueEvent() avoiding the bug of wxPostEvent() with the events having wxStrin...
[wxWidgets.git] / include / wx / generic / numdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/numdlgg.h
3 // Purpose: wxNumberEntryDialog class
4 // Author: John Labenski
5 // Modified by:
6 // Created: 07.02.04 (extracted from textdlgg.cpp)
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __NUMDLGH_G__
13 #define __NUMDLGH_G__
14
15 #include "wx/defs.h"
16
17 #if wxUSE_NUMBERDLG
18
19 #include "wx/dialog.h"
20
21 #if wxUSE_SPINCTRL
22 class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
23 #else
24 class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
25 #endif // wxUSE_SPINCTRL
26
27 // ----------------------------------------------------------------------------
28 // wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons
29 // ----------------------------------------------------------------------------
30
31 class WXDLLIMPEXP_CORE wxNumberEntryDialog : public wxDialog
32 {
33 public:
34 wxNumberEntryDialog(wxWindow *parent,
35 const wxString& message,
36 const wxString& prompt,
37 const wxString& caption,
38 long value, long min, long max,
39 const wxPoint& pos = wxDefaultPosition);
40
41 long GetValue() const { return m_value; }
42
43 // implementation only
44 void OnOK(wxCommandEvent& event);
45 void OnCancel(wxCommandEvent& event);
46
47 protected:
48
49 #if wxUSE_SPINCTRL
50 wxSpinCtrl *m_spinctrl;
51 #else
52 wxTextCtrl *m_spinctrl;
53 #endif // wxUSE_SPINCTRL
54
55 long m_value, m_min, m_max;
56
57 private:
58 DECLARE_EVENT_TABLE()
59 DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog)
60 DECLARE_NO_COPY_CLASS(wxNumberEntryDialog)
61 };
62
63 // ----------------------------------------------------------------------------
64 // function to get a number from user
65 // ----------------------------------------------------------------------------
66
67 WXDLLIMPEXP_CORE long
68 wxGetNumberFromUser(const wxString& message,
69 const wxString& prompt,
70 const wxString& caption,
71 long value = 0,
72 long min = 0,
73 long max = 100,
74 wxWindow *parent = (wxWindow *)NULL,
75 const wxPoint& pos = wxDefaultPosition);
76
77 #endif // wxUSE_NUMBERDLG
78
79 #endif // __NUMDLGH_G__