+void MyAppFrame::CreateFoldBar(bool vertical)
+{
+ if (vertical)
+ SetSize(200,500);
+ else
+ SetSize(900,200);
+
+ wxFoldPanelBar *bar = new wxFoldPanelBar(this,
+ wxID_ANY,
+ wxDefaultPosition,
+ wxDefaultSize,
+ wxFPB_DEFAULT_STYLE | ( vertical ? wxFPB_VERTICAL : wxFPB_HORIZONTAL ) ,
+ wxFPB_COLLAPSE_TO_BOTTOM);
+
+ wxFoldPanel item = bar->AddFoldPanel(_T("Test me"), false);
+ bar->AddFoldPanelWindow(item, new wxButton(item.GetParent(), ID_COLLAPSEME, _T("Collapse Me")));
+
+ item = bar->AddFoldPanel(_T("Test me too!"), true);
+ bar->AddFoldPanelWindow(item, new wxButton(item.GetParent(), ID_EXPANDME, _T("Expand first one")));
+ bar->AddFoldPanelSeperator(item);
+ bar->AddFoldPanelWindow(item, new FoldTestPanel(item.GetParent(), wxID_ANY));
+
+ bar->AddFoldPanelSeperator(item);
+
+ bar->AddFoldPanelWindow(item, new wxTextCtrl(item.GetParent(), wxID_ANY, _T("Comment")), wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_SPACING, 20);
+
+ item = bar->AddFoldPanel(_T("Some opinions ..."), false);
+ bar->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), wxID_ANY, _T("I like this")));
+ if( vertical)
+ {
+ // do not add this for horizontal for better presentation
+ bar->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), wxID_ANY, _T("And also this")));
+ bar->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), wxID_ANY, _T("And gimme this too")));
+ }
+
+ bar->AddFoldPanelSeperator(item);
+
+ bar->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), wxID_ANY, _T("Check this too if you like")));
+ if( vertical)
+ {
+ // do not add this for horizontal for better presentation
+ bar->AddFoldPanelWindow(item, new wxCheckBox(item.GetParent(), wxID_ANY, _T("What about this")));
+ }
+
+ item = bar->AddFoldPanel(_T("Choose one ..."), false);
+ bar->AddFoldPanelWindow(item, new wxStaticText(item.GetParent(), wxID_ANY, _T("Enter your comment")));
+ bar->AddFoldPanelWindow(item, new wxTextCtrl(item.GetParent(), wxID_ANY, _T("Comment")), wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_SPACING, 20);
+
+ if (m_pnl) m_pnl->Destroy();
+
+ m_pnl = bar;
+
+ wxSize size = GetClientSize();
+ m_pnl->SetSize( 0, 0, size.GetWidth(), size.GetHeight() );
+}