]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/spinctrl.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / gtk1 / spinctrl.h
CommitLineData
738f9e5a 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/spinctrl.h
738f9e5a
RR
3// Purpose: wxSpinCtrl class
4// Author: Robert Roebling
5// Modified by:
738f9e5a 6// Copyright: (c) Robert Roebling
65571936 7// Licence: wxWindows licence
738f9e5a
RR
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef __GTKSPINCTRLH__
11#define __GTKSPINCTRLH__
12
a075e27b
RR
13#include "wx/defs.h"
14
15#if wxUSE_SPINCTRL
16
17#include "wx/control.h"
18
738f9e5a 19//-----------------------------------------------------------------------------
ce89fdd2 20// wxSpinCtrl
738f9e5a
RR
21//-----------------------------------------------------------------------------
22
20123d49 23class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl
738f9e5a
RR
24{
25public:
26 wxSpinCtrl() {}
27 wxSpinCtrl(wxWindow *parent,
28 wxWindowID id = -1,
ce89fdd2 29 const wxString& value = wxEmptyString,
738f9e5a
RR
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = wxSP_ARROW_KEYS,
33 int min = 0, int max = 100, int initial = 0,
9a83f860 34 const wxString& name = wxT("wxSpinCtrl"))
738f9e5a 35 {
ce89fdd2 36 Create(parent, id, value, pos, size, style, min, max, initial, name);
738f9e5a
RR
37 }
38
39 bool Create(wxWindow *parent,
40 wxWindowID id = -1,
ce89fdd2 41 const wxString& value = wxEmptyString,
738f9e5a
RR
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = wxSP_ARROW_KEYS,
45 int min = 0, int max = 100, int initial = 0,
9a83f860 46 const wxString& name = wxT("wxSpinCtrl"));
738f9e5a 47
ce89fdd2 48 void SetValue(const wxString& text);
f8f9ec55 49 void SetSelection(long from, long to);
ce89fdd2 50
738f9e5a
RR
51 virtual int GetValue() const;
52 virtual void SetValue( int value );
53 virtual void SetRange( int minVal, int maxVal );
54 virtual int GetMin() const;
55 virtual int GetMax() const;
56
9d522606
RD
57 static wxVisualAttributes
58 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
8ef94bfc 59
ce89fdd2 60 // implementation
da048e3d 61 void OnChar( wxKeyEvent &event );
8ef94bfc 62
738f9e5a 63 bool IsOwnGtkWindow( GdkWindow *window );
07f5b19a
RR
64 void GtkDisableEvents();
65 void GtkEnableEvents();
738f9e5a
RR
66
67 GtkAdjustment *m_adjust;
68 float m_oldPos;
69
bab5e0d0
JJ
70 virtual int GetBase() const { return m_base; }
71 virtual bool SetBase(int base);
72
73 protected:
9d9b7755
VZ
74 virtual wxSize DoGetBestSize() const;
75
9d522606
RD
76 // Widgets that use the style->base colour for the BG colour should
77 // override this and return true.
78 virtual bool UseGTKStyleBase() const { return true; }
79
738f9e5a 80private:
bab5e0d0
JJ
81 // Common part of all ctors.
82 void Init()
83 {
84 m_base = 10;
85 }
86
87 int m_base;
88
738f9e5a 89 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
da048e3d 90 DECLARE_EVENT_TABLE()
738f9e5a
RR
91};
92
a075e27b
RR
93#endif
94 // wxUSE_SPINCTRL
95
738f9e5a
RR
96#endif
97 // __GTKSPINCTRLH__