MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / OnPaint

Method OnPaint

src/toggle_bitmap.cpp:69–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void ToggleBitmap::OnPaint(wxPaintEvent &) {
70 wxAutoBufferedPaintDC dc(this);
71
72 // Get background color
73 wxColour bgColor = command.IsActive(context) ? wxColour(0,255,0) : wxColour(255,0,0);
74 wxColor sysCol = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT);
75 bgColor.Set(
76 (sysCol.Red() + bgColor.Red()) / 2,
77 (sysCol.Green() + bgColor.Green()) / 2,
78 (sysCol.Blue() + bgColor.Blue()) / 2);
79
80 dc.SetPen(*wxTRANSPARENT_PEN);
81 dc.SetBrush(wxBrush(bgColor));
82 dc.DrawRectangle(wxPoint(0, 0), GetClientSize());
83
84 wxSize excess = (GetClientSize() - img.GetSize()) / 2;
85 dc.DrawBitmap(img, excess.GetX(), excess.GetY(), true);
86}

Callers

nothing calls this directly

Calls 7

wxColourClass · 0.85
DrawRectangleMethod · 0.80
GetXMethod · 0.80
GetYMethod · 0.80
IsActiveMethod · 0.45
SetMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected