]>
git.saurik.com Git - wxWidgets.git/blob - src/common/spinctrlcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/spinctrlcmn.cpp
3 // Purpose: define wxSpinCtrl event types
6 // Copyright: (c) 2008-2009 wxWidgets team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // ============================================================================
12 // ============================================================================
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
18 // For compilers that support precompilation, includes "wx.h".
19 #include "wx/wxprec.h"
25 #include "wx/spinbutt.h"
26 #include "wx/spinctrl.h"
30 wxDEFINE_EVENT(wxEVT_SPINCTRL
, wxSpinEvent
);
31 wxDEFINE_EVENT(wxEVT_SPINCTRLDOUBLE
, wxSpinDoubleEvent
);
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 wxDEFINE_FLAGS( wxSpinCtrlStyle
)
38 wxBEGIN_FLAGS( wxSpinCtrlStyle
)
39 // new style border flags, we put them first to
40 // use them for streaming out
41 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
42 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
43 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
44 wxFLAGS_MEMBER(wxBORDER_RAISED
)
45 wxFLAGS_MEMBER(wxBORDER_STATIC
)
46 wxFLAGS_MEMBER(wxBORDER_NONE
)
48 // old style border flags
49 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
50 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
51 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
52 wxFLAGS_MEMBER(wxRAISED_BORDER
)
53 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
54 wxFLAGS_MEMBER(wxBORDER
)
56 // standard window styles
57 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
58 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
59 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
60 wxFLAGS_MEMBER(wxWANTS_CHARS
)
61 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
62 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
63 wxFLAGS_MEMBER(wxVSCROLL
)
64 wxFLAGS_MEMBER(wxHSCROLL
)
66 wxFLAGS_MEMBER(wxSP_HORIZONTAL
)
67 wxFLAGS_MEMBER(wxSP_VERTICAL
)
68 wxFLAGS_MEMBER(wxSP_ARROW_KEYS
)
69 wxFLAGS_MEMBER(wxSP_WRAP
)
70 wxEND_FLAGS( wxSpinCtrlStyle
)
72 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl
, wxControl
, "wx/spinctrl.h")
74 wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl
)
75 wxEVENT_RANGE_PROPERTY( Spin
, wxEVT_SCROLL_TOP
, wxEVT_SCROLL_CHANGED
, wxSpinEvent
)
77 wxEVENT_PROPERTY( Updated
, wxEVT_SPINCTRL
, wxCommandEvent
)
78 wxEVENT_PROPERTY( TextUpdated
, wxEVT_TEXT
, wxCommandEvent
)
79 wxEVENT_PROPERTY( TextEnter
, wxEVT_TEXT_ENTER
, wxCommandEvent
)
81 wxPROPERTY( ValueString
, wxString
, SetValue
, GetValue
, \
82 wxEMPTY_PARAMETER_VALUE
, 0 /*flags*/, wxT("Helpstring"), wxT("group")) ;
83 wxPROPERTY( Value
, int, SetValue
, GetValue
, 0, 0 /*flags*/, \
84 wxT("Helpstring"), wxT("group"))
86 wxPROPERTY( Min
, int, SetMin
, GetMin
, 0, 0 /*flags*/, wxT("Helpstring"), wxT("group") )
87 wxPROPERTY( Max
, int, SetMax
, GetMax
, 0, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
89 wxPROPERTY_FLAGS( WindowStyle
, wxSpinCtrlStyle
, long, SetWindowStyleFlag
, \
90 GetWindowStyleFlag
, wxEMPTY_PARAMETER_VALUE
, 0 /*flags*/, \
91 wxT("Helpstring"), wxT("group")) // style
96 wxEND_PROPERTIES_TABLE()
98 wxEMPTY_HANDLERS_TABLE(wxSpinCtrl
)
100 wxCONSTRUCTOR_6( wxSpinCtrl
, wxWindow
*, Parent
, wxWindowID
, Id
, \
101 wxString
, ValueString
, wxPoint
, Position
, \
102 wxSize
, Size
, long, WindowStyle
)
105 wxString
wxPrivate::wxSpinCtrlFormatAsHex(long val
, long maxVal
)
107 // We format the value like this is for compatibility with (native
108 // behaviour of) wxMSW
110 if ( maxVal
< 0x10000 )
111 text
.Printf(wxS("0x%04lx"), val
);
113 text
.Printf(wxS("0x%08lx"), val
);
118 #endif // wxUSE_SPINCTRL