+void MyFrame::CreateTreeWithDefStyle()
+{
+ long style = wxTR_DEFAULT_STYLE |
+#ifndef NO_VARIABLE_HEIGHT
+ wxTR_HAS_VARIABLE_ROW_HEIGHT |
+#endif
+ wxTR_EDIT_LABELS;
+
+ CreateTree(style | wxSUNKEN_BORDER);
+
+ // as we don't know what wxTR_DEFAULT_STYLE could contain, test for
+ // everything
+ wxMenuBar *mbar = GetMenuBar();
+ mbar->Check(TreeTest_TogButtons, (style & wxTR_HAS_BUTTONS) != 0);
+ mbar->Check(TreeTest_TogButtons, (style & wxTR_TWIST_BUTTONS) != 0);
+ mbar->Check(TreeTest_TogLines, (style & wxTR_NO_LINES) == 0);
+ mbar->Check(TreeTest_TogRootLines, (style & wxTR_LINES_AT_ROOT) != 0);
+ mbar->Check(TreeTest_TogHideRoot, (style & wxTR_HIDE_ROOT) != 0);
+ mbar->Check(TreeTest_TogEdit, (style & wxTR_EDIT_LABELS) != 0);
+ mbar->Check(TreeTest_TogBorder, (style & wxTR_ROW_LINES) != 0);
+ mbar->Check(TreeTest_TogFullHighlight, (style & wxTR_FULL_ROW_HIGHLIGHT) != 0);
+}
+
+void MyFrame::CreateTree(long style)
+{
+ m_treeCtrl = new MyTreeCtrl(this, TreeTest_Ctrl,
+ wxDefaultPosition, wxDefaultSize,
+ style);
+ Resize();
+}
+
+void MyFrame::TogStyle(int id, long flag)
+{
+ long style = m_treeCtrl->GetWindowStyle() ^ flag;
+
+ // most treectrl styles can't be changed on the fly using the native
+ // control and the tree must be recreated
+#ifndef __WXMSW__
+ m_treeCtrl->SetWindowStyle(style);
+#else // MSW
+ delete m_treeCtrl;
+ CreateTree(style);
+#endif // !MSW/MSW
+
+ GetMenuBar()->Check(id, (style & flag) != 0);
+}
+