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

Method ToggleBitmap

src/toggle_bitmap.cpp:44–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42#include <wx/tglbtn.h>
43
44ToggleBitmap::ToggleBitmap(wxWindow *parent, agi::Context *context, const char *cmd_name, int icon_size, const char *ht_ctx, wxSize const& size)
45: wxControl(parent, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER)
46, context(context)
47, command(*cmd::get(cmd_name))
48, img(command.Icon(icon_size))
49{
50 int w = size.GetWidth() != -1 ? size.GetWidth() : img.GetWidth();
51 int h = size.GetHeight() != -1 ? size.GetHeight() : img.GetHeight();
52 SetClientSize(w, h);
53 GetSize(&w, &h);
54 SetSizeHints(w, h, w, h);
55
56 SetBackgroundStyle(wxBG_STYLE_PAINT);
57
58 ToolTipManager::Bind(this, command.StrHelp(), ht_ctx, cmd_name);
59 Bind(wxEVT_PAINT, &ToggleBitmap::OnPaint, this);
60 Bind(wxEVT_LEFT_DOWN, &ToggleBitmap::OnMouseEvent, this);
61}
62
63void ToggleBitmap::OnMouseEvent(wxMouseEvent &) {
64 if (command.Validate(context))

Callers

nothing calls this directly

Calls 5

getFunction · 0.85
IconMethod · 0.80
StrHelpMethod · 0.80
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected