slot 0.0.1
A real time UI render framework
载入中...
搜索中...
未找到
TreeViewNode.h
浏览该文件的文档.
1#pragma once
2
7
8#include <functional>
9
10namespace z8::ui {
11
12class TreeViewNode;
13
16private:
17 TreeViewNode *Owner = nullptr;
18 size_t Depth = 0;
19
20public:
21 RectNode *HeaderNode = nullptr;
22 BaseNode *IndentNode = nullptr;
24 TextNode *LabelNode = nullptr;
25 BaseNode *ItemsNode = nullptr;
26 bool Expanded = true;
27 bool Selected = false;
28 bool Enabled = true;
29
31
32 void Attach(TreeViewNode *owner, size_t depth);
33 BaseNode *ContentHost() override { return ItemsNode; }
34 const char *TypeName() const override { return "TreeItem"; }
37 void SetEnabled(bool enabled);
38 bool SetExpanded(bool expanded);
39 bool SetProperty(const std::string &name, const std::string &value) override;
40 void SetSelected(bool selected);
41 void SetText(const std::string &text);
42
43private:
44 bool HasItems() const;
45 void OnVisualStateChanged() override;
46 void RefreshExpander();
47};
48
50class TreeViewNode : public ScrollNode {
51public:
54
56
57 const char *TypeName() const override { return "TreeView"; }
58 void OnAfterLayout() override;
59 bool SelectItem(TreeViewItemNode *item, bool notify = true);
60
61private:
62 void AttachItems(BaseNode &host, size_t depth,
65};
66
67} // namespace z8::ui
Definition Owner.h:15
资源的强类型引用,同时覆盖持久化 ID 与运行时索引两种边界。
Definition ResourceRef.h:36
Definition BaseNode.h:25
Definition ImageNode.h:36
Definition RectNode.h:10
Definition ScrollNode.h:15
Definition TextNode.h:20
Definition TreeViewNode.h:15
void SetText(const std::string &text)
Definition TreeViewNode.cpp:195
void Attach(TreeViewNode *owner, size_t depth)
Definition TreeViewNode.cpp:75
bool Expanded
Definition TreeViewNode.h:26
BaseNode * ContentHost() override
Definition TreeViewNode.h:33
bool Selected
Definition TreeViewNode.h:27
void RefreshExpander()
Definition TreeViewNode.cpp:137
RectNode * HeaderNode
Definition TreeViewNode.h:21
ImageNode * ExpanderNode
Definition TreeViewNode.h:23
void OnVisualStateChanged() override
Definition TreeViewNode.cpp:120
TreeViewItemNode()
Definition TreeViewNode.cpp:10
EventReply OnKeyDown(KeyArgs args) override
Definition TreeViewNode.cpp:88
bool Enabled
Definition TreeViewNode.h:28
BaseNode * ItemsNode
Definition TreeViewNode.h:25
size_t Depth
Definition TreeViewNode.h:18
const char * TypeName() const override
Definition TreeViewNode.h:34
bool HasItems() const
Definition TreeViewNode.cpp:84
TextNode * LabelNode
Definition TreeViewNode.h:24
BaseNode * IndentNode
Definition TreeViewNode.h:22
void SetSelected(bool selected)
Definition TreeViewNode.cpp:190
bool SetExpanded(bool expanded)
Definition TreeViewNode.cpp:155
EventReply OnMouseDown(MouseMovArgs args) override
Definition TreeViewNode.cpp:107
bool SetProperty(const std::string &name, const std::string &value) override
Definition TreeViewNode.cpp:163
void SetEnabled(bool enabled)
Definition TreeViewNode.cpp:150
Definition TreeViewNode.h:50
const char * TypeName() const override
Definition TreeViewNode.h:57
void AttachItems(BaseNode &host, size_t depth, TreeViewItemNode *&declaredSelection)
Definition TreeViewNode.cpp:207
bool SelectItem(TreeViewItemNode *item, bool notify=true)
Definition TreeViewNode.cpp:242
TreeViewItemNode * SelectedItem
Definition TreeViewNode.h:52
TreeViewNode()
Definition TreeViewNode.cpp:200
void ClearSelection(BaseNode &host, TreeViewItemNode *except)
Definition TreeViewNode.cpp:226
std::function< void(TreeViewItemNode *) SelectionChanged)
Definition TreeViewNode.h:53
void OnAfterLayout() override
Definition TreeViewNode.cpp:236
Definition Application.h:18
EventReply
Definition Event.h:13
Definition Event.h:67
Definition Event.h:41