Audacity 3.2.0
auStaticText.cpp
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file auStaticText.cpp
6
7 Paul Licameli split from Theme.cpp
8
9*//*****************************************************************//*****************************************************************/
16#include "auStaticText.h"
17
18#include "AllThemeResources.h"
19#include "Theme.h"
20
21#include <wx/dcclient.h>
22
23BEGIN_EVENT_TABLE(auStaticText, wxWindow)
24 EVT_PAINT(auStaticText::OnPaint)
25 EVT_ERASE_BACKGROUND(auStaticText::OnErase)
27
28
29auStaticText::auStaticText(wxWindow* parent, wxString textIn) :
30 wxWindow(parent, wxID_ANY)
31{
32 int textWidth, textHeight;
33
34 int fontSize = 11;
35 #ifdef __WXMSW__
36 fontSize = 9;
37 #endif
38 wxFont font(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
39 GetTextExtent(textIn, &textWidth, &textHeight, NULL, NULL, &font);
40
41 SetFont( font );
42 SetMinSize( wxSize(textWidth, textHeight) );
43 SetBackgroundColour( theTheme.Colour( clrMedium));
44 SetForegroundColour( theTheme.Colour( clrTrackPanelText));
45 SetName(textIn);
46 SetLabel(textIn);
47}
48
49void auStaticText::OnPaint(wxPaintEvent & WXUNUSED(evt))
50{
51 wxPaintDC dc(this);
52 //dc.SetTextForeground( theTheme.Colour( clrTrackPanelText));
53 dc.Clear();
54 dc.DrawText( GetLabel(), 0,0);
55}
END_EVENT_TABLE()
THEME_API Theme theTheme
Definition: Theme.cpp:82
wxColour & Colour(int iIndex)
is like wxStaticText, except it can be themed. wxStaticText can't be.
Definition: auStaticText.h:20
void OnErase(wxEraseEvent &event)
Definition: auStaticText.h:25
void OnPaint(wxPaintEvent &evt)