]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/slidercmn.cpp
fixing overrelease and out-of-bounds write, fixes #13725
[wxWidgets.git] / src / common / slidercmn.cpp
index ecec1562094193a2a5b350b7c5e9167a2bdb91ba..04abd16f0b23d2a61fd5f0d0e4175315981d234f 100644 (file)
-/////////////////////////////////////////////////////////////////////////////\r
-// Name:        src/common/slidercmn.cpp\r
-// Purpose:     wxSlider common code\r
-// Author:      Julian Smart\r
-// Modified by:\r
-// Created:     04/01/98\r
-// RCS-ID:      $Id: slider95.cpp 41054 2006-09-07 19:01:45Z ABX $\r
-// Copyright:   (c) Julian Smart 1998\r
-//                  Vadim Zeitlin 2004\r
-// Licence:     wxWindows licence\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-// ============================================================================\r
-// declarations\r
-// ============================================================================\r
-\r
-// ----------------------------------------------------------------------------\r
-// headers\r
-// ----------------------------------------------------------------------------\r
-\r
-// For compilers that support precompilation, includes "wx.h".\r
-#include "wx/wxprec.h"\r
-\r
-#ifdef __BORLANDC__\r
-    #pragma hdrstop\r
-#endif\r
-\r
-#if wxUSE_SLIDER\r
-\r
-#include "wx/slider.h"\r
-\r
-// ----------------------------------------------------------------------------\r
-// XTI\r
-// ----------------------------------------------------------------------------\r
-\r
-wxDEFINE_FLAGS( wxSliderStyle )\r
-wxBEGIN_FLAGS( wxSliderStyle )\r
-    // new style border flags, we put them first to\r
-    // use them for streaming out\r
-    wxFLAGS_MEMBER(wxBORDER_SIMPLE)\r
-    wxFLAGS_MEMBER(wxBORDER_SUNKEN)\r
-    wxFLAGS_MEMBER(wxBORDER_DOUBLE)\r
-    wxFLAGS_MEMBER(wxBORDER_RAISED)\r
-    wxFLAGS_MEMBER(wxBORDER_STATIC)\r
-    wxFLAGS_MEMBER(wxBORDER_NONE)\r
-\r
-    // old style border flags\r
-    wxFLAGS_MEMBER(wxSIMPLE_BORDER)\r
-    wxFLAGS_MEMBER(wxSUNKEN_BORDER)\r
-    wxFLAGS_MEMBER(wxDOUBLE_BORDER)\r
-    wxFLAGS_MEMBER(wxRAISED_BORDER)\r
-    wxFLAGS_MEMBER(wxSTATIC_BORDER)\r
-    wxFLAGS_MEMBER(wxBORDER)\r
-\r
-    // standard window styles\r
-    wxFLAGS_MEMBER(wxTAB_TRAVERSAL)\r
-    wxFLAGS_MEMBER(wxCLIP_CHILDREN)\r
-    wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)\r
-    wxFLAGS_MEMBER(wxWANTS_CHARS)\r
-    wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)\r
-    wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )\r
-    wxFLAGS_MEMBER(wxVSCROLL)\r
-    wxFLAGS_MEMBER(wxHSCROLL)\r
-\r
-    wxFLAGS_MEMBER(wxSL_HORIZONTAL)\r
-    wxFLAGS_MEMBER(wxSL_VERTICAL)\r
-    wxFLAGS_MEMBER(wxSL_AUTOTICKS)\r
-    wxFLAGS_MEMBER(wxSL_LABELS)\r
-    wxFLAGS_MEMBER(wxSL_LEFT)\r
-    wxFLAGS_MEMBER(wxSL_TOP)\r
-    wxFLAGS_MEMBER(wxSL_RIGHT)\r
-    wxFLAGS_MEMBER(wxSL_BOTTOM)\r
-    wxFLAGS_MEMBER(wxSL_BOTH)\r
-    wxFLAGS_MEMBER(wxSL_SELRANGE)\r
-    wxFLAGS_MEMBER(wxSL_INVERSE)\r
-wxEND_FLAGS( wxSliderStyle )\r
-\r
-wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl, "wx/slider.h")\r
-\r
-wxBEGIN_PROPERTIES_TABLE(wxSlider)\r
-    wxEVENT_RANGE_PROPERTY( Scroll, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxScrollEvent )\r
-    wxEVENT_PROPERTY( Updated, wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEvent )\r
-\r
-    wxPROPERTY( Value, int, SetValue, GetValue, 0, 0 /*flags*/, \\r
-                wxT("Helpstring"), wxT("group"))\r
-    wxPROPERTY( Minimum, int, SetMin, GetMin, 0, 0 /*flags*/, \\r
-                wxT("Helpstring"), wxT("group"))\r
-    wxPROPERTY( Maximum, int, SetMax, GetMax, 0, 0 /*flags*/, \\r
-                wxT("Helpstring"), wxT("group"))\r
-    wxPROPERTY( PageSize, int, SetPageSize, GetLineSize, 1, 0 /*flags*/, \\r
-                wxT("Helpstring"), wxT("group"))\r
-    wxPROPERTY( LineSize, int, SetLineSize, GetLineSize, 1, 0 /*flags*/, \\r
-                wxT("Helpstring"), wxT("group"))\r
-    wxPROPERTY( ThumbLength, int, SetThumbLength, GetThumbLength, 1, 0 /*flags*/, \\r
-                wxT("Helpstring"), wxT("group"))\r
-\r
-    wxPROPERTY_FLAGS( WindowStyle, wxSliderStyle, long, SetWindowStyleFlag, \\r
-                      GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \\r
-                      wxT("Helpstring"), wxT("group")) // style\r
-wxEND_PROPERTIES_TABLE()\r
-\r
-wxEMPTY_HANDLERS_TABLE(wxSlider)\r
-\r
-wxCONSTRUCTOR_8( wxSlider, wxWindow*, Parent, wxWindowID, Id, int, Value, \\r
-                 int, Minimum, int, Maximum, wxPoint, Position, wxSize, Size, \\r
-                 long, WindowStyle )\r
-\r
-#endif // wxUSE_SLIDER\r
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/common/slidercmn.cpp
+// Purpose:     wxSlider common code
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart 1998
+//                  Vadim Zeitlin 2004
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#if wxUSE_SLIDER
+
+#include "wx/slider.h"
+
+extern WXDLLEXPORT_DATA(const char) wxSliderNameStr[] = "slider";
+
+// ----------------------------------------------------------------------------
+// XTI
+// ----------------------------------------------------------------------------
+
+wxDEFINE_FLAGS( wxSliderStyle )
+wxBEGIN_FLAGS( wxSliderStyle )
+    // new style border flags, we put them first to
+    // use them for streaming out
+    wxFLAGS_MEMBER(wxBORDER_SIMPLE)
+    wxFLAGS_MEMBER(wxBORDER_SUNKEN)
+    wxFLAGS_MEMBER(wxBORDER_DOUBLE)
+    wxFLAGS_MEMBER(wxBORDER_RAISED)
+    wxFLAGS_MEMBER(wxBORDER_STATIC)
+    wxFLAGS_MEMBER(wxBORDER_NONE)
+
+    // old style border flags
+    wxFLAGS_MEMBER(wxSIMPLE_BORDER)
+    wxFLAGS_MEMBER(wxSUNKEN_BORDER)
+    wxFLAGS_MEMBER(wxDOUBLE_BORDER)
+    wxFLAGS_MEMBER(wxRAISED_BORDER)
+    wxFLAGS_MEMBER(wxSTATIC_BORDER)
+    wxFLAGS_MEMBER(wxBORDER)
+
+    // standard window styles
+    wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
+    wxFLAGS_MEMBER(wxCLIP_CHILDREN)
+    wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
+    wxFLAGS_MEMBER(wxWANTS_CHARS)
+    wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
+    wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
+    wxFLAGS_MEMBER(wxVSCROLL)
+    wxFLAGS_MEMBER(wxHSCROLL)
+
+    wxFLAGS_MEMBER(wxSL_HORIZONTAL)
+    wxFLAGS_MEMBER(wxSL_VERTICAL)
+    wxFLAGS_MEMBER(wxSL_AUTOTICKS)
+    wxFLAGS_MEMBER(wxSL_LABELS)
+    wxFLAGS_MEMBER(wxSL_LEFT)
+    wxFLAGS_MEMBER(wxSL_TOP)
+    wxFLAGS_MEMBER(wxSL_RIGHT)
+    wxFLAGS_MEMBER(wxSL_BOTTOM)
+    wxFLAGS_MEMBER(wxSL_BOTH)
+    wxFLAGS_MEMBER(wxSL_SELRANGE)
+    wxFLAGS_MEMBER(wxSL_INVERSE)
+wxEND_FLAGS( wxSliderStyle )
+
+wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl, "wx/slider.h")
+
+wxBEGIN_PROPERTIES_TABLE(wxSlider)
+    wxEVENT_RANGE_PROPERTY( Scroll, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxScrollEvent )
+    wxEVENT_PROPERTY( Updated, wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEvent )
+
+    wxPROPERTY( Value, int, SetValue, GetValue, 0, 0 /*flags*/, \
+                wxT("Helpstring"), wxT("group"))
+    wxPROPERTY( Minimum, int, SetMin, GetMin, 0, 0 /*flags*/, \
+                wxT("Helpstring"), wxT("group"))
+    wxPROPERTY( Maximum, int, SetMax, GetMax, 0, 0 /*flags*/, \
+                wxT("Helpstring"), wxT("group"))
+    wxPROPERTY( PageSize, int, SetPageSize, GetLineSize, 1, 0 /*flags*/, \
+                wxT("Helpstring"), wxT("group"))
+    wxPROPERTY( LineSize, int, SetLineSize, GetLineSize, 1, 0 /*flags*/, \
+                wxT("Helpstring"), wxT("group"))
+    wxPROPERTY( ThumbLength, int, SetThumbLength, GetThumbLength, 1, 0 /*flags*/, \
+                wxT("Helpstring"), wxT("group"))
+
+    wxPROPERTY_FLAGS( WindowStyle, wxSliderStyle, long, SetWindowStyleFlag, \
+                      GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
+                      wxT("Helpstring"), wxT("group")) // style
+wxEND_PROPERTIES_TABLE()
+
+wxEMPTY_HANDLERS_TABLE(wxSlider)
+
+wxCONSTRUCTOR_8( wxSlider, wxWindow*, Parent, wxWindowID, Id, int, Value, \
+                 int, Minimum, int, Maximum, wxPoint, Position, wxSize, Size, \
+                 long, WindowStyle )
+
+#endif // wxUSE_SLIDER