]> git.saurik.com Git - wxWidgets.git/commitdiff
1. more warnings fixes in gtk/region.cpp and common/tbarsmpl.cpp
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 6 Jan 2000 16:47:48 +0000 (16:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 6 Jan 2000 16:47:48 +0000 (16:47 +0000)
2. wxWindow::Create() always takes a wxValidator parameter, even if
   !wxUSE_VALIDATORS - it is just ignored then, tons of #if wxUSE_VALIDATORS
   removed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

21 files changed:
include/wx/control.h
include/wx/generic/listctrl.h
include/wx/generic/treectrl.h
include/wx/gtk/control.h
include/wx/gtk1/control.h
include/wx/motif/control.h
include/wx/msw/control.h
include/wx/validate.h
include/wx/window.h
include/wx/wx.h
src/common/ctrlcmn.cpp
src/common/wincmn.cpp
src/generic/listctrl.cpp
src/generic/tbarsmpl.cpp
src/generic/treectrl.cpp
src/gtk/control.cpp
src/gtk/region.cpp
src/gtk1/control.cpp
src/gtk1/region.cpp
src/motif/control.cpp
src/msw/control.cpp

index 6f5999c7bc7068b08c0738427e94127f460c27f3..79adf0144f07812f385467aa797982fb953952dd 100644 (file)
@@ -41,23 +41,9 @@ protected:
                        const wxPoint& pos,
                        const wxSize& size,
                        long style,
-#if wxUSE_VALIDATORS
                        const wxValidator& validator,
-#endif
                        const wxString& name);
 
-    // an overloaded version for the controls without validators
-    bool CreateControl(wxWindowBase *parent,
-                       wxWindowID id,
-                       const wxPoint& pos,
-                       const wxSize& size,
-                       long style,
-                       const wxString& name)
-    {
-        return CreateControl(parent, id, pos, size, style,
-                             wxDefaultValidator, name);
-    }
-
     // inherit colour and font settings from the parent window
     void InheritAttributes();
 };
index 91f74cd9c9bd36801b10f4eff2e649df17cf24d4..e6e931b290e33169c2dff1511b71500897b99a49 100644 (file)
@@ -251,9 +251,7 @@ public:
                     const wxString &value = "",
                     const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
                     int style = 0,
-#if wxUSE_VALIDATORS
                     const wxValidator& validator = wxDefaultValidator,
-#endif
                     const wxString &name = "wxListTextCtrlText" );
     void OnChar( wxKeyEvent &event );
     void OnKillFocus( wxFocusEvent &event );
@@ -379,23 +377,25 @@ class WXDLLEXPORT wxListCtrl: public wxControl
 {
 public:
     wxListCtrl();
-    wxListCtrl( wxWindow *parent, wxWindowID id = -1,
-      const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
-#if wxUSE_VALIDATORS
-      long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
-#endif
-       const wxString &name = "listctrl" )
+    wxListCtrl( wxWindow *parent,
+                wxWindowID id = -1,
+                const wxPoint &pos = wxDefaultPosition,
+                const wxSize &size = wxDefaultSize,
+                long style = wxLC_ICON,
+                const wxValidator& validator = wxDefaultValidator,
+                const wxString &name = "listctrl" )
     {
         Create(parent, id, pos, size, style, validator, name);
     }
     ~wxListCtrl();
     
-    bool Create( wxWindow *parent, wxWindowID id = -1,
-      const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
-#if wxUSE_VALIDATORS
-      long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
-#endif
-      const wxString &name = "listctrl" );
+    bool Create( wxWindow *parent,
+                 wxWindowID id = -1,
+                 const wxPoint &pos = wxDefaultPosition,
+                 const wxSize &size = wxDefaultSize,
+                 long style = wxLC_ICON,
+                 const wxValidator& validator = wxDefaultValidator,
+                 const wxString &name = "listctrl" );
 
     bool GetColumn( int col, wxListItem& item ) const;
     bool SetColumn( int col, wxListItem& item );
index 0b0f137571c5814610c301a1b84860106282f041..8b9b85dff821e561a769a985b2008e490727741b 100644 (file)
@@ -131,9 +131,7 @@ class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl
                     const wxString &value = wxEmptyString,
                     const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
                     int style = 0,
-#if wxUSE_VALIDATORS
                     const wxValidator& validator = wxDefaultValidator,
-#endif
                     const wxString &name = wxTextCtrlNameStr );
     void OnChar( wxKeyEvent &event );
     void OnKillFocus( wxFocusEvent &event );
@@ -156,9 +154,7 @@ public:
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
-#if wxUSE_VALIDATORS
                const wxValidator &validator = wxDefaultValidator,
-#endif
                const wxString& name = wxTreeCtrlNameStr)
     {
         Create(parent, id, pos, size, style, validator, name);
@@ -170,9 +166,7 @@ public:
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
-#if wxUSE_VALIDATORS
                 const wxValidator &validator = wxDefaultValidator,
-#endif
                 const wxString& name = wxTreeCtrlNameStr);
 
     // accessors
index 2a5227180e02ba15c2ddffc6f47d466e029a80bd..085e5e8cfc3624e60741fa04aabc344dd00d1d00 100644 (file)
@@ -38,24 +38,16 @@ public:
     wxControl(wxWindow *parent, wxWindowID id,
              const wxPoint& pos = wxDefaultPosition,
              const wxSize& size = wxDefaultSize, long style = 0,
-#if wxUSE_VALIDATORS
              const wxValidator& validator = wxDefaultValidator,
-#endif
              const wxString& name = wxControlNameStr)
     {
-        Create(parent, id, pos, size, style,
-#if wxUSE_VALIDATORS
-            validator, 
-#endif
-            name);
+        Create(parent, id, pos, size, style, validator, name);
     }
 
     bool Create(wxWindow *parent, wxWindowID id,
             const wxPoint& pos = wxDefaultPosition,
             const wxSize& size = wxDefaultSize, long style = 0,
-#if wxUSE_VALIDATORS
             const wxValidator& validator = wxDefaultValidator,
-#endif
             const wxString& name = wxControlNameStr);
 
     // this function will filter out '&' characters and will put the accelerator
index 2a5227180e02ba15c2ddffc6f47d466e029a80bd..085e5e8cfc3624e60741fa04aabc344dd00d1d00 100644 (file)
@@ -38,24 +38,16 @@ public:
     wxControl(wxWindow *parent, wxWindowID id,
              const wxPoint& pos = wxDefaultPosition,
              const wxSize& size = wxDefaultSize, long style = 0,
-#if wxUSE_VALIDATORS
              const wxValidator& validator = wxDefaultValidator,
-#endif
              const wxString& name = wxControlNameStr)
     {
-        Create(parent, id, pos, size, style,
-#if wxUSE_VALIDATORS
-            validator, 
-#endif
-            name);
+        Create(parent, id, pos, size, style, validator, name);
     }
 
     bool Create(wxWindow *parent, wxWindowID id,
             const wxPoint& pos = wxDefaultPosition,
             const wxSize& size = wxDefaultSize, long style = 0,
-#if wxUSE_VALIDATORS
             const wxValidator& validator = wxDefaultValidator,
-#endif
             const wxString& name = wxControlNameStr);
 
     // this function will filter out '&' characters and will put the accelerator
index 9662c06ad157b89c5038bccb2d085b7948631788..a1928d0a09c9b40a52a00f8d1386a4d8182ac1eb 100644 (file)
@@ -29,14 +29,6 @@ class WXDLLEXPORT wxControl: public wxWindow
 
 public:
     wxControl();
-    wxControl( wxWindow *parent,
-               wxWindowID id,
-               const wxPoint &pos = wxDefaultPosition,
-               const wxSize &size = wxDefaultSize,
-               long style = 0,
-               const wxString &name = wxControlNameStr );
-
-#if wxUSE_VALIDATORS
     wxControl( wxWindow *parent,
                wxWindowID id,
                const wxPoint &pos = wxDefaultPosition,
@@ -44,7 +36,7 @@ public:
                long style = 0,
                const wxValidator& validator = wxDefaultValidator,
                const wxString &name = wxControlNameStr );
-#endif
+
     ~wxControl();
 
     // simulates the event, returns TRUE if the event was processed
index 0819a8a478c55ef76b7e5d88f7237dae3539c1c2..f1ce9942e13a2603dc22adde37862bb7f0576fef 100644 (file)
@@ -30,9 +30,7 @@ public:
    wxControl(wxWindow *parent, wxWindowID id,
              const wxPoint& pos = wxDefaultPosition,
              const wxSize& size = wxDefaultSize, long style = 0,
-#if wxUSE_VALIDATORS
              const wxValidator& validator = wxDefaultValidator,
-#endif
              const wxString& name = wxControlNameStr)
     {
         Create(parent, id, pos, size, style, validator, name);
@@ -41,9 +39,7 @@ public:
     bool Create(wxWindow *parent, wxWindowID id,
             const wxPoint& pos = wxDefaultPosition,
             const wxSize& size = wxDefaultSize, long style = 0,
-#if wxUSE_VALIDATORS
             const wxValidator& validator = wxDefaultValidator,
-#endif
             const wxString& name = wxControlNameStr);
 
     virtual ~wxControl();
index 25a4c5894aa06ea27dc58c1a70b5cff13ee2f13b..0cd221045c1c34d95bde088be584979eabc8747e 100644 (file)
     #pragma interface "validate.h"
 #endif
 
-#include "wx/event.h"
-
 #if defined(wxUSE_VALIDATORS) && !wxUSE_VALIDATORS
-    // wxWindows is compiled without support for wxValidator
+    // wxWindows is compiled without support for wxValidator, but we still
+    // want to be able to pass wxDefaultValidator to the functions which take
+    // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS"
+    // everywhere
     class WXDLLEXPORT wxValidator;
     #define wxDefaultValidator (*((wxValidator *)NULL))
 #else // wxUSE_VALIDATORS
 
+#include "wx/event.h"
+
 class WXDLLEXPORT wxWindow;
 class WXDLLEXPORT wxWindowBase;
 
index 6c9022850f6f0d81e315d0b9ae156e24b4a1ddb1..b554906d5d6a75163105b37cc339c17bd439a3b0 100644 (file)
@@ -30,9 +30,7 @@
 #include "wx/region.h"
 #include "wx/utils.h"
 
-#if wxUSE_VALIDATORS
-    #include "wx/validate.h"    // defines wxDefaultValidator
-#endif // wxUSE_VALIDATORS
+#include "wx/validate.h"        // for wxDefaultValidator (always include it)
 
 #if wxUSE_ACCEL
     #include "wx/accel.h"
@@ -121,10 +119,7 @@ public:
                     const wxPoint& pos = wxDefaultPosition,
                     const wxSize& size = wxDefaultSize,
                     long style = 0,
-
-#if wxUSE_VALIDATORS
                     const wxValidator& validator = wxDefaultValidator,
-#endif // wxUSE_VALIDATORS
                     const wxString& name = wxPanelNameStr);
 
     virtual ~wxWindowBase();
index ce3c1c2605edaaaf6f751ccaa6f2d69e309499b9..2d40e924ecf213b0813cc5b031f2bcaa9bb6303f 100644 (file)
@@ -75,6 +75,8 @@
 #include "wx/dirdlg.h"
 #include "wx/toolbar.h"
 
+#include "wx/validate.h"        // always include, even if !wxUSE_VALIDATORS
+
 #if wxUSE_VALIDATORS
     #include "wx/valtext.h"
 #endif // wxUSE_VALIDATORS
index dec9f63a0c724a07c892e4263090456c8e0a38c7..8e99dd0b174b334cabb12f0826cdfae27f3c34f0 100644 (file)
@@ -42,9 +42,7 @@ bool wxControlBase::CreateControl(wxWindowBase *parent,
                                   const wxPoint& pos,
                                   const wxSize& size,
                                   long style,
-#if wxUSE_VALIDATORS
                                   const wxValidator& validator,
-#endif
                                   const wxString& name)
 {
     // even if it's possible to create controls without parents in some port,
index 39fae1d5259e210d620e0ad014be55e61f01c71d..60ed7b702552b9c003652541957cae85f8d70f90 100644 (file)
@@ -158,9 +158,7 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
                               const wxPoint& WXUNUSED(pos),
                               const wxSize& WXUNUSED(size),
                               long style,
-#if wxUSE_VALIDATORS
                               const wxValidator& validator,
-#endif
                               const wxString& name)
 {
     // m_isWindow is set to TRUE in wxWindowBase::Init() as well as many other
@@ -174,7 +172,10 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
     SetName(name);
     SetWindowStyleFlag(style);
     SetParent(parent);
+
+#if wxUSE_VALIDATORS
     SetValidator(validator);
+#endif // wxUSE_VALIDATORS
 
     return TRUE;
 }
index 6e5f13c902fbfffeeaf085754e288ac44c94b837..22f0a54fcddde3691bf7616393d418203c4ccf70 100644 (file)
@@ -1027,13 +1027,18 @@ BEGIN_EVENT_TABLE(wxListTextCtrl,wxTextCtrl)
     EVT_KILL_FOCUS     (wxListTextCtrl::OnKillFocus)
 END_EVENT_TABLE()
 
-wxListTextCtrl::wxListTextCtrl( wxWindow *parent, const wxWindowID id,
-    bool *accept, wxString *res, wxListMainWindow *owner,
-    const wxString &value, const wxPoint &pos, const wxSize &size,
-#if wxUSE_VALIDATORS
-    int style, const wxValidator& validator, const wxString &name ) :
-#endif
-  wxTextCtrl( parent, id, value, pos, size, style, validator, name )
+wxListTextCtrl::wxListTextCtrl( wxWindow *parent,
+                                const wxWindowID id,
+                                bool *accept,
+                                wxString *res,
+                                wxListMainWindow *owner,
+                                const wxString &value,
+                                const wxPoint &pos,
+                                const wxSize &size,
+                                int style,
+                                const wxValidator& validator,
+                                const wxString &name )
+              : wxTextCtrl( parent, id, value, pos, size, style, validator, name )
 {
     m_res = res;
     m_accept = accept;
@@ -2679,9 +2684,7 @@ bool wxListCtrl::Create(wxWindow *parent,
                         const wxPoint &pos,
                         const wxSize &size,
                         long style,
-#if wxUSE_VALIDATORS
                         const wxValidator &validator,
-#endif
                         const wxString &name)
 {
     m_imageListNormal = (wxImageList *) NULL;
@@ -2695,19 +2698,7 @@ bool wxListCtrl::Create(wxWindow *parent,
         style = style | wxLC_LIST;
     }
 
-    bool ret = wxControl::Create( parent,
-                                  id,
-                                  pos,
-                                  size,
-                                  style,
-#if wxUSE_VALIDATORS
-                                  validator,
-#endif
-                                  name );
-
-#if wxUSE_VALIDATORS
-    SetValidator( validator );
-#endif
+    bool ret = wxControl::Create( parent, id, pos, size, style, validator, name );
 
     if (style & wxSUNKEN_BORDER)
         style -= wxSUNKEN_BORDER;
index d439947bb5338763116973dc120ef756292fb344..88f45ba452d6178bd917134e7c7c3b0a6a18096a 100644 (file)
@@ -303,8 +303,8 @@ bool wxToolBarSimple::Realize()
                     m_lastX = m_xMargin;
                     m_lastY += maxToolHeight + m_toolPacking;
                 }
-                tool->m_x = (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
-                tool->m_y = (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
+                tool->m_x = (wxCoord)(m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
+                tool->m_y = (wxCoord)(m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
 
                 m_lastX += maxToolWidth + m_toolPacking;
             }
@@ -316,8 +316,8 @@ bool wxToolBarSimple::Realize()
                     m_lastX += (maxToolWidth + m_toolPacking);
                     m_lastY = m_yMargin;
                 }
-                tool->m_x = (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
-                tool->m_y = (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
+                tool->m_x = (wxCoord)(m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
+                tool->m_y = (wxCoord)(m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
 
                 m_lastY += maxToolHeight + m_toolPacking;
             }
index 30e26b9930464a7fec0659c81aa09ae3f73fc4ac..af2d4cf2e3e93b664d218e594e725c02824a4d4e 100644 (file)
@@ -208,13 +208,18 @@ BEGIN_EVENT_TABLE(wxTreeTextCtrl,wxTextCtrl)
     EVT_KILL_FOCUS     (wxTreeTextCtrl::OnKillFocus)
 END_EVENT_TABLE()
 
-wxTreeTextCtrl::wxTreeTextCtrl( wxWindow *parent, const wxWindowID id,
-    bool *accept, wxString *res, wxTreeCtrl *owner,
-    const wxString &value, const wxPoint &pos, const wxSize &size,
-#if wxUSE_VALIDATORS
-    int style, const wxValidator& validator, const wxString &name ) :
-#endif
-  wxTextCtrl( parent, id, value, pos, size, style, validator, name )
+wxTreeTextCtrl::wxTreeTextCtrl( wxWindow *parent,
+                                const wxWindowID id,
+                                bool *accept,
+                                wxString *res,
+                                wxTreeCtrl *owner,
+                                const wxString &value,
+                                const wxPoint &pos,
+                                const wxSize &size,
+                                int style,
+                                const wxValidator& validator,
+                                const wxString &name )
+              : wxTextCtrl( parent, id, value, pos, size, style, validator, name )
 {
     m_res = res;
     m_accept = accept;
@@ -547,10 +552,8 @@ void wxTreeCtrl::Init()
 bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
                         const wxPoint& pos, const wxSize& size,
                         long style,
-#if wxUSE_VALIDATORS
-            const wxValidator &validator,
-#endif
-            const wxString& name )
+                        const wxValidator &validator,
+                        const wxString& name )
 {
     Init();
 
index dee6ebb6912c6a7327255cd53eeb92142582e1bc..a167406a882b05d64d5dc1a5740e49b3b51b727e 100644 (file)
@@ -31,9 +31,7 @@ bool wxControl::Create( wxWindow *parent,
                       const wxPoint &pos,
                       const wxSize &size,
                       long style,
-#if wxUSE_VALIDATORS
                       const wxValidator& validator,
-#endif
                       const wxString &name )
 {
     bool ret = wxWindow::Create(parent, id, pos, size, style, name);
index 1b6cdf892e36bbe42923bdb49cdc5232a2de50a7..edb6b766d9f64ee74c5601155d7191ae9ee8eef9 100644 (file)
@@ -349,22 +349,22 @@ void wxRegionIterator::Reset( const wxRegion& region )
 
 wxRegionIterator::operator bool () const
 {
-    return m_current < m_region.GetRectList()->Number();
+    return m_current < (size_t)m_region.GetRectList()->Number();
 }
 
 bool wxRegionIterator::HaveRects() const
 {
-    return m_current < m_region.GetRectList()->Number();
+    return m_current < (size_t)m_region.GetRectList()->Number();
 }
 
 void wxRegionIterator::operator ++ ()
 {
-    if (m_current < m_region.GetRectList()->Number()) ++m_current;
+    if (m_current < (size_t)m_region.GetRectList()->Number()) ++m_current;
 }
 
 void wxRegionIterator::operator ++ (int)
 {
-    if (m_current < m_region.GetRectList()->Number()) ++m_current;
+    if (m_current < (size_t)m_region.GetRectList()->Number()) ++m_current;
 }
 
 wxCoord wxRegionIterator::GetX() const
index dee6ebb6912c6a7327255cd53eeb92142582e1bc..a167406a882b05d64d5dc1a5740e49b3b51b727e 100644 (file)
@@ -31,9 +31,7 @@ bool wxControl::Create( wxWindow *parent,
                       const wxPoint &pos,
                       const wxSize &size,
                       long style,
-#if wxUSE_VALIDATORS
                       const wxValidator& validator,
-#endif
                       const wxString &name )
 {
     bool ret = wxWindow::Create(parent, id, pos, size, style, name);
index 1b6cdf892e36bbe42923bdb49cdc5232a2de50a7..edb6b766d9f64ee74c5601155d7191ae9ee8eef9 100644 (file)
@@ -349,22 +349,22 @@ void wxRegionIterator::Reset( const wxRegion& region )
 
 wxRegionIterator::operator bool () const
 {
-    return m_current < m_region.GetRectList()->Number();
+    return m_current < (size_t)m_region.GetRectList()->Number();
 }
 
 bool wxRegionIterator::HaveRects() const
 {
-    return m_current < m_region.GetRectList()->Number();
+    return m_current < (size_t)m_region.GetRectList()->Number();
 }
 
 void wxRegionIterator::operator ++ ()
 {
-    if (m_current < m_region.GetRectList()->Number()) ++m_current;
+    if (m_current < (size_t)m_region.GetRectList()->Number()) ++m_current;
 }
 
 void wxRegionIterator::operator ++ (int)
 {
-    if (m_current < m_region.GetRectList()->Number()) ++m_current;
+    if (m_current < (size_t)m_region.GetRectList()->Number()) ++m_current;
 }
 
 wxCoord wxRegionIterator::GetX() const
index 94f43a746bb0e7f74f4752b2594de2636a54f243..4eb2e47f0a93be3476abfc5505d4237140d00847 100644 (file)
@@ -43,17 +43,6 @@ wxControl::wxControl()
     m_inSetValue = FALSE;
 }
 
-wxControl::wxControl( wxWindow *parent,
-                      wxWindowID id,
-                      const wxPoint &pos,
-                      const wxSize &size,
-                      long style,
-                      const wxString &name )
-{
-    (void)Create(parent, id, pos, size, style, name);
-}
-
-#if wxUSE_VALIDATORS
 wxControl::wxControl( wxWindow *parent,
                       wxWindowID id,
                       const wxPoint &pos,
@@ -63,9 +52,11 @@ wxControl::wxControl( wxWindow *parent,
                       const wxString &name)
 {
     (void)Create(parent, id, pos, size, style, name);
+
+#if wxUSE_VALIDATORS
     SetValidator(validator);
-}
 #endif
+}
 
 wxControl::~wxControl()
 {
index 0a177e8d69fa1f194e1d8f53dd1cfea24b9a5d23..ea72d9e9f3b5726f0757d8d46c57626b9995d4f4 100644 (file)
@@ -60,9 +60,7 @@ wxControl::~wxControl()
 bool wxControl::Create(wxWindow *parent, wxWindowID id,
                        const wxPoint& pos,
                        const wxSize& size, long style,
-#if wxUSE_VALIDATORS
                        const wxValidator& validator,
-#endif
                        const wxString& name)
 {
     bool rval = wxWindow::Create(parent, id, pos, size, style, name);