]> git.saurik.com Git - wxWidgets.git/commitdiff
common part of wxWindow class
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 23 Jul 1998 16:01:33 +0000 (16:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 23 Jul 1998 16:01:33 +0000 (16:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wincmn.cpp [new file with mode: 0644]

diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp
new file mode 100644 (file)
index 0000000..9783cb3
--- /dev/null
@@ -0,0 +1,52 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        windows.cpp
+// Purpose:     common (to all ports) wxWindow functions
+// Author:      Julian Smart, Vadim Zeitlin
+// Modified by:
+// Created:     13/07/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart and Markus Holzem
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// Do Update UI processing for child controls
+
+// TODO: should this be implemented for the child window rather
+// than the parent? Then you can override it e.g. for wxCheckBox
+// to do the Right Thing rather than having to assume a fixed number
+// of control classes.
+#include "wx/checkbox.h"
+#include "wx/radiobut.h"
+
+void wxWindow::UpdateWindowUI()
+{
+  wxWindowID id = GetId();
+  if (id > 0)
+  {
+    wxUpdateUIEvent event(id);
+    event.m_eventObject = this;
+
+    if (this->GetEventHandler()->ProcessEvent(event))
+    {
+      if (event.GetSetEnabled())
+        this->Enable(event.GetEnabled());
+
+      if (event.GetSetText() && this->IsKindOf(CLASSINFO(wxControl)))
+        ((wxControl*)this)->SetLabel(event.GetText());
+
+      if (this->IsKindOf(CLASSINFO(wxCheckBox)))
+      {
+        if (event.GetSetChecked())
+          ((wxCheckBox *) this)->SetValue(event.GetChecked());
+      }
+      // @@@ No radio buttons in wxGTK yet
+#ifndef __WXGTK__
+      else if (this->IsKindOf(CLASSINFO(wxRadioButton)))
+      {
+        if (event.GetSetChecked())
+          ((wxRadioButton *) this)->SetValue(event.GetChecked());
+      }
+#endif
+    }
+  }
+}