numdlgg.h 2.3 KB

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