9#ifndef __AUDACITY_READONLYTEXT__
10#define __AUDACITY_READONLYTEXT__
19#if wxUSE_ACCESSIBILITY
24 ReadOnlyTextAx(wxWindow * window)
33 wxAccStatus GetRole(
int childId, wxAccRole *role)
35 *role = wxROLE_SYSTEM_STATICTEXT;
40 wxAccStatus GetState(
int childId,
long *state)
43 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_READONLY;
44 *state |= ( w == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
49 wxAccStatus GetValue(
int childId, wxString* strValue)
51 *strValue = GetWindow()->GetLabel();
64 const wxString &value,
65 const wxPoint &pos = wxDefaultPosition,
66 const wxSize &
size = wxDefaultSize,
67 long style = wxBORDER_NONE)
68 : wxControl(parent,
id, pos,
size, style)
70#if wxUSE_ACCESSIBILITY
71 SetAccessible(
safenew ReadOnlyTextAx(
this));
75 Bind(wxEVT_SET_FOCUS, [&](wxFocusEvent &event)
77 SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
78 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
83 Bind(wxEVT_KILL_FOCUS, [&](wxFocusEvent &event)
85 SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
86 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
91 Bind(wxEVT_PAINT, [&](wxPaintEvent & WXUNUSED(event))
95 wxRect rect = GetClientRect();
99 dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT));
100 wxRect rectShadow = rect;
101 rectShadow.Offset(1, 1);
102 dc.DrawLabel(GetLabel(), rectShadow, GetAlignment());
103 dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
105 dc.DrawLabel(GetLabel(), rect, GetAlignment());
117 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 ...