From: Vadim Zeitlin Date: Thu, 21 Jul 2011 13:50:03 +0000 (+0000) Subject: Allow marking wxTreeBook nodes to expand initially in XRC. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2b232decc588cc369e34747e59a1441cec88970b Allow marking wxTreeBook nodes to expand initially in XRC. Add new "expanded" attribute for XRC nodes of treebookpage class. Also update the sample and the XRC format documentation. Closes #13355. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index a42d63c195..7344aa92e3 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -446,6 +446,7 @@ All (GUI): - Support float, double and file name values in wxGenericValidator (troelsk). - Fix keyboard navigation in wxGrid with hidden columns (ivan_14_32). - Add wxDataViewEvent::IsEditCancelled() (Allonii). +- Allow marking wxTreeBook nodes to expand initially in XRC (RedTide). OSX: diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index a8ab31e9fc..88e32f791c 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -1730,6 +1730,9 @@ pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its into the image list.} @row3col{selected, @ref overview_xrcformat_type_bool, Is the page selected initially (only one page can be selected; default: 0)?} +@row3col{expanded, @ref overview_xrcformat_type_bool, + If set to 1, the page is initially expanded. By default all pages are + initially collapsed.} @endTable Each @c treebookpage has exactly one non-toplevel window as its child. diff --git a/samples/xrc/rc/controls.xrc b/samples/xrc/rc/controls.xrc index 33d56d5be2..b50afb8112 100644 --- a/samples/xrc/rc/controls.xrc +++ b/samples/xrc/rc/controls.xrc @@ -1147,9 +1147,18 @@ lay them out using wxSizers, absolute positioning, everything you like! 350,280 + + 16,16 + + + + + 0 + 0 + 1 200,180 @@ -1158,10 +1167,13 @@ lay them out using wxSizers, absolute positioning, everything you like! 1 + 1 + 1 2 + 2 200,180 @@ -1170,6 +1182,7 @@ lay them out using wxSizers, absolute positioning, everything you like! 1 + 3 200,180 diff --git a/src/xrc/xh_treebk.cpp b/src/xrc/xh_treebk.cpp index efc5c36f99..591d8c50f0 100644 --- a/src/xrc/xh_treebk.cpp +++ b/src/xrc/xh_treebk.cpp @@ -76,6 +76,24 @@ wxObject *wxTreebookXmlHandler::DoCreateResource() CreateChildren(m_tbk, true/*only this handler*/); + wxXmlNode *node = GetParamNode("object"); + int pageIndex = 0; + for (unsigned int i = 0; i < m_tbk->GetPageCount(); i++) + { + if ( m_tbk->GetPage(i) ) + { + wxXmlNode *child = node->GetChildren(); + while (child) + { + if (child->GetName() == "expanded" && child->GetNodeContent() == "1") + m_tbk->ExpandNode(pageIndex, true); + + child = child->GetNext(); + } + pageIndex++; + } + } + m_treeContext = old_treeContext; m_isInside = old_ins; m_tbk = old_par;