]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixes for wxUSE_SPIN... == 0.
authorWłodzimierz Skiba <abx@abx.art.pl>
Tue, 23 Nov 2004 20:08:56 +0000 (20:08 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Tue, 23 Nov 2004 20:08:56 +0000 (20:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/chkconf.h
include/wx/generic/grid.h
include/wx/msw/chkconf.h
include/wx/msw/spinctrl.h
src/generic/grid.cpp

index 8b8a8c77b7dee9d1126360895520d540883a5fad..613c97068a6370f8ceddcf222be70d6a25a0e5f3 100644 (file)
 #endif /* wxUSE_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
 #           error "Built in help controller can't be compiled"
 #       else
 #           define wxUSE_COMBOBOX 1
 #           undef wxUSE_NOTEBOOK
 #           define wxUSE_NOTEBOOK 1
+#           undef wxUSE_SPINCTRL
+#           define wxUSE_SPINCTRL 1
 #       endif
 #   endif
 #endif /* wxUSE_WXHTML_HELP */
index d8d1805a18a9274a3b3d5db5d600b3bb4f508481..b7da277f1355389d869ab629f69be687a855d581 100644 (file)
@@ -79,7 +79,9 @@ class WXDLLIMPEXP_ADV wxGridSelection;
 class WXDLLEXPORT wxCheckBox;
 class WXDLLEXPORT wxComboBox;
 class WXDLLEXPORT wxTextCtrl;
+#if wxUSE_SPINCTRL
 class WXDLLEXPORT wxSpinCtrl;
+#endif
 
 // ----------------------------------------------------------------------------
 // macros
@@ -460,10 +462,19 @@ public:
     virtual wxString GetValue() const;
 
 protected:
+#if wxUSE_SPINCTRL
     wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; }
+#endif
 
     // 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
     wxString GetString() const
index c6765eb50bef982dd3dd6ebbc070279ebc6b7533..31ded4713bbc022b0329cee7f3dc23530d4baef7 100644 (file)
 #define wxUSE_CHECKLISTBOX 0
 #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)
 /* BC++ 4.0 can't compile JPEG library */
 #undef wxUSE_LIBJPEG
index e5687d075c6648e8fc49a48d20765500bb6061c4..350c6ea86180c096b6a8cd437879824dcc4dbdb7 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "wx/spinbutt.h"    // the base class
 
+#if wxUSE_SPINCTRL
+
 #include "wx/dynarray.h"
 
 class WXDLLEXPORT wxSpinCtrl;
@@ -116,6 +118,8 @@ private:
     DECLARE_NO_COPY_CLASS(wxSpinCtrl)
 };
 
+#endif // wxUSE_SPINCTRL
+
 #endif // _WX_MSW_SPINCTRL_H_
 
 
index 9d0e0a9f69b26d8f37dda68b35109852ddc1570e..f46e006ea075cb5880b7f88545a9ad03538c7b84 100644 (file)
@@ -502,7 +502,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
             m_colBgOld = m_control->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__)
             m_fontOld = m_control->GetFont();
             m_control->SetFont(attr->GetFont());
@@ -525,7 +525,7 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
             m_control->SetBackgroundColour(m_colBgOld);
             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 ( m_fontOld.Ok() )
         {
@@ -802,6 +802,7 @@ void wxGridCellNumberEditor::Create(wxWindow* parent,
                                     wxWindowID id,
                                     wxEvtHandler* evtHandler)
 {
+#if wxUSE_SPINCTRL
     if ( HasRange() )
     {
         // create a spin ctrl
@@ -813,6 +814,7 @@ void wxGridCellNumberEditor::Create(wxWindow* parent,
         wxGridCellEditor::Create(parent, id, evtHandler);
     }
     else
+#endif
     {
         // just a text control
         wxGridCellTextEditor::Create(parent, id, evtHandler);
@@ -835,19 +837,21 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid)
     {
         m_valueOld = 0;
         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") );
             return;
         }
     }
 
+#if wxUSE_SPINCTRL
     if ( HasRange() )
     {
         Spin()->SetValue((int)m_valueOld);
         Spin()->SetFocus();
     }
     else
+#endif
     {
         DoBeginEdit(GetString());
     }
@@ -860,6 +864,7 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
     long value = 0;
     wxString text;
 
+#if wxUSE_SPINCTRL
     if ( HasRange() )
     {
         value = Spin()->GetValue();
@@ -868,9 +873,10 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
             text = wxString::Format(wxT("%ld"), value);
     }
     else
+#endif
     {
         text = Text()->GetValue();
-        changed = (text.IsEmpty() || text.ToLong(&value)) && (value != m_valueOld);
+        changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld);
     }
 
     if ( changed )
@@ -886,11 +892,13 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
 
 void wxGridCellNumberEditor::Reset()
 {
+#if wxUSE_SPINCTRL
     if ( HasRange() )
     {
         Spin()->SetValue((int)m_valueOld);
     }
     else
+#endif
     {
         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)
 wxString wxGridCellNumberEditor::GetValue() const
 {
-  wxString s;
+    wxString s;
 
-  if( HasRange() )
-  {
-    long value = Spin()->GetValue();
-    s.Printf(wxT("%ld"), value);
-  }
-  else
-  {
-    s = Text()->GetValue();
-  }
-  return s;
+#if wxUSE_SPINCTRL
+    if( HasRange() )
+    {
+        long value = Spin()->GetValue();
+        s.Printf(wxT("%ld"), value);
+    }
+    else
+#endif
+    {
+        s = Text()->GetValue();
+    }
+
+    return s;
 }
 
 // ----------------------------------------------------------------------------
@@ -1039,7 +1050,7 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
     {
         m_valueOld = 0.0;
         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") );
             return;
@@ -1055,7 +1066,7 @@ bool wxGridCellFloatEditor::EndEdit(int row, int col,
     double value = 0.0;
     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))
             grid->GetTable()->SetValueAsDouble(row, col, value);
@@ -1188,7 +1199,7 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
                 tmpbuf[0] = (char) keycode;
                 tmpbuf[1] = '\0';
                 wxString strbuf(tmpbuf, *wxConvCurrent);
-                bool is_decimal_point = 
+                bool is_decimal_point =
                     ( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
                                                   wxLOCALE_CAT_NUMBER) );
                 if ( (keycode < 128) &&