Wt::WTreeNode
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
A single node in a tree.
〔 這個(gè) widget 渲染的是一棵樹的一個(gè)節(jié)點(diǎn)。〕
A tree list is constructed by combining several tree node objects in a tree hierarchy, by passing the parent tree node as the last argument in the child node constructor, or by using addChildNode(), to add a child to its parent.
〔一棵樹或者說一個(gè)樹表,由很多樹節(jié)點(diǎn)對(duì)象按一定的層次關(guān)系組合而成,可以先創(chuàng)建子節(jié)點(diǎn)然后告訴它誰是父節(jié)點(diǎn),或者創(chuàng)建父節(jié)點(diǎn),然后使用 addChildNode() 增加子節(jié)點(diǎn)。 〕
Each tree node has a label, and optionally a label icon pair. The icon pair offers the capability to show a different icon depending on the state of the node (expanded or collapsed). When the node has any children, a child count may be displayed next to the label using setChildCountPolicy().
〔每個(gè)樹節(jié)點(diǎn)都有一個(gè) 標(biāo)簽,這個(gè)標(biāo)簽也可以用一對(duì)小圖標(biāo)代替。 這一對(duì)小圖標(biāo)具有根據(jù)節(jié)點(diǎn)打開/關(guān)閉狀態(tài)切換顯示的功能。當(dāng)某個(gè)節(jié)點(diǎn)含有子節(jié)點(diǎn)時(shí),可以通過 setChildCountPolicy() 來設(shè)置是否在父節(jié)點(diǎn)標(biāo)簽上顯示子節(jié)點(diǎn)的數(shù)量。 〕
Expanding a tree node it will collapse all its children, so that a user may collapse/expand a node as a short-cut to collapsing all children.
〔擴(kuò)展開一個(gè)樹節(jié)點(diǎn)將顯示其所有下級(jí)子節(jié)點(diǎn)〕
The treenode provides several policies to communicate the current contents of the tree to the client (if possible):
〔樹節(jié)點(diǎn)與客戶端通訊的方式有如下幾種:〕
- WTreeNode::PreLoading: the entire tree is transmitted to the client, and all tree navigation requires no further communication.
- 〔一次全部載入,未來不用與服務(wù)器通訊。〕
- WTreeNode::LazyLoading: only the minimum is transmitted to the client. When expanding a node for the first time, only then it is transmitted to the client, and this may thus have some latency.
- 〔最小載入原則,當(dāng)?shù)谝淮螖U(kuò)展某個(gè)節(jié)點(diǎn)時(shí)才載入到客戶端,這顯然需要有載入時(shí)間。〕
- WTreeNode::NextLevelLoading: all leafs of visible children are transmitted, but not their children. This provides a good trade-off between bandwith use and interactivity, since expanding any tree node will happen instantly, and at the same time trigger some communication in the back-ground to load the next level of invisible nodes.
- 〔可見載入原則。這是一種平衡原則,當(dāng)前看不到的子節(jié)點(diǎn)不用載入,需要時(shí)才載入。〕
The default policy is WTreeNode::LazyLoading. Another load policy may be specified using setLoadPolicy() on the root node and before adding any children. The load policy is inherited by all children in the tree.
〔Wt 默認(rèn)的是最小載入原則,其他的可以通過 setLoadPolicy()? 對(duì)根節(jié)點(diǎn)定義,特別要注意必須是在添加子節(jié)點(diǎn)前定義。載入原則可以被所有子節(jié)點(diǎn)繼承。〕
There are a few scenarios where it makes sense to specialize the WTreeNode class. One scenario is create a tree that is populated dynamically while browsing. For this purpose you should reimplement the populate() method, whose default implementation does nothing. This method is called when 'loading' the node. The exact moment for loading a treenode depends on the LoadPolicy.
A second scenario that is if you want to customize the look of the tree label (see labelArea()) or if you want to modify or augment the event collapse/expand event handling (see doExpand() and doCollapse()).
〔節(jié)點(diǎn)的樣式可以自定義,通過labelArea() 擴(kuò)展當(dāng)前標(biāo)簽區(qū)域的內(nèi)容或動(dòng)作等,當(dāng)然擴(kuò)展或收起的事件處理也可以自定義,具體參考doExpand() 和 doCollapse()〕
See WTree for a usage example.
CSS
The tree is styled by the current CSS theme. The look can be overridden using the Wt-tree CSS class and the following selectors:
〔默認(rèn)樹節(jié)點(diǎn)的樣式采用 CSS theme 定義,我們可以重寫 Wt-tree 樣式類,如下:〕
.Wt-tree .Wt-trunk : vertical line, trunk
.Wt-tree .Wt-end : vertical line, last item
.Wt-tree .Wt-collapse : collapse icon (img *)
.Wt-tree .Wt-expand : expand icon (img *)
.Wt-tree .Wt-noexpand : leaf icon
.Wt-tree .Wt-label : the node label
.Wt-tree .Wt-childcount : the node child count * The collapse and expand icons are fetched themselves as images, nav-plus.gif and nav-minus.gif.
See also:
類別: c++witty? 查看評(píng)論
轉(zhuǎn)載于:https://my.oschina.net/zhmsong/blog/5226
總結(jié)
以上是生活随笔為你收集整理的Wt::WTreeNode的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 搜索引擎指令站长常用搜索引擎命令汇总
- 下一篇: C和C++实务精选丛书