1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

Define and use ShuttleGui::Size

This commit is contained in:
Paul Licameli 2019-11-18 19:22:21 -05:00
parent dd954247d3
commit 930c21dc2a
3 changed files with 19 additions and 1 deletions

View File

@ -2089,6 +2089,9 @@ void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags, bool prompt)
else if( mItem.mHasMinSize ) else if( mItem.mHasMinSize )
mpWind->SetMinSize( mItem.mMinSize ); mpWind->SetMinSize( mItem.mMinSize );
if ( mItem.mWindowSize != wxSize{} )
mpWind->SetSize( mItem.mWindowSize );
// Reset to defaults // Reset to defaults
mItem = {}; mItem = {};
} }

View File

@ -221,6 +221,12 @@ struct Item {
return std::move( *this ); return std::move( *this );
} }
Item&& Size( wxSize size ) &&
{
mWindowSize = size;
return std::move( *this );
}
std::function< void(wxWindow*) > mValidatorSetter; std::function< void(wxWindow*) > mValidatorSetter;
TranslatableString mToolTip; TranslatableString mToolTip;
TranslatableString mName; TranslatableString mName;
@ -233,6 +239,8 @@ struct Item {
// Applies to windows, not to subsizers // Applies to windows, not to subsizers
int mWindowPositionFlags{ 0 }; int mWindowPositionFlags{ 0 };
wxSize mWindowSize{};
wxSize mMinSize{ -1, -1 }; wxSize mMinSize{ -1, -1 };
bool mHasMinSize{ false }; bool mHasMinSize{ false };
bool mUseBestSize{ false }; bool mUseBestSize{ false };
@ -663,6 +671,12 @@ public:
return *this; return *this;
} }
ShuttleGui & Size( wxSize size )
{
std::move( mItem ).Size( size );
return *this;
}
// Prop() sets the proportion value, defined as in wxSizer::Add(). // Prop() sets the proportion value, defined as in wxSizer::Add().
ShuttleGui & Prop( int iProp ){ ShuttleGuiBase::Prop(iProp); return *this;}; // Has to be here too, to return a ShuttleGui and not a ShuttleGuiBase. ShuttleGui & Prop( int iProp ){ ShuttleGuiBase::Prop(iProp); return *this;}; // Has to be here too, to return a ShuttleGui and not a ShuttleGuiBase.

View File

@ -871,7 +871,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
for (int i = 0; (i < NUMBER_OF_BANDS) && (kThirdOct[i] <= mHiFreq); ++i) for (int i = 0; (i < NUMBER_OF_BANDS) && (kThirdOct[i] <= mHiFreq); ++i)
{ {
mSliders[i] = safenew wxSliderWrapper(pParent, ID_Slider + i, 0, -20, +20, mSliders[i] = safenew wxSliderWrapper(pParent, ID_Slider + i, 0, -20, +20,
wxDefaultPosition, wxSize(-1,150), wxSL_VERTICAL | wxSL_INVERSE); wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
mSliders[i]->SetAccessible(safenew SliderAx(mSliders[i], _("%d dB"))); mSliders[i]->SetAccessible(safenew SliderAx(mSliders[i], _("%d dB")));
@ -889,6 +889,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
.ConnectRoot( .ConnectRoot(
wxEVT_ERASE_BACKGROUND, &EffectEqualization::OnErase) wxEVT_ERASE_BACKGROUND, &EffectEqualization::OnErase)
.Position(wxEXPAND) .Position(wxEXPAND)
.Size( { -1, 150 } )
.AddWindow( mSliders[i] ); .AddWindow( mSliders[i] );
} }
S.AddSpace(15,0); S.AddSpace(15,0);