]> git.saurik.com Git - wxWidgets.git/blob - src/common/scrolbarcmn.cpp
fixing overrelease and out-of-bounds write, fixes #13725
[wxWidgets.git] / src / common / scrolbarcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/scrolbarcmn.cpp
3 // Purpose: wxScrollBar common code
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #if wxUSE_SCROLLBAR
20
21 #include "wx/scrolbar.h"
22
23 #ifndef WX_PRECOMP
24 #include "wx/utils.h"
25 #include "wx/settings.h"
26 #endif
27
28 extern WXDLLEXPORT_DATA(const char) wxScrollBarNameStr[] = "scrollBar";
29
30 // ----------------------------------------------------------------------------
31 // XTI
32 // ----------------------------------------------------------------------------
33
34 wxDEFINE_FLAGS( wxScrollBarStyle )
35 wxBEGIN_FLAGS( wxScrollBarStyle )
36 // new style border flags, we put them first to
37 // use them for streaming out
38 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
39 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
40 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
41 wxFLAGS_MEMBER(wxBORDER_RAISED)
42 wxFLAGS_MEMBER(wxBORDER_STATIC)
43 wxFLAGS_MEMBER(wxBORDER_NONE)
44
45 // old style border flags
46 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
47 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
48 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
49 wxFLAGS_MEMBER(wxRAISED_BORDER)
50 wxFLAGS_MEMBER(wxSTATIC_BORDER)
51 wxFLAGS_MEMBER(wxBORDER)
52
53 // standard window styles
54 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
55 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
56 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
57 wxFLAGS_MEMBER(wxWANTS_CHARS)
58 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
59 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
60 wxFLAGS_MEMBER(wxVSCROLL)
61 wxFLAGS_MEMBER(wxHSCROLL)
62
63 wxFLAGS_MEMBER(wxSB_HORIZONTAL)
64 wxFLAGS_MEMBER(wxSB_VERTICAL)
65 wxEND_FLAGS( wxScrollBarStyle )
66
67 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxScrollBar, wxControl, "wx/scrolbar.h")
68
69 wxBEGIN_PROPERTIES_TABLE(wxScrollBar)
70 wxEVENT_RANGE_PROPERTY( Scroll, wxEVT_SCROLL_TOP, \
71 wxEVT_SCROLL_CHANGED, wxScrollEvent )
72
73 wxPROPERTY( ThumbPosition, int, SetThumbPosition, GetThumbPosition, 0, \
74 0 /*flags*/, wxT("Helpstring"), wxT("group"))
75 wxPROPERTY( Range, int, SetRange, GetRange, 0, \
76 0 /*flags*/, wxT("Helpstring"), wxT("group"))
77 wxPROPERTY( ThumbSize, int, SetThumbSize, GetThumbSize, 0, \
78 0 /*flags*/, wxT("Helpstring"), wxT("group"))
79 wxPROPERTY( PageSize, int, SetPageSize, GetPageSize, 0, \
80 0 /*flags*/, wxT("Helpstring"), wxT("group"))
81
82 wxPROPERTY_FLAGS( WindowStyle, wxScrollBarStyle, long, SetWindowStyleFlag, \
83 GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
84 wxT("Helpstring"), wxT("group")) // style
85 wxEND_PROPERTIES_TABLE()
86
87 wxEMPTY_HANDLERS_TABLE(wxScrollBar)
88
89 wxCONSTRUCTOR_5( wxScrollBar, wxWindow*, Parent, wxWindowID, Id, \
90 wxPoint, Position, wxSize, Size, long, WindowStyle )
91
92 #endif // wxUSE_SCROLLBAR