adding range type
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
29
include/wx/range.h
Normal file
29
include/wx/range.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/range.h
|
||||||
|
// Purpose: Range Value Class
|
||||||
|
// Author: Stefan Csomor
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2011-01-07
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2011 Stefan Csomor
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_RANGE_H_
|
||||||
|
#define _WX_RANGE_H_
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
class wxRange
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
wxRange(): m_minVal(0), m_maxVal(0) {}
|
||||||
|
wxRange( int minVal, int maxVal) : m_minVal(minVal), m_maxVal(maxVal) {}
|
||||||
|
int GetMin() const { return m_minVal; }
|
||||||
|
int GetMax() const { return m_maxVal; }
|
||||||
|
private :
|
||||||
|
int m_minVal;
|
||||||
|
int m_maxVal;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_RANGE_H_
|
@@ -193,12 +193,6 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);
|
|||||||
#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
|
#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
|
||||||
wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL)
|
wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL)
|
||||||
|
|
||||||
#define wxIMPLEMENT_CLASS(name, basename) \
|
|
||||||
wxIMPLEMENT_ABSTRACT_CLASS(name, basename)
|
|
||||||
|
|
||||||
#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2)
|
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// XTI-compatible macros
|
// XTI-compatible macros
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
#include "wx/event.h"
|
#include "wx/event.h"
|
||||||
|
#include "wx/range.h"
|
||||||
|
|
||||||
#define wxSPIN_BUTTON_NAME wxT("wxSpinButton")
|
#define wxSPIN_BUTTON_NAME wxT("wxSpinButton")
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ public:
|
|||||||
virtual int GetValue() const = 0;
|
virtual int GetValue() const = 0;
|
||||||
virtual int GetMin() const { return m_min; }
|
virtual int GetMin() const { return m_min; }
|
||||||
virtual int GetMax() const { return m_max; }
|
virtual int GetMax() const { return m_max; }
|
||||||
|
wxRange GetRange() const { return wxRange( GetMin(), GetMax() );}
|
||||||
|
|
||||||
// operations
|
// operations
|
||||||
virtual void SetValue(int val) = 0;
|
virtual void SetValue(int val) = 0;
|
||||||
@@ -56,6 +58,7 @@ public:
|
|||||||
m_min = minVal;
|
m_min = minVal;
|
||||||
m_max = maxVal;
|
m_max = maxVal;
|
||||||
}
|
}
|
||||||
|
void SetRange( const wxRange& range) { SetRange( range.GetMin(), range.GetMax()); }
|
||||||
|
|
||||||
// is this spin button vertically oriented?
|
// is this spin button vertically oriented?
|
||||||
bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
|
bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
|
||||||
|
Reference in New Issue
Block a user