Audacity 3.2.0
Public Member Functions | List of all members
ReadOnlyText Class Referencefinal

#include <ReadOnlyText.h>

Inheritance diagram for ReadOnlyText:
[legend]
Collaboration diagram for ReadOnlyText:
[legend]

Public Member Functions

 ReadOnlyText (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxBORDER_NONE)
 
 ~ReadOnlyText ()
 
wxSize DoGetBestClientSize () const override
 
wxString GetValue ()
 
void SetValue (const wxString &value)
 
void SetValue (const TranslatableString &value)
 

Detailed Description

Definition at line 59 of file ReadOnlyText.h.

Constructor & Destructor Documentation

◆ ReadOnlyText()

ReadOnlyText::ReadOnlyText ( wxWindow *  parent,
wxWindowID  id,
const wxString &  value,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxBORDER_NONE 
)
inline

Definition at line 62 of file ReadOnlyText.h.

68 : wxControl(parent, id, pos, size, style)
69 {
70#if wxUSE_ACCESSIBILITY
71 SetAccessible(safenew ReadOnlyTextAx(this));
72#endif
73 SetInitialSize(size);
74
75 Bind(wxEVT_SET_FOCUS, [&](wxFocusEvent &event)
76 {
77 SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
78 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
79 Refresh();
80 event.Skip();
81 });
82
83 Bind(wxEVT_KILL_FOCUS, [&](wxFocusEvent &event)
84 {
85 SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
86 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
87 Refresh();
88 event.Skip();
89 });
90
91 Bind(wxEVT_PAINT, [&](wxPaintEvent & WXUNUSED(event))
92 {
93 wxPaintDC dc(this);
94
95 wxRect rect = GetClientRect();
96 if (!IsEnabled())
97 {
98 // draw shadow of the text
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));
104 }
105 dc.DrawLabel(GetLabel(), rect, GetAlignment());
106 });
107 };
#define safenew
Definition: MemoryX.h:10

References safenew, and size.

◆ ~ReadOnlyText()

ReadOnlyText::~ReadOnlyText ( )
inline

Definition at line 109 of file ReadOnlyText.h.

110 {
111 };

Member Function Documentation

◆ DoGetBestClientSize()

wxSize ReadOnlyText::DoGetBestClientSize ( ) const
inlineoverride

Definition at line 113 of file ReadOnlyText.h.

114 {
115 wxClientDC dc(wxConstCast(this, ReadOnlyText));
116
117 return dc.GetMultiLineTextExtent(GetLabel());
118 }

◆ GetValue()

wxString ReadOnlyText::GetValue ( )
inline

Definition at line 120 of file ReadOnlyText.h.

121 {
122 return GetLabel();
123 }

◆ SetValue() [1/2]

void ReadOnlyText::SetValue ( const TranslatableString value)
inline

Definition at line 131 of file ReadOnlyText.h.

132 {
133 SetValue(value.Translation());
134 }
void SetValue(const wxString &value)
Definition: ReadOnlyText.h:125
wxString Translation() const

References SetValue(), and TranslatableString::Translation().

Here is the call graph for this function:

◆ SetValue() [2/2]

void ReadOnlyText::SetValue ( const wxString &  value)
inline

Definition at line 125 of file ReadOnlyText.h.

126 {
127 SetLabel(value);
128 Refresh();
129 }

Referenced by DirectoriesPrefs::OnTempText(), LibraryPrefs::SetFFmpegVersionText(), LibraryPrefs::SetMP3VersionText(), and SetValue().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: