Fixes for wxUSE_SPIN... == 0.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1273,7 +1273,7 @@
|
|||||||
#endif /* wxUSE_HELP */
|
#endif /* wxUSE_HELP */
|
||||||
|
|
||||||
#if wxUSE_WXHTML_HELP
|
#if wxUSE_WXHTML_HELP
|
||||||
# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK
|
# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK || !wxUSE_SPINCTRL
|
||||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||||
# error "Built in help controller can't be compiled"
|
# error "Built in help controller can't be compiled"
|
||||||
# else
|
# else
|
||||||
@@ -1285,6 +1285,8 @@
|
|||||||
# define wxUSE_COMBOBOX 1
|
# define wxUSE_COMBOBOX 1
|
||||||
# undef wxUSE_NOTEBOOK
|
# undef wxUSE_NOTEBOOK
|
||||||
# define wxUSE_NOTEBOOK 1
|
# define wxUSE_NOTEBOOK 1
|
||||||
|
# undef wxUSE_SPINCTRL
|
||||||
|
# define wxUSE_SPINCTRL 1
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif /* wxUSE_WXHTML_HELP */
|
#endif /* wxUSE_WXHTML_HELP */
|
||||||
|
@@ -79,7 +79,9 @@ class WXDLLIMPEXP_ADV wxGridSelection;
|
|||||||
class WXDLLEXPORT wxCheckBox;
|
class WXDLLEXPORT wxCheckBox;
|
||||||
class WXDLLEXPORT wxComboBox;
|
class WXDLLEXPORT wxComboBox;
|
||||||
class WXDLLEXPORT wxTextCtrl;
|
class WXDLLEXPORT wxTextCtrl;
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
class WXDLLEXPORT wxSpinCtrl;
|
class WXDLLEXPORT wxSpinCtrl;
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// macros
|
// macros
|
||||||
@@ -460,10 +462,19 @@ public:
|
|||||||
virtual wxString GetValue() const;
|
virtual wxString GetValue() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; }
|
wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; }
|
||||||
|
#endif
|
||||||
|
|
||||||
// if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl
|
// if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl
|
||||||
bool HasRange() const { return m_min != m_max; }
|
bool HasRange() const
|
||||||
|
{
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
|
return m_min != m_max;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// string representation of m_valueOld
|
// string representation of m_valueOld
|
||||||
wxString GetString() const
|
wxString GetString() const
|
||||||
|
@@ -96,6 +96,17 @@
|
|||||||
#define wxUSE_CHECKLISTBOX 0
|
#define wxUSE_CHECKLISTBOX 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
|
# if !wxUSE_SPINBTN
|
||||||
|
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||||
|
# error "wxSpinCtrl requires wxSpinButton on MSW"
|
||||||
|
# else
|
||||||
|
# undef wxUSE_SPINBTN
|
||||||
|
# define wxUSE_SPINBTN 1
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
|
||||||
/* BC++ 4.0 can't compile JPEG library */
|
/* BC++ 4.0 can't compile JPEG library */
|
||||||
#undef wxUSE_LIBJPEG
|
#undef wxUSE_LIBJPEG
|
||||||
|
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "wx/spinbutt.h" // the base class
|
#include "wx/spinbutt.h" // the base class
|
||||||
|
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
|
|
||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxSpinCtrl;
|
class WXDLLEXPORT wxSpinCtrl;
|
||||||
@@ -116,6 +118,8 @@ private:
|
|||||||
DECLARE_NO_COPY_CLASS(wxSpinCtrl)
|
DECLARE_NO_COPY_CLASS(wxSpinCtrl)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // wxUSE_SPINCTRL
|
||||||
|
|
||||||
#endif // _WX_MSW_SPINCTRL_H_
|
#endif // _WX_MSW_SPINCTRL_H_
|
||||||
|
|
||||||
|
|
||||||
|
@@ -502,7 +502,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
|
|||||||
m_colBgOld = m_control->GetBackgroundColour();
|
m_colBgOld = m_control->GetBackgroundColour();
|
||||||
m_control->SetBackgroundColour(attr->GetBackgroundColour());
|
m_control->SetBackgroundColour(attr->GetBackgroundColour());
|
||||||
|
|
||||||
// Workaround for GTK+1 font setting problem on some platforms
|
// Workaround for GTK+1 font setting problem on some platforms
|
||||||
#if !defined(__WXGTK__) || defined(__WXGTK20__)
|
#if !defined(__WXGTK__) || defined(__WXGTK20__)
|
||||||
m_fontOld = m_control->GetFont();
|
m_fontOld = m_control->GetFont();
|
||||||
m_control->SetFont(attr->GetFont());
|
m_control->SetFont(attr->GetFont());
|
||||||
@@ -525,7 +525,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
|
|||||||
m_control->SetBackgroundColour(m_colBgOld);
|
m_control->SetBackgroundColour(m_colBgOld);
|
||||||
m_colBgOld = wxNullColour;
|
m_colBgOld = wxNullColour;
|
||||||
}
|
}
|
||||||
// Workaround for GTK+1 font setting problem on some platforms
|
// Workaround for GTK+1 font setting problem on some platforms
|
||||||
#if !defined(__WXGTK__) || defined(__WXGTK20__)
|
#if !defined(__WXGTK__) || defined(__WXGTK20__)
|
||||||
if ( m_fontOld.Ok() )
|
if ( m_fontOld.Ok() )
|
||||||
{
|
{
|
||||||
@@ -802,6 +802,7 @@ void wxGridCellNumberEditor::Create(wxWindow* parent,
|
|||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
wxEvtHandler* evtHandler)
|
wxEvtHandler* evtHandler)
|
||||||
{
|
{
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
if ( HasRange() )
|
if ( HasRange() )
|
||||||
{
|
{
|
||||||
// create a spin ctrl
|
// create a spin ctrl
|
||||||
@@ -813,6 +814,7 @@ void wxGridCellNumberEditor::Create(wxWindow* parent,
|
|||||||
wxGridCellEditor::Create(parent, id, evtHandler);
|
wxGridCellEditor::Create(parent, id, evtHandler);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// just a text control
|
// just a text control
|
||||||
wxGridCellTextEditor::Create(parent, id, evtHandler);
|
wxGridCellTextEditor::Create(parent, id, evtHandler);
|
||||||
@@ -835,19 +837,21 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid)
|
|||||||
{
|
{
|
||||||
m_valueOld = 0;
|
m_valueOld = 0;
|
||||||
wxString sValue = table->GetValue(row, col);
|
wxString sValue = table->GetValue(row, col);
|
||||||
if (! sValue.ToLong(&m_valueOld) && ! sValue.IsEmpty())
|
if (! sValue.ToLong(&m_valueOld) && ! sValue.empty())
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("this cell doesn't have numeric value") );
|
wxFAIL_MSG( _T("this cell doesn't have numeric value") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
if ( HasRange() )
|
if ( HasRange() )
|
||||||
{
|
{
|
||||||
Spin()->SetValue((int)m_valueOld);
|
Spin()->SetValue((int)m_valueOld);
|
||||||
Spin()->SetFocus();
|
Spin()->SetFocus();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
DoBeginEdit(GetString());
|
DoBeginEdit(GetString());
|
||||||
}
|
}
|
||||||
@@ -860,6 +864,7 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
|
|||||||
long value = 0;
|
long value = 0;
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
if ( HasRange() )
|
if ( HasRange() )
|
||||||
{
|
{
|
||||||
value = Spin()->GetValue();
|
value = Spin()->GetValue();
|
||||||
@@ -868,9 +873,10 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
|
|||||||
text = wxString::Format(wxT("%ld"), value);
|
text = wxString::Format(wxT("%ld"), value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
text = Text()->GetValue();
|
text = Text()->GetValue();
|
||||||
changed = (text.IsEmpty() || text.ToLong(&value)) && (value != m_valueOld);
|
changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( changed )
|
if ( changed )
|
||||||
@@ -886,11 +892,13 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
|
|||||||
|
|
||||||
void wxGridCellNumberEditor::Reset()
|
void wxGridCellNumberEditor::Reset()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_SPINCTRL
|
||||||
if ( HasRange() )
|
if ( HasRange() )
|
||||||
{
|
{
|
||||||
Spin()->SetValue((int)m_valueOld);
|
Spin()->SetValue((int)m_valueOld);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
DoReset(GetString());
|
DoReset(GetString());
|
||||||
}
|
}
|
||||||
@@ -992,18 +1000,21 @@ void wxGridCellNumberEditor::SetParameters(const wxString& params)
|
|||||||
// return the value in the spin control if it is there (the text control otherwise)
|
// return the value in the spin control if it is there (the text control otherwise)
|
||||||
wxString wxGridCellNumberEditor::GetValue() const
|
wxString wxGridCellNumberEditor::GetValue() const
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
|
|
||||||
if( HasRange() )
|
#if wxUSE_SPINCTRL
|
||||||
{
|
if( HasRange() )
|
||||||
long value = Spin()->GetValue();
|
{
|
||||||
s.Printf(wxT("%ld"), value);
|
long value = Spin()->GetValue();
|
||||||
}
|
s.Printf(wxT("%ld"), value);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
s = Text()->GetValue();
|
#endif
|
||||||
}
|
{
|
||||||
return s;
|
s = Text()->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1039,7 +1050,7 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
|
|||||||
{
|
{
|
||||||
m_valueOld = 0.0;
|
m_valueOld = 0.0;
|
||||||
wxString sValue = table->GetValue(row, col);
|
wxString sValue = table->GetValue(row, col);
|
||||||
if (! sValue.ToDouble(&m_valueOld) && ! sValue.IsEmpty())
|
if (! sValue.ToDouble(&m_valueOld) && ! sValue.empty())
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("this cell doesn't have float value") );
|
wxFAIL_MSG( _T("this cell doesn't have float value") );
|
||||||
return;
|
return;
|
||||||
@@ -1055,7 +1066,7 @@ bool wxGridCellFloatEditor::EndEdit(int row, int col,
|
|||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
wxString text(Text()->GetValue());
|
wxString text(Text()->GetValue());
|
||||||
|
|
||||||
if ( (text.IsEmpty() || text.ToDouble(&value)) && (value != m_valueOld) )
|
if ( (text.empty() || text.ToDouble(&value)) && (value != m_valueOld) )
|
||||||
{
|
{
|
||||||
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT))
|
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT))
|
||||||
grid->GetTable()->SetValueAsDouble(row, col, value);
|
grid->GetTable()->SetValueAsDouble(row, col, value);
|
||||||
@@ -1188,7 +1199,7 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
|
|||||||
tmpbuf[0] = (char) keycode;
|
tmpbuf[0] = (char) keycode;
|
||||||
tmpbuf[1] = '\0';
|
tmpbuf[1] = '\0';
|
||||||
wxString strbuf(tmpbuf, *wxConvCurrent);
|
wxString strbuf(tmpbuf, *wxConvCurrent);
|
||||||
bool is_decimal_point =
|
bool is_decimal_point =
|
||||||
( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
|
( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
|
||||||
wxLOCALE_CAT_NUMBER) );
|
wxLOCALE_CAT_NUMBER) );
|
||||||
if ( (keycode < 128) &&
|
if ( (keycode < 128) &&
|
||||||
|
Reference in New Issue
Block a user