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 // Copyright:   (c) wxWidgets team
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef __NUMDLGH_G__
12 #define __NUMDLGH_G__
13 
14 #include "wx/defs.h"
15 
16 #if wxUSE_NUMBERDLG
17 
18 #include "wx/dialog.h"
19 
20 #if wxUSE_SPINCTRL
21     class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
22 #else
23     class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
24 #endif // wxUSE_SPINCTRL
25 
26 // ----------------------------------------------------------------------------
27 // wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons
28 // ----------------------------------------------------------------------------
29 
30 class WXDLLIMPEXP_CORE wxNumberEntryDialog : public wxDialog
31 {
32 public:
33     wxNumberEntryDialog(wxWindow *parent,
34                         const wxString& message,
35                         const wxString& prompt,
36                         const wxString& caption,
37                         long value, long min, long max,
38                         const wxPoint& pos = wxDefaultPosition);
39 
GetValue()40     long GetValue() const { return m_value; }
41 
42     // implementation only
43     void OnOK(wxCommandEvent& event);
44     void OnCancel(wxCommandEvent& event);
45 
46 protected:
47 
48 #if wxUSE_SPINCTRL
49     wxSpinCtrl *m_spinctrl;
50 #else
51     wxTextCtrl *m_spinctrl;
52 #endif // wxUSE_SPINCTRL
53 
54     long m_value, m_min, m_max;
55 
56 private:
57     DECLARE_EVENT_TABLE()
58     DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog)
59     wxDECLARE_NO_COPY_CLASS(wxNumberEntryDialog);
60 };
61 
62 // ----------------------------------------------------------------------------
63 // function to get a number from user
64 // ----------------------------------------------------------------------------
65 
66 WXDLLIMPEXP_CORE long
67     wxGetNumberFromUser(const wxString& message,
68                         const wxString& prompt,
69                         const wxString& caption,
70                         long value = 0,
71                         long min = 0,
72                         long max = 100,
73                         wxWindow *parent = NULL,
74                         const wxPoint& pos = wxDefaultPosition);
75 
76 #endif // wxUSE_NUMBERDLG
77 
78 #endif // __NUMDLGH_G__
79