MCPcopy Create free account
hub / github.com/audacity/audacity / TipWindow

Method TipWindow

src/widgets/ASlider.cpp:173–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171END_EVENT_TABLE()
172
173TipWindow::TipWindow(wxWindow *parent, const TranslatableStrings & labels)
174: wxFrame(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
175 wxFRAME_SHAPED | wxNO_BORDER | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT )
176{
177 SetBackgroundStyle(wxBG_STYLE_PAINT);
178 SetBackgroundColour(wxTransparentColour);
179
180 mFont.SetPointSize(sliderFontSize);
181 mFont.SetFamily(wxFONTFAMILY_SWISS);
182 mFont.SetStyle(wxFONTSTYLE_NORMAL);
183 mFont.SetWeight(wxFONTWEIGHT_NORMAL);
184
185 mWidth = mHeight = 0;
186 for ( const auto &label : labels ) {
187 int width, height;
188 GetTextExtent(label.Translation(), &width, &height, NULL, NULL, &mFont);
189 mWidth = std::max( mWidth, width );
190 mHeight = std::max( mHeight, height );
191 }
192
193 // Pad to allow for curved corners
194 mWidth += 8;
195 mHeight += 8;
196
197#if defined(__WXMAC__)
198 // Use a bitmap region to set the shape since just adding an unfilled path
199 // will make the window transparent
200 wxBitmap shape(mWidth, mHeight);
201 wxMemoryDC dc(shape);
202
203 dc.SetPen(*wxBLACK_PEN);
204 dc.SetBrush(*wxBLACK_BRUSH);
205 dc.DrawRoundedRectangle(0, 0, mWidth, mHeight, 5);
206 dc.SelectObject(wxNullBitmap);
207
208 SetShape(wxRegion(shape, *wxWHITE));
209#else
210 wxGraphicsPath path = wxGraphicsRenderer::GetDefaultRenderer()->CreatePath();
211 path.AddRoundedRectangle(0, 0, mWidth, mHeight, 5);
212 SetShape(path);
213#endif
214}
215
216wxSize TipWindow::GetSize() const
217{

Callers

nothing calls this directly

Calls 4

maxFunction · 0.85
SetStyleMethod · 0.80
TranslationMethod · 0.80
wxRegionClass · 0.50

Tested by

no test coverage detected