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();
};
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 );
{
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 );
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 );
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);
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
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
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
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,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxControlNameStr );
-#endif
+
~wxControl();
// simulates the event, returns TRUE if the event was processed
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);
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();
#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;
#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"
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();
#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
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,
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
SetName(name);
SetWindowStyleFlag(style);
SetParent(parent);
+
+#if wxUSE_VALIDATORS
SetValidator(validator);
+#endif // wxUSE_VALIDATORS
return TRUE;
}
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;
const wxPoint &pos,
const wxSize &size,
long style,
-#if wxUSE_VALIDATORS
const wxValidator &validator,
-#endif
const wxString &name)
{
m_imageListNormal = (wxImageList *) NULL;
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;
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;
}
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;
}
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;
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();
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);
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
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);
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
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,
const wxString &name)
{
(void)Create(parent, id, pos, size, style, name);
+
+#if wxUSE_VALIDATORS
SetValidator(validator);
-}
#endif
+}
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);