Audacity 3.2.0
ShuttleGuiScopedSizer.h
Go to the documentation of this file.
1#pragma once
2
3#include "ShuttleGui.h"
4
5template <typename ReturnType, typename... Args> class ScopedSizer
6{
7public:
9 ShuttleGui& s, ReturnType (ShuttleGui::*startFunc)(Args...),
10 void (ShuttleGui::*endFunc)(), Args... args)
11 : mShuttleGui(s)
12 , mStartFunction(startFunc)
13 , mEndFunction(endFunc)
14 {
15 (mShuttleGui.*mStartFunction)(std::forward<Args>(args)...);
16 }
17
19 {
21 }
22
23private:
25 ReturnType (ShuttleGui::*mStartFunction)(Args...);
27};
28
29class ScopedHorizontalLay : public ScopedSizer<void, int, int>
30{
31public:
33 ShuttleGui& s, int PositionFlags = wxALIGN_CENTRE, int iProp = 1)
34 : ScopedSizer<void, int, int>(
35 s, &ShuttleGui::StartHorizontalLay, &ShuttleGui::EndHorizontalLay,
36 PositionFlags, iProp)
37 {
38 }
39};
40
41class ScopedInvisiblePanel : public ScopedSizer<wxPanel*, int>
42{
43public:
44 ScopedInvisiblePanel(ShuttleGui& s, int border = 0)
45 : ScopedSizer<wxPanel*, int>(
46 s, &ShuttleGui::StartInvisiblePanel, &ShuttleGui::EndInvisiblePanel,
47 border)
48 {
49 }
50};
51
52class ScopedVerticalLay : public ScopedSizer<void, int>
53{
54public:
55 ScopedVerticalLay(ShuttleGui& s, int iProp = 1)
56 : ScopedSizer<void, int>(
57 s, &ShuttleGui::StartVerticalLay, &ShuttleGui::EndVerticalLay,
58 iProp)
59 {
60 }
61};
62
64 public ScopedSizer<wxStaticBox*, const TranslatableString&, int>
65{
66public:
68 : ScopedSizer<wxStaticBox*, const TranslatableString&, int>(
69 s, &ShuttleGui::StartStatic, &ShuttleGui::EndStatic, label, iProp)
70 {
71 }
72};
TranslatableString label
Definition: TagsEditor.cpp:165
ScopedHorizontalLay(ShuttleGui &s, int PositionFlags=wxALIGN_CENTRE, int iProp=1)
ScopedInvisiblePanel(ShuttleGui &s, int border=0)
ReturnType(ShuttleGui::* mStartFunction)(Args...)
ShuttleGui & mShuttleGui
ScopedSizer(ShuttleGui &s, ReturnType(ShuttleGui::*startFunc)(Args...), void(ShuttleGui::*endFunc)(), Args... args)
void(ShuttleGui::* mEndFunction)()
ScopedStatic(ShuttleGui &s, const TranslatableString &label, int iProp=0)
ScopedVerticalLay(ShuttleGui &s, int iProp=1)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.