]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow marking wxTreeBook nodes to expand initially in XRC.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Jul 2011 13:50:03 +0000 (13:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Jul 2011 13:50:03 +0000 (13:50 +0000)
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

docs/changes.txt
docs/doxygen/overviews/xrc_format.h
samples/xrc/rc/controls.xrc
src/xrc/xh_treebk.cpp

index a42d63c1952a635f406291a61b25406f6ec749ea..7344aa92e37bf50658f1a59bd650829b3c29c74e 100644 (file)
@@ -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:
 
index a8ab31e9fc51660f09741a5d0a5b3b5301b67a9e..88e32f791cf40a978285b00d466f479baf1f5484 100644 (file)
@@ -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.
index 33d56d5be290f83a481a378fb3a2ed7d68cb6f3d..b50afb81127b00f1500514dc303c21f4120a7ffc 100644 (file)
@@ -1147,9 +1147,18 @@ lay them out using wxSizers, absolute positioning, everything you like!
                                 <object class="wxTreebook" name="controls_treebook">
                                     <size>350,280</size>
                                     <style>wxSUNKEN_BORDER</style>
+                                    <imagelist>
+                                        <size>16,16</size>
+                                        <bitmap stock_id="wxART_HELP_BOOK"/>
+                                        <bitmap stock_id="wxART_QUESTION"/>
+                                        <bitmap stock_id="wxART_INFORMATION"/>
+                                        <bitmap stock_id="wxART_GO_HOME"/>
+                                    </imagelist>
                                     <object class="treebookpage">
                                         <label>Page 1</label>
                                         <depth>0</depth>
+                                        <image>0</image>
+                                        <expanded>1</expanded>
                                         <object class="wxButton" name="controls_treebook_button1">
                                             <size>200,180</size>
                                             <label>Button N1</label>
@@ -1158,10 +1167,13 @@ lay them out using wxSizers, absolute positioning, everything you like!
                                     <object class="treebookpage">
                                         <label>Empty Page 2</label>
                                         <depth>1</depth>
+                                        <image>1</image>
+                                        <expanded>1</expanded>
                                     </object>
                                     <object class="treebookpage">
                                         <label>Page 3</label>
                                         <depth>2</depth>
+                                        <image>2</image>
                                         <object class="wxButton" name="controls_treebook_button3">
                                             <size>200,180</size>
                                             <label>Button N3</label>
@@ -1170,6 +1182,7 @@ lay them out using wxSizers, absolute positioning, everything you like!
                                     <object class="treebookpage">
                                         <label>Page 4</label>
                                         <depth>1</depth>
+                                        <image>3</image>
                                         <object class="wxButton" name="controls_treebook_button4">
                                             <size>200,180</size>
                                             <label>Button N4</label>
index efc5c36f99df5cf1fe9f731d50617a972a0ed61e..591d8c50f0f0b7f6d56df15568c3b9fbaff32010 100644 (file)
@@ -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;