lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] wxWindowBase::GetValidator() const or not?


From: Greg Chicares
Subject: [lmi] wxWindowBase::GetValidator() const or not?
Date: Sat, 29 Apr 2006 02:08:33 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

The documentation says it's const:
  http://www.wxwidgets.org/manuals/2.6.3/wx_wxwindow.html#wxwindowgetvalidator
| wxValidator* GetValidator() const
but the header says it isn't:
  
http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/include/wx/window.h?annotate=1.205
| virtual wxValidator *GetValidator() { return m_windowValidator; }

Would a change like

+ virtual wxValidator const *GetValidator() const { return m_windowValidator; }

make sense?

I realize that there's little you can do with a const wxValidator per se,
and calling GetWindow() on it in this case would be silly:

  wxWindow const* w = ...
  w->GetValidator->GetWindow(); // Same as w

but this would be useful for derived classes: for example,

  void do_something_that_depends_on_include_list(wxWindow const* w)
  {
    wxTextValidator const* v = 
dynamic_cast<wxTextValidator*>(w->GetValidator());
    if(v)
      {
      wxArrayString const& includes = v->GetIncludes();
      ...
      }
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]