mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Bug1252 more: click buttons don't steal focus, ctrl+f6 still works
This commit is contained in:
@@ -56,6 +56,9 @@ class AButton final : public wxWindow {
|
||||
|
||||
virtual ~ AButton();
|
||||
|
||||
bool AcceptsFocus() const override { return s_AcceptsFocus; }
|
||||
bool AcceptsFocusFromKeyboard() const override { return true; }
|
||||
|
||||
// Associate a set of four images (button up, highlight, button down,
|
||||
// disabled) with one nondefault state of the button
|
||||
void SetAlternateImages(unsigned idx,
|
||||
@@ -133,6 +136,17 @@ class AButton final : public wxWindow {
|
||||
|
||||
void UseDisabledAsDownHiliteImage(bool flag);
|
||||
|
||||
private:
|
||||
static bool s_AcceptsFocus;
|
||||
struct Resetter { void operator () (bool *p) const { if(p) *p = false; } };
|
||||
using TempAllowFocus = std::unique_ptr<bool, Resetter>;
|
||||
|
||||
public:
|
||||
static TempAllowFocus TemporarilyAllowFocus() {
|
||||
s_AcceptsFocus = true;
|
||||
return std::move(TempAllowFocus{ &s_AcceptsFocus });
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
bool HasAlternateImages(unsigned idx);
|
||||
|
||||
Reference in New Issue
Block a user