]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/window.h
cleanup code and reorganize it to reuse the same switch() for both OnChar() and Valid...
[wxWidgets.git] / include / wx / window.h
index 932ac84f3656181628fd4e54d0ac25be714b71d1..9ae3e478484afb58e2da1265d7dee18b49f48d58 100644 (file)
@@ -402,7 +402,7 @@ public:
         // This function will merge the window's best size into the window's
         // minimum size, giving priority to the min size components, and
         // returns the results.
-    wxSize GetEffectiveMinSize() const;
+    virtual wxSize GetEffectiveMinSize() const;
     wxDEPRECATED( wxSize GetBestFittingSize() const );  // replaced by GetEffectiveMinSize
     wxDEPRECATED( wxSize GetAdjustedMinSize() const );  // replaced by GetEffectiveMinSize
 
@@ -458,8 +458,8 @@ public:
         // Call these to override what GetBestSize() returns. This
         // method is only virtual because it is overriden in wxTLW
         // as a different API for SetSizeHints().
-    virtual void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; }
-    virtual void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; }
+    virtual void SetMinSize(const wxSize& minSize);
+    virtual void SetMaxSize(const wxSize& maxSize);
 
         // Like Set*Size, but for client, not window, size
     virtual void SetMinClientSize(const wxSize& size)
@@ -806,6 +806,13 @@ public:
         // be there)
     bool RemoveEventHandler(wxEvtHandler *handler);
 
+        // Process an event by calling GetEventHandler()->ProcessEvent(): this
+        // is a straightforward replacement for ProcessEvent() itself which
+        // shouldn't be used directly with windows as it doesn't take into
+        // account any event handlers associated with the window
+    bool ProcessWindowEvent(wxEvent& event)
+        { return GetEventHandler()->ProcessEvent(event); }
+
         // Process an event by calling GetEventHandler()->ProcessEvent() and
         // handling any exceptions thrown by event handlers. It's mostly useful
         // when processing wx events when called from C code (e.g. in GTK+
@@ -817,6 +824,26 @@ public:
     virtual void SetNextHandler(wxEvtHandler *handler);
     virtual void SetPreviousHandler(wxEvtHandler *handler);
 
+protected:
+
+    // NOTE: we change the access specifier of the following wxEvtHandler functions
+    //       so that the user won't be able to call them directly.
+    //       Calling wxWindow::ProcessEvent in fact only works when there are NO
+    //       event handlers pushed on the window.
+    //       To ensure correct operation, instead of wxWindow::ProcessEvent
+    //       you must always call wxWindow::GetEventHandler()->ProcessEvent()
+    //       or HandleWindowEvent().
+    //       The same holds for all other wxEvtHandler functions.
+
+    using wxEvtHandler::ProcessEvent;
+    using wxEvtHandler::ProcessThreadEvent;
+    using wxEvtHandler::SafelyProcessEvent;
+    using wxEvtHandler::ProcessPendingEvents;
+    using wxEvtHandler::AddPendingEvent;
+    using wxEvtHandler::QueueEvent;
+
+public:
+
     // validators
     // ----------