25#include <wx/dcclient.h>
34 wxWindow(parent, wxID_ANY)
36 int textWidth, textHeight;
42 wxFont font(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
43 GetTextExtent(textIn, &textWidth, &textHeight, NULL, NULL, &font);
46 SetMinSize( wxSize(textWidth, textHeight) );
58 dc.DrawText( GetLabel(), 0,0);
62 auto rect = wxRect { GetSize() };
75 int textWidth, textHeight;
77 auto font = GetFont();
79 const auto oldFontSize = font.GetPointSize();
80 const auto newFontSize =
static_cast<int>(oldFontSize * scale);
82 if (newFontSize != oldFontSize)
84 font.SetPointSize(newFontSize);
85 GetTextExtent(GetLabel(), &textWidth, &textHeight, NULL, NULL, &font);
87 SetMinSize(wxSize(textWidth, textHeight));
static void DrawFocus(wxDC &dc, wxRect &r)
wxColour & Colour(int iIndex)
is like wxStaticText, except it can be themed. wxStaticText can't be.
void SetSelected(bool selected)
void OnErase(wxEraseEvent &event)
void OnPaint(wxPaintEvent &evt)
bool GetSelected() const noexcept
void ScaleFont(double scale)