From fbf09d213071a5f224694533cde266efa21d4f69 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 28 May 2016 22:54:51 -0400 Subject: [PATCH] Make ToolBar button setup functions public and static --- src/toolbars/ControlToolBar.cpp | 2 +- src/toolbars/EditToolBar.cpp | 2 +- src/toolbars/ToolBar.cpp | 6 ++++-- src/toolbars/ToolBar.h | 7 +++++-- src/toolbars/ToolsToolBar.cpp | 2 +- src/toolbars/TranscriptionToolBar.cpp | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 9d33f3d17..af56e337f 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -129,7 +129,7 @@ AButton *ControlToolBar::MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBm bool processdownevents, const wxChar *label) { - AButton *r = ToolBar::MakeButton( + AButton *r = ToolBar::MakeButton(this, bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredHiliteLarge, eEnabledUp, eEnabledDown, eDisabled, wxWindowID(id), diff --git a/src/toolbars/EditToolBar.cpp b/src/toolbars/EditToolBar.cpp index b3a5b73b8..b8dec35eb 100644 --- a/src/toolbars/EditToolBar.cpp +++ b/src/toolbars/EditToolBar.cpp @@ -105,7 +105,7 @@ AButton *EditToolBar::AddButton( { AButton *&r = mButtons[id]; - r = ToolBar::MakeButton( + r = ToolBar::MakeButton(this, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, eEnabledUp, eEnabledDown, eDisabled, wxWindowID(id), diff --git a/src/toolbars/ToolBar.cpp b/src/toolbars/ToolBar.cpp index ebec57e8c..d98a08dcf 100644 --- a/src/toolbars/ToolBar.cpp +++ b/src/toolbars/ToolBar.cpp @@ -700,6 +700,7 @@ void ToolBar::MakeButtonBackgroundsSmall() } /// Makes a button and its four different state bitmaps +/// @param parent Parent window for the button. /// @param eUp Background for when button is Up. /// @param eDown Background for when button is Down. /// @param eHilite Background for when button is Hilit. @@ -710,7 +711,8 @@ void ToolBar::MakeButtonBackgroundsSmall() /// @param placement Placement position /// @param processdownevents true iff button handles down events. /// @param size Size of the background. -AButton * ToolBar::MakeButton(teBmps eUp, +AButton * ToolBar::MakeButton(wxWindow *parent, + teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eStandardUp, @@ -731,7 +733,7 @@ AButton * ToolBar::MakeButton(teBmps eUp, wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff)); AButton * button = - new AButton(this, id, placement, size, *up2, *hilite2, *down2, + new AButton(parent, id, placement, size, *up2, *hilite2, *down2, *disable2, processdownevents); return button; diff --git a/src/toolbars/ToolBar.h b/src/toolbars/ToolBar.h index 4f1b1b198..37a94b892 100644 --- a/src/toolbars/ToolBar.h +++ b/src/toolbars/ToolBar.h @@ -121,9 +121,11 @@ class ToolBar /* not final */ : public wxPanel virtual int GetInitialWidth() { return -1; } virtual int GetMinToolbarWidth() { return GetInitialWidth(); } virtual wxSize GetDockedSize() { return GetMinSize(); } - protected: - AButton *MakeButton(teBmps eUp, + public: + static + AButton *MakeButton(wxWindow *parent, + teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eStandardUp, @@ -144,6 +146,7 @@ class ToolBar /* not final */ : public wxPanel teBmps eDisabled, wxSize size); + protected: void SetButton(bool down, AButton *button); void MakeMacRecoloredImage(teBmps eBmpOut, teBmps eBmpIn); diff --git a/src/toolbars/ToolsToolBar.cpp b/src/toolbars/ToolsToolBar.cpp index 22cf8af67..20f0f3d03 100644 --- a/src/toolbars/ToolsToolBar.cpp +++ b/src/toolbars/ToolsToolBar.cpp @@ -156,7 +156,7 @@ void ToolsToolBar::UpdatePrefs() AButton * ToolsToolBar::MakeTool( teBmps eTool, int id, const wxChar *label) { - AButton *button = ToolBar::MakeButton( + AButton *button = ToolBar::MakeButton(this, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, eTool, eTool, eTool, wxWindowID(id), diff --git a/src/toolbars/TranscriptionToolBar.cpp b/src/toolbars/TranscriptionToolBar.cpp index 1b6e44165..f088f9fbb 100644 --- a/src/toolbars/TranscriptionToolBar.cpp +++ b/src/toolbars/TranscriptionToolBar.cpp @@ -147,7 +147,7 @@ AButton *TranscriptionToolBar::AddButton( { AButton *&r = mButtons[id]; - r = ToolBar::MakeButton( + r = ToolBar::MakeButton(this, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, eFore, eFore, eDisabled, wxWindowID(id),