From a7daf7ea0e0805d67cd8d87be2fc5e84c48695ca Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 10 Dec 2009 02:59:11 +0000 Subject: [PATCH] No changes, just refactor wxToolBarToolBase ctors. Add the usual Init() function for common initialization. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62847 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/tbarbase.h | 56 +++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/include/wx/tbarbase.h b/include/wx/tbarbase.h index ba6a73e489..e68a1d7037 100644 --- a/include/wx/tbarbase.h +++ b/include/wx/tbarbase.h @@ -60,6 +60,7 @@ public: // ctors & dtor // ------------ + // generic ctor for any kind of tool wxToolBarToolBase(wxToolBarBase *tbar = NULL, int toolid = wxID_SEPARATOR, const wxString& label = wxEmptyString, @@ -71,40 +72,34 @@ public: const wxString& longHelpString = wxEmptyString) : m_label(label), m_shortHelpString(shortHelpString), - m_longHelpString(longHelpString), - m_dropdownMenu(NULL) + m_longHelpString(longHelpString) { - m_tbar = tbar; - m_id = toolid; - if (m_id == wxID_ANY) - m_id = wxWindow::NewControlId(); + Init + ( + tbar, + toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR + : wxTOOL_STYLE_BUTTON, + toolid == wxID_ANY ? wxWindow::NewControlId() + : toolid, + kind + ); + m_clientData = clientData; m_bmpNormal = bmpNormal; m_bmpDisabled = bmpDisabled; - - m_kind = kind; - - m_enabled = true; - m_toggled = false; - - m_toolStyle = toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR - : wxTOOL_STYLE_BUTTON; } + // ctor for controls only wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control, const wxString& label) : m_label(label) { - m_tbar = tbar; - m_control = control; - m_id = control->GetId(); + Init(tbar, wxTOOL_STYLE_CONTROL, control->GetId(), wxITEM_MAX); - m_kind = wxITEM_MAX; // invalid value - - m_enabled = true; - m_toggled = false; + m_control = control; + } m_toolStyle = wxTOOL_STYLE_CONTROL; @@ -206,6 +201,25 @@ public: wxMenu *GetDropdownMenu() const { return m_dropdownMenu; } protected: + // common part of all ctors + void Init(wxToolBarBase *tbar, + wxToolBarToolStyle style, + int toolid, + wxItemKind kind) + { + m_tbar = tbar; + m_toolStyle = style; + m_id = toolid; + m_kind = kind; + + m_clientData = NULL; + + m_toggled = false; + m_enabled = true; + + m_dropdownMenu = NULL; + } + wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL) // tool parameters -- 2.45.2