diff --git a/src/ui/widgets/cclcc/optionsvoiceslider.cpp b/src/ui/widgets/cclcc/optionsvoiceslider.cpp index 757887f9..f2fbab02 100644 --- a/src/ui/widgets/cclcc/optionsvoiceslider.cpp +++ b/src/ui/widgets/cclcc/optionsvoiceslider.cpp @@ -26,6 +26,13 @@ OptionsVoiceSlider::OptionsVoiceSlider( Bounds = RectF(Bounds.X, Bounds.Y, VoiceEntryDimensions.x, VoiceEntryDimensions.y); EntryButton.Bounds = Bounds; + + std::function onClick = std::bind( + &OptionsVoiceSlider::MuteButtonOnClick, this, std::placeholders::_1); + const RectF muteButtonBounds(Bounds.GetPos().x + PortraitOffset.x, + Bounds.GetPos().y + PortraitOffset.y, + portrait.ScaledWidth(), portrait.ScaledHeight()); + MuteButton = ClickButton(0, muteButtonBounds, onClick); } void OptionsVoiceSlider::Render() { @@ -53,10 +60,25 @@ void OptionsVoiceSlider::Render() { void OptionsVoiceSlider::UpdateInput() { OptionsSlider::UpdateInput(); + MuteButton.UpdateInput(); if (HasFocus) Muted ^= (bool)(PADinputButtonWentDown & PAD1Y); } +void OptionsVoiceSlider::Show() { + OptionsSlider::Show(); + MuteButton.Show(); +} + +void OptionsVoiceSlider::Hide() { + OptionsSlider::Hide(); + MuteButton.Hide(); +} + +void OptionsVoiceSlider::MuteButtonOnClick(ClickButton* target) { + Muted = !Muted; +} + } // namespace CCLCC } // namespace Widgets } // namespace UI diff --git a/src/ui/widgets/cclcc/optionsvoiceslider.h b/src/ui/widgets/cclcc/optionsvoiceslider.h index 123e718c..932ba011 100644 --- a/src/ui/widgets/cclcc/optionsvoiceslider.h +++ b/src/ui/widgets/cclcc/optionsvoiceslider.h @@ -17,11 +17,16 @@ class OptionsVoiceSlider : public OptionsSlider { void Render() override; void UpdateInput() override; + void Show() override; + void Hide() override; + private: const Sprite& Portrait; const Sprite& MutedPortrait; bool Muted = false; + ClickButton MuteButton; + void MuteButtonOnClick(ClickButton* target); }; } // namespace CCLCC