MCPcopy Create free account
hub / github.com/AshampooSystems/boden / init

Method init

examples/BodenDemo/src/ButtonPage.cpp:9–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace bdn
8{
9 void ButtonPage::init()
10 {
11 stylesheet = FlexJsonStringify({"flexGrow" : 1.0});
12
13 auto textBtn = std::make_shared<Button>();
14 textBtn->label = "Hello World";
15 addChildView(makeRow("Text Button", textBtn));
16
17 auto imageBtn = std::make_shared<Button>();
18 imageBtn->imageURL = "image://main/images/white-small-icon.png";
19 addChildView(makeRow("Image Button", imageBtn));
20
21 _toggleButton = std::make_shared<Button>();
22 _toggleButton->label = "Click Me";
23 _toggleButton->onClick() += [&](auto) {
24 if (_toggleState) {
25 _toggleButton->label = "Click Me";
26 } else {
27 _toggleButton->imageURL = "image://main/images/white-small-icon.png";
28 }
29
30 _toggleState = !_toggleState;
31 };
32
33 addChildView(makeRow("Image/Text Button", _toggleButton));
34 }
35}

Callers

nothing calls this directly

Calls 2

makeRowFunction · 0.85
onClickMethod · 0.45

Tested by

no test coverage detected