1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/spinctrlcmn.cpp
3 // Purpose: define wxSpinCtrl event types
7 // Copyright: (c) 2008-2009 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
26 #include "wx/spinbutt.h"
27 #include "wx/spinctrl.h"
31 wxDEFINE_EVENT(wxEVT_COMMAND_SPINCTRL_UPDATED
, wxSpinEvent
);
32 wxDEFINE_EVENT(wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED
, wxSpinDoubleEvent
);
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 wxDEFINE_FLAGS( wxSpinCtrlStyle
)
39 wxBEGIN_FLAGS( wxSpinCtrlStyle
)
40 // new style border flags, we put them first to
41 // use them for streaming out
42 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
43 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
44 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
45 wxFLAGS_MEMBER(wxBORDER_RAISED
)
46 wxFLAGS_MEMBER(wxBORDER_STATIC
)
47 wxFLAGS_MEMBER(wxBORDER_NONE
)
49 // old style border flags
50 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
51 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
52 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
53 wxFLAGS_MEMBER(wxRAISED_BORDER
)
54 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
55 wxFLAGS_MEMBER(wxBORDER
)
57 // standard window styles
58 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
59 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
60 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
61 wxFLAGS_MEMBER(wxWANTS_CHARS
)
62 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
63 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
64 wxFLAGS_MEMBER(wxVSCROLL
)
65 wxFLAGS_MEMBER(wxHSCROLL
)
67 wxFLAGS_MEMBER(wxSP_HORIZONTAL
)
68 wxFLAGS_MEMBER(wxSP_VERTICAL
)
69 wxFLAGS_MEMBER(wxSP_ARROW_KEYS
)
70 wxFLAGS_MEMBER(wxSP_WRAP
)
71 wxEND_FLAGS( wxSpinCtrlStyle
)
73 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl
, wxControl
, "wx/spinctrl.h")
75 wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl
)
76 wxEVENT_RANGE_PROPERTY( Spin
, wxEVT_SCROLL_TOP
, wxEVT_SCROLL_CHANGED
, wxSpinEvent
)
78 wxEVENT_PROPERTY( Updated
, wxEVT_COMMAND_SPINCTRL_UPDATED
, wxCommandEvent
)
79 wxEVENT_PROPERTY( TextUpdated
, wxEVT_COMMAND_TEXT_UPDATED
, wxCommandEvent
)
80 wxEVENT_PROPERTY( TextEnter
, wxEVT_COMMAND_TEXT_ENTER
, wxCommandEvent
)
82 wxPROPERTY( ValueString
, wxString
, SetValue
, GetValue
, \
83 wxEMPTY_PARAMETER_VALUE
, 0 /*flags*/, wxT("Helpstring"), wxT("group")) ;
84 wxPROPERTY( Value
, int, SetValue
, GetValue
, 0, 0 /*flags*/, \
85 wxT("Helpstring"), wxT("group"))
87 wxPROPERTY( Min
, int, SetMin
, GetMin
, 0, 0 /*flags*/, wxT("Helpstring"), wxT("group") )
88 wxPROPERTY( Max
, int, SetMax
, GetMax
, 0, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
90 wxPROPERTY_FLAGS( WindowStyle
, wxSpinCtrlStyle
, long, SetWindowStyleFlag
, \
91 GetWindowStyleFlag
, wxEMPTY_PARAMETER_VALUE
, 0 /*flags*/, \
92 wxT("Helpstring"), wxT("group")) // style
97 wxEND_PROPERTIES_TABLE()
99 wxEMPTY_HANDLERS_TABLE(wxSpinCtrl
)
101 wxCONSTRUCTOR_6( wxSpinCtrl
, wxWindow
*, Parent
, wxWindowID
, Id
, \
102 wxString
, ValueString
, wxPoint
, Position
, \
103 wxSize
, Size
, long, WindowStyle
)
106 wxString
wxPrivate::wxSpinCtrlFormatAsHex(long val
, long maxVal
)
108 // We format the value like this is for compatibility with (native
109 // behaviour of) wxMSW
111 if ( maxVal
< 0x10000 )
112 text
.Printf(wxS("0x%04lx"), val
);
114 text
.Printf(wxS("0x%08lx"), val
);
119 #endif // wxUSE_SPINCTRL