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

Method init

examples/BodenDemo/src/UIDemoPage.cpp:113–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111 {}
112
113 void UIDemoPage::init()
114 {
115 _styler->setCondition("os", std::make_shared<Styler::equals_condition>(BDN_TARGET));
116
117 stylesheet =
118 FlexJsonStringify({"direction" : "Column", "flexGrow" : 1.0, "flexShrink" : 1.0, "alignItems" : "Stretch"});
119
120 auto topWhitespaceContainer = std::make_shared<ContainerView>();
121 topWhitespaceContainer->stylesheet =
122 FlexJsonStringify({"direction" : "Row", "flexGrow" : 0.38, "minimumSize" : {"height" : 40}});
123 addChildView(topWhitespaceContainer);
124
125 auto switchView = std::make_shared<Switch>();
126 switchView->on = true;
127 addChildView(makeRow("Switch", switchView, 0.));
128
129 auto slider = std::make_shared<Slider>();
130 addChildView(makeRow("Slider", slider));
131 slider->stylesheet = FlexJsonStringify({"minimumSize" : {"width" : 100}});
132 slider->value = 0.5;
133
134 auto checkbox = std::make_shared<Checkbox>();
135 checkbox->state = TriState::On;
136 addChildView(makeRow("Checkbox", checkbox));
137
138 auto btn = std::make_shared<Button>();
139 btn->label = "Button";
140 addChildView(makeRow("Button", btn, 5, 5, 0.62, true));
141
142 auto imgBtn = std::make_shared<Button>();
143 imgBtn->imageURL = "image://main/images/white-small-icon.png";
144 addChildView(makeRow("Image Button", imgBtn, 5, 5, 0.62, false));
145
146 auto image = std::make_shared<ImageView>();
147
148 image->url = "image://main/images/image.png";
149 addChildView(makeRow("Image", image));
150
151 image->stylesheet = FlexJsonStringify({"maximumSize" : {"height" : 30}});
152
153 auto lottieView = std::make_shared<lottie::View>();
154 lottieView->stylesheet = FlexJsonStringify({"size" : {"width" : 40, "height" : 40}});
155 lottieView->url = "resource://main/images/animation.json";
156 addChildView(makeRow("Animation", lottieView));
157
158 lottieView->running = true;
159 lottieView->loop = true;
160
161 auto textField = std::make_shared<TextField>();
162 textField->placeholder = "Enter text here";
163 textField->stylesheet = FlexJsonStringify({"minimumSize" : {"width" : 150}});
164 textField->autocorrectionType = AutocorrectionType::Yes;
165 textField->returnKeyType = ReturnKeyType::Done;
166 addChildView(makeRow("Text Field", textField, 5., 20., 0.62, true));
167
168 auto textScrollView = std::make_shared<ScrollView>();
169 textScrollView->stylesheet = FlexJsonStringify({"flexGrow" : 1, "flexShrink" : 1, "margin" : {"all" : 20}});
170

Callers

nothing calls this directly

Calls 3

makeRowFunction · 0.85
setConditionMethod · 0.80
setStyleSheetMethod · 0.80

Tested by

no test coverage detected