FIX: media play state conflict when switch device

Change-Id: I95680159a50b2085cb6de5b7cd612d6b444a6446
This commit is contained in:
chunmao.guo 2022-08-26 09:39:45 +08:00 committed by Lane.Wei
parent 3c8d9be77e
commit 2ecdf43ca1
4 changed files with 38 additions and 23 deletions

View file

@ -122,6 +122,8 @@ bool Button::Enable(bool enable)
return result;
}
void Button::SetCanFocus(bool canFocus) { this->canFocus = canFocus; }
void Button::Rescale()
{
if (this->active_icon.bmp().IsOk())
@ -230,7 +232,8 @@ void Button::mouseDown(wxMouseEvent& event)
{
event.Skip();
pressedDown = true;
SetFocus();
if (canFocus)
SetFocus();
CaptureMouse();
}
@ -286,3 +289,5 @@ WXLRESULT Button::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
}
#endif
bool Button::AcceptsFocus() const { return canFocus; }

View file

@ -15,7 +15,8 @@ class Button : public StaticBox
StateColor text_color;
bool pressedDown = false;
bool m_selected = true;
bool m_selected = true;
bool canFocus = true;
static const int buttonWidth = 200;
static const int buttonHeight = 50;
@ -43,7 +44,9 @@ public:
void SetSelected(bool selected = true) { m_selected = selected; }
bool Enable(bool enable = true);
bool Enable(bool enable = true) override;
void SetCanFocus(bool canFocus) override;
void Rescale();
@ -52,6 +55,8 @@ protected:
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
#endif
bool AcceptsFocus() const override;
private:
void paintEvent(wxPaintEvent& evt);