mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 18:19:49 -06:00
Upgrade WX to r74856, mainly to support @2x.
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 28.10.99
|
||||
// RCS-ID: $Id: spinctlg.h 70432 2012-01-21 17:03:52Z VZ $
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -22,6 +21,8 @@
|
||||
|
||||
#if wxUSE_SPINBTN
|
||||
|
||||
#include "wx/compositewin.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxSpinButton;
|
||||
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
|
||||
|
||||
@ -40,7 +41,8 @@ class wxSpinCtrlTextGeneric; // wxTextCtrl used for the wxSpinCtrlGenericBase
|
||||
// function ambiguity.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase : public wxSpinCtrlBase
|
||||
class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase
|
||||
: public wxNavigationEnabled<wxCompositeWindow<wxSpinCtrlBase> >
|
||||
{
|
||||
public:
|
||||
wxSpinCtrlGenericBase() { Init(); }
|
||||
@ -85,6 +87,8 @@ public:
|
||||
virtual void DoSetToolTip(wxToolTip *tip);
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
virtual bool SetBackgroundColour(const wxColour& colour);
|
||||
|
||||
// get the subcontrols
|
||||
wxTextCtrl *GetText() const { return m_textCtrl; }
|
||||
wxSpinButton *GetSpinButton() const { return m_spinButton; }
|
||||
@ -105,6 +109,7 @@ public:
|
||||
protected:
|
||||
// override the base class virtuals involved into geometry calculations
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
@ -112,9 +117,15 @@ protected:
|
||||
virtual void DoEnable(bool enable);
|
||||
#endif // __WXMSW__
|
||||
|
||||
enum SendEvent
|
||||
{
|
||||
SendEvent_None,
|
||||
SendEvent_Text
|
||||
};
|
||||
|
||||
// generic double valued functions
|
||||
double DoGetValue() const { return m_value; }
|
||||
bool DoSetValue(double val);
|
||||
bool DoSetValue(double val, SendEvent sendEvent);
|
||||
void DoSetRange(double min_val, double max_val);
|
||||
void DoSetIncrement(double inc);
|
||||
|
||||
@ -124,11 +135,15 @@ protected:
|
||||
// can also change the text control if its value is invalid
|
||||
//
|
||||
// return true if our value has changed
|
||||
bool SyncSpinToText();
|
||||
bool SyncSpinToText(SendEvent sendEvent);
|
||||
|
||||
// Send the correct event type
|
||||
virtual void DoSendEvent() = 0;
|
||||
|
||||
// Convert the text to/from the corresponding value.
|
||||
virtual bool DoTextToValue(const wxString& text, double *val) = 0;
|
||||
virtual wxString DoValueToText(double val) = 0;
|
||||
|
||||
// check if the value is in range
|
||||
bool InRange(double n) const { return (n >= m_min) && (n <= m_max); }
|
||||
|
||||
@ -141,7 +156,6 @@ protected:
|
||||
double m_max;
|
||||
double m_increment;
|
||||
bool m_snap_to_ticks;
|
||||
wxString m_format;
|
||||
|
||||
int m_spin_value;
|
||||
|
||||
@ -153,6 +167,9 @@ private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// Implement pure virtual function inherited from wxCompositeWindow.
|
||||
virtual wxWindowList GetCompositeWindowParts() const;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
@ -190,7 +207,7 @@ public:
|
||||
|
||||
bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style,
|
||||
wxDefaultValidator, name);
|
||||
DoSetValue(initial);
|
||||
DoSetValue(initial, SendEvent_None);
|
||||
|
||||
return ok;
|
||||
}
|
||||
@ -226,9 +243,20 @@ protected:
|
||||
return n;
|
||||
}
|
||||
|
||||
bool DoSetValue(double val)
|
||||
bool DoSetValue(double val, SendEvent sendEvent)
|
||||
{
|
||||
wxTextCtrl::SetValue(wxString::Format(m_format.c_str(), val));
|
||||
wxString str(wxString::Format(m_format, val));
|
||||
switch ( sendEvent )
|
||||
{
|
||||
case SendEvent_None:
|
||||
wxTextCtrl::ChangeValue(str);
|
||||
break;
|
||||
|
||||
case SendEvent_Text:
|
||||
wxTextCtrl::SetValue(str);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
void DoSetRange(double min_val, double max_val)
|
||||
@ -257,7 +285,7 @@ protected:
|
||||
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGenericBase
|
||||
{
|
||||
public:
|
||||
wxSpinCtrl() {}
|
||||
wxSpinCtrl() { Init(); }
|
||||
wxSpinCtrl(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& value = wxEmptyString,
|
||||
@ -267,6 +295,8 @@ public:
|
||||
int min = 0, int max = 100, int initial = 0,
|
||||
const wxString& name = wxT("wxSpinCtrl"))
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, value, pos, size, style, min, max, initial, name);
|
||||
}
|
||||
|
||||
@ -292,13 +322,28 @@ public:
|
||||
// operations
|
||||
void SetValue(const wxString& value)
|
||||
{ wxSpinCtrlGenericBase::SetValue(value); }
|
||||
void SetValue( int value ) { DoSetValue(value); }
|
||||
void SetValue( int value ) { DoSetValue(value, SendEvent_None); }
|
||||
void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); }
|
||||
void SetIncrement(int inc) { DoSetIncrement(inc); }
|
||||
|
||||
virtual int GetBase() const { return m_base; }
|
||||
virtual bool SetBase(int base);
|
||||
|
||||
protected:
|
||||
virtual void DoSendEvent();
|
||||
|
||||
virtual bool DoTextToValue(const wxString& text, double *val);
|
||||
virtual wxString DoValueToText(double val);
|
||||
|
||||
private:
|
||||
// Common part of all ctors.
|
||||
void Init()
|
||||
{
|
||||
m_base = 10;
|
||||
}
|
||||
|
||||
int m_base;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
||||
};
|
||||
|
||||
@ -311,7 +356,7 @@ protected:
|
||||
class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlGenericBase
|
||||
{
|
||||
public:
|
||||
wxSpinCtrlDouble() : m_digits(0) { }
|
||||
wxSpinCtrlDouble() { Init(); }
|
||||
wxSpinCtrlDouble(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& value = wxEmptyString,
|
||||
@ -322,7 +367,8 @@ public:
|
||||
double inc = 1,
|
||||
const wxString& name = wxT("wxSpinCtrlDouble"))
|
||||
{
|
||||
m_digits = 0;
|
||||
Init();
|
||||
|
||||
Create(parent, id, value, pos, size, style,
|
||||
min, max, initial, inc, name);
|
||||
}
|
||||
@ -352,16 +398,34 @@ public:
|
||||
// operations
|
||||
void SetValue(const wxString& value)
|
||||
{ wxSpinCtrlGenericBase::SetValue(value); }
|
||||
void SetValue(double value) { DoSetValue(value); }
|
||||
void SetValue(double value) { DoSetValue(value, SendEvent_None); }
|
||||
void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); }
|
||||
void SetIncrement(double inc) { DoSetIncrement(inc); }
|
||||
void SetDigits(unsigned digits);
|
||||
|
||||
// We don't implement bases support for floating point numbers, this is not
|
||||
// very useful in practice.
|
||||
virtual int GetBase() const { return 10; }
|
||||
virtual bool SetBase(int WXUNUSED(base)) { return 0; }
|
||||
|
||||
protected:
|
||||
virtual void DoSendEvent();
|
||||
|
||||
virtual bool DoTextToValue(const wxString& text, double *val);
|
||||
virtual wxString DoValueToText(double val);
|
||||
|
||||
unsigned m_digits;
|
||||
|
||||
private:
|
||||
// Common part of all ctors.
|
||||
void Init()
|
||||
{
|
||||
m_digits = 0;
|
||||
m_format = wxS("%g");
|
||||
}
|
||||
|
||||
wxString m_format;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble)
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user