]> git.saurik.com Git - wxWidgets.git/commitdiff
Use event tables instead of Connect() in wxInfoBarGeneric.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Oct 2009 22:55:22 +0000 (22:55 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Oct 2009 22:55:22 +0000 (22:55 +0000)
This allows to handle events from the info bar buttons in the derived classes
using the event tables while if the base class used Connect(), the derived
classes static event handlers would be never executed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/infobar.h
src/generic/infobar.cpp

index 79e1c683fe045bef0019bfecd8e367037dc627d6..db57ea31b11c605ee425775682cb04b81f357568 100644 (file)
@@ -114,6 +114,7 @@ private:
     // the original parent background colour, before we changed it
     wxColour m_origParentBgCol;
 
+    DECLARE_EVENT_TABLE()
     wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric);
 };
 
index 42f1daf56e3ce353ba5ff77a145242ddfa827db7..3b9c6b64cb4beeb8a5e874ac28a25db97a0535f7 100644 (file)
 #include "wx/scopeguard.h"
 #include "wx/sizer.h"
 
+BEGIN_EVENT_TABLE(wxInfoBarGeneric, wxInfoBarBase)
+    EVT_BUTTON(wxID_ANY, wxInfoBarGeneric::OnButton)
+END_EVENT_TABLE()
+
 // ============================================================================
 // implementation
 // ============================================================================
@@ -89,14 +93,6 @@ bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid)
                    );
     m_button->SetToolTip(_("Hide this notification message."));
 
-    Connect
-    (
-        wxEVT_COMMAND_BUTTON_CLICKED,
-        wxCommandEventHandler(wxInfoBarGeneric::OnButton),
-        NULL,
-        this
-    );
-
     // center the text inside the sizer with an icon to the left of it and a
     // button at the very right
     //