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

Method DevtoolsLayoutTab

aui.views/src/AUI/Devtools/DevtoolsLayoutTab.cpp:114–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112};
113
114DevtoolsLayoutTab::DevtoolsLayoutTab(AWindowBase* targetWindow) : mTargetWindow(targetWindow) {
115 using namespace declarative;
116
117 setContents(Vertical {
118 Horizontal {
119 Button { "Force layout update" }.clicked(me::forceLayoutUpdate),
120 SpacerExpanding {},
121 Label { "Use CTRL to hit test views" },
122 },
123 ASplitter::Horizontal()
124 .withItems({
125 mViewHierarchyTree = _new<ATreeView>() with_style { MinSize { 300_dp }, Expanding {} },
126 Centered { mViewPropertiesView = _new<ViewPropertiesView>(nullptr) },
127 })
128 .withExpanding(),
129 });
130
131 auto model = _new<ViewHierarchyTreeModel>(aui::ptr::fake(targetWindow));
132 mViewHierarchyTree->setModel(model);
133 connect(mViewHierarchyTree->itemSelected, [this](const ATreeModelIndex& index) {
134 mViewPropertiesView->setTargetView(index.as<_<AView>>());
135 });
136 connect(mViewHierarchyTree->itemMouseHover, [this](const ATreeModelIndex& index) {
137 if (!AInput::isKeyDown(AInput::LCONTROL)) {
138 return;
139 }
140 mViewPropertiesView->setTargetView(index.as<_<AView>>());
141 });
142 connect(mouseLeave, [this] {
143 AUI_NULLSAFE(mTargetWindow->profiling())->highlightView = _weak<AView>();
144 mTargetWindow->redraw();
145 });
146 connect(targetWindow->mouseMove, [this, targetWindow, model](glm::ivec2 position) {
147 if (!AInput::isKeyDown(AInput::LCONTROL)) {
148 return;
149 }
150 auto mouseOverView = targetWindow->getViewAtRecursive(position);
151 if (!mouseOverView) {
152 return;
153 }
154
155 mViewPropertiesView->setTargetView(mouseOverView);
156 auto indexToSelect = model->find([&](const ATreeModelIndex& index) {
157 return index.as<_<AView>>() == mouseOverView;
158 });
159 if (indexToSelect) {
160 mViewHierarchyTree->select(*indexToSelect);
161 }
162 });
163}
164
165void DevtoolsLayoutTab::forceLayoutUpdate() { mTargetWindow->forceUpdateLayoutRecursively(); }

Callers

nothing calls this directly

Calls 10

setContentsFunction · 0.85
HorizontalClass · 0.85
connectFunction · 0.85
clickedMethod · 0.80
setTargetViewMethod · 0.80
getViewAtRecursiveMethod · 0.80
setModelMethod · 0.45
redrawMethod · 0.45
findMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected