MCPcopy Create free account
hub / github.com/Tom94/tev / ImageButton

Method ImageButton

src/ImageButton.cpp:32–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30namespace tev {
31
32ImageButton::ImageButton(Widget* parent, string_view caption, bool canBeReference) :
33 Widget{parent}, mCaption{caption}, mCanBeReference{canBeReference} {
34 this->set_layout(new BoxLayout{Orientation::Vertical, Alignment::Fill});
35 mCaptionTextBox = new TextBox{this, caption};
36 mCaptionTextBox->set_visible(false);
37 mCaptionTextBox->set_editable(true);
38 mCaptionTextBox->set_alignment(TextBox::Alignment::Right);
39 mCaptionTextBox->set_placeholder(caption);
40 mCaptionTextBox->set_callback([this](const string&) {
41 this->hideTextBox();
42 return true;
43 });
44 mCaptionTextBox->set_corner_radius(0.0f);
45 mCaptionTextBox->set_solid_color(IMAGE_COLOR);
46
47 m_preferred_size_depends_on_size = false;
48}
49
50Vector2i ImageButton::preferred_size_impl(NVGcontext* ctx) const {
51 if (m_preferred_size_cache != Vector2i(-1)) {

Callers

nothing calls this directly

Calls 1

hideTextBoxMethod · 0.95

Tested by

no test coverage detected