Added missing accessors
[wxWidgets.git] / src / common / wincmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: windows.cpp
3 // Purpose: common (to all ports) wxWindow functions
4 // Author: Julian Smart, Vadim Zeitlin
5 // Modified by:
6 // Created: 13/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/defs.h"
13 #include "wx/window.h"
14
15 // Do Update UI processing for child controls
16
17 // TODO: should this be implemented for the child window rather
18 // than the parent? Then you can override it e.g. for wxCheckBox
19 // to do the Right Thing rather than having to assume a fixed number
20 // of control classes.
21 #include "wx/checkbox.h"
22 #include "wx/radiobut.h"
23
24 void wxWindow::UpdateWindowUI()
25 {
26 wxWindowID id = GetId();
27 if (id > 0)
28 {
29 wxUpdateUIEvent event(id);
30 event.m_eventObject = this;
31
32 if (this->GetEventHandler()->ProcessEvent(event))
33 {
34 if (event.GetSetEnabled())
35 this->Enable(event.GetEnabled());
36
37 if (event.GetSetText() && this->IsKindOf(CLASSINFO(wxControl)))
38 ((wxControl*)this)->SetLabel(event.GetText());
39
40 if (this->IsKindOf(CLASSINFO(wxCheckBox)))
41 {
42 if (event.GetSetChecked())
43 ((wxCheckBox *) this)->SetValue(event.GetChecked());
44 }
45 // @@@ No radio buttons in wxGTK yet
46 #ifndef __WXGTK__
47 else if (this->IsKindOf(CLASSINFO(wxRadioButton)))
48 {
49 if (event.GetSetChecked())
50 ((wxRadioButton *) this)->SetValue(event.GetChecked());
51 }
52 #endif
53 }
54 }
55 }