9#ifndef __AUDACITY_READONLYTEXT__
10#define __AUDACITY_READONLYTEXT__
18#if wxUSE_ACCESSIBILITY
23 ReadOnlyTextAx(wxWindow * window)
32 wxAccStatus GetRole(
int childId, wxAccRole *role)
34 *role = wxROLE_SYSTEM_STATICTEXT;
39 wxAccStatus GetState(
int childId,
long *state)
42 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_READONLY;
48 wxAccStatus GetValue(
int childId, wxString* strValue)
50 *strValue = GetWindow()->GetLabel();
63 const wxString &value,
64 const wxPoint &pos = wxDefaultPosition,
65 const wxSize &
size = wxDefaultSize,
66 long style = wxBORDER_NONE)
69#if wxUSE_ACCESSIBILITY
70 SetAccessible(
safenew ReadOnlyTextAx(
this));
74 Bind(wxEVT_SET_FOCUS, [&](wxFocusEvent &event)
76 SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
77 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
82 Bind(wxEVT_KILL_FOCUS, [&](wxFocusEvent &event)
84 SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
85 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
90 Bind(wxEVT_PAINT, [&](wxPaintEvent & WXUNUSED(event))
94 wxRect rect = GetClientRect();
98 dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT));
99 wxRect rectShadow = rect;
100 rectShadow.Offset(1, 1);
101 dc.DrawLabel(GetLabel(), rectShadow, GetAlignment());
102 dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
104 dc.DrawLabel(GetLabel(), rect, GetAlignment());
116 return dc.GetMultiLineTextExtent(GetLabel());
void SetValue(const wxString &value)
void SetValue(const TranslatableString &value)
wxSize DoGetBestClientSize() const override
ReadOnlyText(wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxBORDER_NONE)
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.