]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/spinctrl.h
add wx-prefixed and semicolon-requiring versions of DECLARE_NO_{COPY,ASSIGN}_CLASS...
[wxWidgets.git] / include / wx / gtk1 / spinctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/spinctrl.h
3 // Purpose: wxSpinCtrl class
4 // Author: Robert Roebling
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef __GTKSPINCTRLH__
12 #define __GTKSPINCTRLH__
13
14 #include "wx/defs.h"
15
16 #if wxUSE_SPINCTRL
17
18 #include "wx/control.h"
19
20 //-----------------------------------------------------------------------------
21 // wxSpinCtrl
22 //-----------------------------------------------------------------------------
23
24 class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl
25 {
26 public:
27 wxSpinCtrl() {}
28 wxSpinCtrl(wxWindow *parent,
29 wxWindowID id = -1,
30 const wxString& value = wxEmptyString,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = wxSP_ARROW_KEYS,
34 int min = 0, int max = 100, int initial = 0,
35 const wxString& name = _T("wxSpinCtrl"))
36 {
37 Create(parent, id, value, pos, size, style, min, max, initial, name);
38 }
39
40 bool Create(wxWindow *parent,
41 wxWindowID id = -1,
42 const wxString& value = wxEmptyString,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 long style = wxSP_ARROW_KEYS,
46 int min = 0, int max = 100, int initial = 0,
47 const wxString& name = _T("wxSpinCtrl"));
48
49 void SetValue(const wxString& text);
50 void SetSelection(long from, long to);
51
52 virtual int GetValue() const;
53 virtual void SetValue( int value );
54 virtual void SetRange( int minVal, int maxVal );
55 virtual int GetMin() const;
56 virtual int GetMax() const;
57
58 static wxVisualAttributes
59 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
60
61 // implementation
62 void OnChar( wxKeyEvent &event );
63
64 bool IsOwnGtkWindow( GdkWindow *window );
65 void GtkDisableEvents();
66 void GtkEnableEvents();
67
68 GtkAdjustment *m_adjust;
69 float m_oldPos;
70
71 protected:
72 virtual wxSize DoGetBestSize() const;
73
74 // Widgets that use the style->base colour for the BG colour should
75 // override this and return true.
76 virtual bool UseGTKStyleBase() const { return true; }
77
78 private:
79 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
80 DECLARE_EVENT_TABLE()
81 };
82
83 #endif
84 // wxUSE_SPINCTRL
85
86 #endif
87 // __GTKSPINCTRLH__