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 58 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 61 of file ReadOnlyText.h.

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

References safenew, and size.

◆ ~ReadOnlyText()

ReadOnlyText::~ReadOnlyText ( )
inline

Definition at line 108 of file ReadOnlyText.h.

109 {
110 };

Member Function Documentation

◆ DoGetBestClientSize()

wxSize ReadOnlyText::DoGetBestClientSize ( ) const
inlineoverride

Definition at line 112 of file ReadOnlyText.h.

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

◆ GetValue()

wxString ReadOnlyText::GetValue ( )
inline

Definition at line 119 of file ReadOnlyText.h.

120 {
121 return GetLabel();
122 }

◆ SetValue() [1/2]

void ReadOnlyText::SetValue ( const TranslatableString value)
inline

Definition at line 130 of file ReadOnlyText.h.

131 {
132 SetValue(value.Translation());
133 }
void SetValue(const wxString &value)
Definition: ReadOnlyText.h:124
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 124 of file ReadOnlyText.h.

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

Referenced by DirectoriesPrefs::OnTempText(), anonymous_namespace{FFmpegPrefs.cpp}::SetFFmpegVersionText(), and SetValue().

Here is the caller graph for this function:

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