Rename wxSpinCtrl helper functions
Put them in wxSpinCtrlImpl namespace and remove "wxSpinCtrl" prefix from the function names themselves, this was ugly. No real changes.
This commit is contained in:
@@ -10,18 +10,18 @@
|
||||
#ifndef _WX_PRIVATE_SPINCTRL_H_
|
||||
#define _WX_PRIVATE_SPINCTRL_H_
|
||||
|
||||
namespace wxPrivate
|
||||
namespace wxSpinCtrlImpl
|
||||
{
|
||||
|
||||
// This is an internal helper function currently used by all ports: return the
|
||||
// string containing hexadecimal representation of the given number.
|
||||
extern wxString wxSpinCtrlFormatAsHex(long val, long maxVal);
|
||||
extern wxString FormatAsHex(long val, long maxVal);
|
||||
|
||||
// The helper function to determine the best size for the given control.
|
||||
// We can't implement this function in the wxSpinCtrlBase because MSW implementation
|
||||
// of wxSpinCtrl is derived from wxSpinButton but uses the same algorithm.
|
||||
extern wxSize wxSpinCtrlGetBestSize(const wxControl* spin, int minVal, int maxVal, int base);
|
||||
extern wxSize GetBestSize(const wxControl* spin, int minVal, int maxVal, int base);
|
||||
|
||||
} // namespace wxPrivate
|
||||
} // namespace wxSpinCtrlImpl
|
||||
|
||||
#endif // _WX_PRIVATE_SPINCTRL_H_
|
||||
|
@@ -104,7 +104,9 @@ wxCONSTRUCTOR_6( wxSpinCtrl, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxSize, Size, long, WindowStyle )
|
||||
|
||||
|
||||
wxString wxPrivate::wxSpinCtrlFormatAsHex(long val, long maxVal)
|
||||
using namespace wxSpinCtrlImpl;
|
||||
|
||||
wxString wxSpinCtrlImpl::FormatAsHex(long val, long maxVal)
|
||||
{
|
||||
// We format the value like this is for compatibility with (native
|
||||
// behaviour of) wxMSW
|
||||
@@ -117,14 +119,14 @@ wxString wxPrivate::wxSpinCtrlFormatAsHex(long val, long maxVal)
|
||||
return text;
|
||||
}
|
||||
|
||||
wxSize wxPrivate::wxSpinCtrlGetBestSize(const wxControl* spin,
|
||||
wxSize wxSpinCtrlImpl::GetBestSize(const wxControl* spin,
|
||||
int minVal, int maxVal, int base)
|
||||
{
|
||||
const int lenMin = (base == 16 ?
|
||||
wxSpinCtrlFormatAsHex(minVal, maxVal) :
|
||||
FormatAsHex(minVal, maxVal) :
|
||||
wxString::Format("%d", minVal)).length();
|
||||
const int lenMax = (base == 16 ?
|
||||
wxSpinCtrlFormatAsHex(maxVal, maxVal) :
|
||||
FormatAsHex(maxVal, maxVal) :
|
||||
wxString::Format("%d", maxVal)).length();
|
||||
const wxString largestString('8', wxMax(lenMin, lenMax));
|
||||
return spin->GetSizeFromText(largestString);
|
||||
|
@@ -656,8 +656,7 @@ wxString wxSpinCtrl::DoValueToText(double val)
|
||||
switch ( GetBase() )
|
||||
{
|
||||
case 16:
|
||||
return wxPrivate::wxSpinCtrlFormatAsHex(static_cast<long>(val),
|
||||
GetMax());
|
||||
return wxSpinCtrlImpl::FormatAsHex(static_cast<long>(val), GetMax());
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxS("Unsupported spin control base") );
|
||||
|
@@ -359,7 +359,7 @@ wxSize wxSpinCtrlGTKBase::DoGetBestSize() const
|
||||
{
|
||||
const int minVal = static_cast<int>(DoGetMin());
|
||||
const int maxVal = static_cast<int>(DoGetMax());
|
||||
return wxPrivate::wxSpinCtrlGetBestSize(this, minVal, maxVal, GetBase());
|
||||
return wxSpinCtrlImpl::GetBestSize(this, minVal, maxVal, GetBase());
|
||||
}
|
||||
|
||||
wxSize wxSpinCtrlGTKBase::DoGetSizeFromTextSize(int xlen, int ylen) const
|
||||
@@ -433,7 +433,7 @@ wx_gtk_spin_output(GtkSpinButton* spin, wxSpinCtrl* win)
|
||||
gtk_entry_set_text
|
||||
(
|
||||
GTK_ENTRY(spin),
|
||||
wxPrivate::wxSpinCtrlFormatAsHex(val, win->GetMax()).utf8_str()
|
||||
wxSpinCtrlImpl::FormatAsHex(val, win->GetMax()).utf8_str()
|
||||
);
|
||||
|
||||
return TRUE;
|
||||
|
@@ -71,7 +71,7 @@ wx_gtk_spin_output(GtkSpinButton* spin, wxSpinCtrl* win)
|
||||
gtk_entry_set_text
|
||||
(
|
||||
GTK_ENTRY(spin),
|
||||
wxPrivate::wxSpinCtrlFormatAsHex(val, win->GetMax()).utf8_str()
|
||||
wxSpinCtrlImpl::FormatAsHex(val, win->GetMax()).utf8_str()
|
||||
);
|
||||
|
||||
return TRUE;
|
||||
|
@@ -476,7 +476,7 @@ void wxSpinCtrl::SetValue(int val)
|
||||
(text[1] != 'x' && text[1] != 'X')) )
|
||||
{
|
||||
::SetWindowText(GetBuddyHwnd(),
|
||||
wxPrivate::wxSpinCtrlFormatAsHex(val, m_max).t_str());
|
||||
wxSpinCtrlImpl::FormatAsHex(val, m_max).t_str());
|
||||
}
|
||||
|
||||
m_oldValue = GetValue();
|
||||
@@ -743,7 +743,7 @@ int wxSpinCtrl::GetOverlap() const
|
||||
|
||||
wxSize wxSpinCtrl::DoGetBestSize() const
|
||||
{
|
||||
return wxPrivate::wxSpinCtrlGetBestSize(this, GetMin(), GetMax(), GetBase());
|
||||
return wxSpinCtrlImpl::GetBestSize(this, GetMin(), GetMax(), GetBase());
|
||||
}
|
||||
|
||||
wxSize wxSpinCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
|
||||
|
Reference in New Issue
Block a user