Audacity 3.2.0
ToolBarButtons.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/**********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 ToolBarButtons.h
7
8 ksoze95
9
10**********************************************************************/
11
12#ifndef __AUDACITY_TOOLBAR_BUTTONS__
13#define __AUDACITY_TOOLBAR_BUTTONS__
14
15#include <functional>
16#include <vector>
17#include "ToolBar.h"
18
19class wxCommandEvent;
20
21class AudacityProject;
22class AButton;
23
24class ToolBarButtons final {
25public:
26 struct Entry final {
27 int tool;
30 };
31
32 using ButtonList = std::vector<Entry>;
33
34 ToolBarButtons(ToolBar *const parent, AudacityProject & project, ButtonList buttonList, int size, int firstButtonId);
35
36 void OnButton(wxCommandEvent & event);
37
39 teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
40 int id, const TranslatableString &label, bool toggle = false);
41
42 void SetEnabled(int id, bool state);
43 void SetCustomEnableDisableButtonsAction(std::function<void()> action);
44
45 void PopUp(int id);
46 void PushDown(int id);
47
49 void RegenerateTooltips();
50
51private:
52 void ForAllButtons(int Action);
53
54private:
58
59 std::vector<AButton*> mButtons;
61
62 std::function<void()> mCustomEnableDisableButtonsAction;
63};
64
65#endif
int teBmps
TranslatableString label
Definition: TagsEditor.cpp:165
const auto project
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
AudacityProject & mProject
std::vector< AButton * > mButtons
void EnableDisableButtons()
void SetCustomEnableDisableButtonsAction(std::function< void()> action)
void PopUp(int id)
ButtonList mButtonList
std::function< void()> mCustomEnableDisableButtonsAction
void OnButton(wxCommandEvent &event)
void ForAllButtons(int Action)
ToolBarButtons(ToolBar *const parent, AudacityProject &project, ButtonList buttonList, int size, int firstButtonId)
ToolBar * mParent
void SetEnabled(int id, bool state)
void PushDown(int id)
std::vector< Entry > ButtonList
AButton * CreateButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, int id, const TranslatableString &label, bool toggle=false)
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:74
Holds a msgid for the translation catalog; may also bind format arguments.
std::function< void()> Action
Definition: BasicUI.h:24
TranslatableString untranslatedLabel
int tool
CommandID commandName