MCPcopy Create free account
hub / github.com/aui-framework/aui / setTargetView

Method setTargetView

aui.views/src/AUI/Devtools/ViewPropertiesView.cpp:54–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void ViewPropertiesView::setTargetView(const _<AView>& targetView) {
55 if (!targetView) {
56 return;
57 }
58 AUI_NULLSAFE(targetView->getWindow())->profiling()->highlightView = targetView;
59 AUI_NULLSAFE(targetView->getWindow())->redraw();
60
61 mTargetView = targetView;
62 if (!targetView)
63 return;
64
65 ADeque<ass::prop::IPropertyBase*> applicableDeclarations;
66
67 using namespace declarative;
68 auto addressStr = "{}"_format((void*) targetView.get());
69 _<AViewContainer> dst = Vertical {
70 Horizontal {
71 Vertical {
72 _new<ALabel>(Devtools::prettyViewName(targetView.get())) with_style { FontSize { 14_pt } },
73 Horizontal {
74 Label { addressStr },
75 Button { "Copy" }.clicked(this, [addressStr] { AClipboard::copyToClipboard(addressStr); }),
76 },
77
78 Label { "Min size = {}, {}"_format(targetView->getMinimumWidth(), targetView->getMinimumHeight()) },
79
80 CheckBoxWrapper { Label { "Enabled" } } && targetView->enabled(),
81 AText::fromString((targetView->getAssNames() | ranges::to<AStringVector>()).join(", ")),
82 Horizontal {
83 Button { "Add \"DevtoolsTest\" stylesheet name" } let {
84 it->setEnabled(!targetView->getAssNames().contains("DevtoolsTest"));
85 connect(it->clicked, [=] {
86 targetView->addAssName("DevtoolsTest");
87 setTargetView(targetView);
88 });
89 },
90 },
91 CheckBoxWrapper {
92 Label { "Expanding" },
93 } && targetView->expanding().biProjected(aui::lambda_overloaded {
94 [](bool v) -> glm::ivec2 {
95 return glm::ivec2(v ? 1 : 0);
96 },
97 [](glm::ivec2 v) {
98 return v != glm::ivec2(0);
99 },
100 }),
101 GroupBox {
102 Label { "Visibility" },
103 _new<ARadioGroup>() let {
104 static constexpr auto POSSIBLE_VALUES = aui::enumerate::ALL_VALUES<Visibility>;
105 it->setModel(AListModel<AString>::fromVector(
106 POSSIBLE_VALUES | ranges::views::transform(&AEnumerate<Visibility>::toName) | ranges::to_vector));
107 AObject::biConnect(targetView->visibility().biProjected(aui::lambda_overloaded {
108 [](Visibility v) -> int {
109 return aui::indexOf(POSSIBLE_VALUES, v).valueOr(0);
110 },
111 [](int v) -> Visibility {

Callers 1

DevtoolsLayoutTabMethod · 0.80

Calls 15

fromStringFunction · 0.85
connectFunction · 0.85
biConnectFunction · 0.85
indexOfFunction · 0.85
toStringFunction · 0.85
setContentsFunction · 0.85
clickedMethod · 0.80
addAssNameMethod · 0.80
valueOrMethod · 0.80
getWindowMethod · 0.45
redrawMethod · 0.45

Tested by

no test coverage detected