Piniu
Piniu

Reputation: 129

How to make '3 part' splitter window in wxWidgets?

I want to create 3 parts in a window or panel. All the 3 Parts should have possibility to resized by user and be automatically resized when user change size of Main window. Its something like 3 panels added to vertical box sizer, but user can resize all of three parts. I can add up to 2 panels to wxSplitterWindow.

Im working with C++, wxWidgets and wxFormBuilder.

Upvotes: 3

Views: 5129

Answers (3)

Nathan Osman
Nathan Osman

Reputation: 73195

Can you use wxAuiManager?

You could use this to create 'panels' (for lack of a better word) that can be resized and moved around (even undocked and floated). For you it would look something like:

wxAuiManager * pManager; // a pointer to the manager for the wxFrame
wxWindow * pPanel1;
wxWindow * pPanel2;   // the 3 panels you want to add
wxWindow * pPanel3;   // they can be wxPanel's or any window

// Add the panels to the window
pManager->AddPane(pPanel1,wxAuiPaneInfo().Top());
pManager->AddPane(pPanel2,wxAuiPaneInfo().Centre());
pManager->AddPane(pPanel3,wxAuiPaneInfo().Bottom());

Hopefully this works for you.

Upvotes: 5

Tariq1948
Tariq1948

Reputation: 49

well , to make 3 part spiltted you just make two splitter windows one of the is a child of the other and do almost the same coding like deciding orientation of separation here is some code example

spiletterwindowsFrame* frame = new spiletterwindowsFrame(0L, _("wxWidgets Application Template"));
frame->SetIcon(wxICON(aaaa)); // To Set App Icon

wxSplitterWindow* spltmainv = new wxSplitterWindow(frame ,-1 ,wxPoint(-1,-1) ,wxSize(-1,-1),wxSP_LIVE_UPDATE);
wxPanel* pnlv = new wxPanel(spltmainv);
pnlv ->SetBackgroundColour(wxColor(*wxRED));

wxSplitterWindow* spltmainh = new wxSplitterWindow(spltmainv ,-1 ,wxPoint(-1,-1) ,wxSize(-1,-1),wxSP_LIVE_UPDATE);
wxPanel* pnlh1 = new wxPanel(spltmainh);
wxPanel* pnlh2 = new wxPanel(spltmainh);
pnlh1 ->SetBackgroundColour(wxColor(*wxWHITE));
//pnlh2 ->SetBackgroundColor(wxColor(*wxRED));
spltmainv ->SplitHorizontally(spltmainh ,pnlv);
spltmainh ->SplitVertically(pnlh1 ,pnlh2);

Upvotes: 2

vasanth kumar
vasanth kumar

Reputation: 520

enter image description here

Above link is a screenshot of my Resource Flow chart.I used 2 SplitterWindow inside a SplitterWindow.

Below link is a screenshot of my Output Window. enter image description here

This is a Frame Based Windows Application Using wxWidgets 2.8.12 in CodeBlocks 12.11.

AppWindow = new wxBoxSizer(wxVERTICAL);
AppWindow->Add(AppRibbonPane, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 0);

AppMainPane = new wxBoxSizer(wxVERTICAL);

AppMiddlePane = new wxSplitterWindow(this, ID_SPLITTERWINDOW1, wxPoint(0, 20), wxSize(800, 580), wxSP_3D, _T("ID_SPLITTERWINDOW1"));
AppMiddlePane->SetMinSize(wxSize(20, 20));
AppMiddlePane->SetMaxSize(wxSize(-1, -1));
AppMiddlePane->SetToolTip(_("Work Area"));
AppMiddlePane->SetMinimumPaneSize(20);
AppMiddlePane->SetSashGravity(0);

SplitterWindow1 = new wxSplitterWindow(AppMiddlePane, ID_SPLITTERWINDOW2, wxPoint(0, 0), wxSize(200, 580), wxSP_3D, _T("ID_SPLITTERWINDOW2"));
SplitterWindow1->SetMinSize(wxSize(10, 10));
SplitterWindow1->SetMaxSize(wxSize(-1, -1));
SplitterWindow1->SetMinimumPaneSize(10);
SplitterWindow1->SetSashGravity(0);

AuiNotebook1 = new wxAuiNotebook(SplitterWindow1, ID_AUINOTEBOOK1, wxPoint(0, 0), wxSize(200, 290), wxAUI_NB_DEFAULT_STYLE | wxDOUBLE_BORDER);
AuiNotebook1->SetMinSize(wxSize(-1, 40));
AuiNotebook1->SetMaxSize(wxSize(800, 580));

ListCtrl1 = new wxListCtrl(AuiNotebook1, ID_LISTCTRL1, wxDefaultPosition, wxSize(200, 290), wxLC_SMALL_ICON | wxLC_ALIGN_LEFT | wxLC_AUTOARRANGE | wxLC_SINGLE_SEL, wxDefaultValidator, _T("ID_LISTCTRL1"));
ListCtrl1->SetMinSize(wxSize(-1, 40));
ListCtrl1->SetBackgroundColour(wxColour(240, 255, 210));
ListCtrl2 = new wxListCtrl(AuiNotebook1, ID_LISTCTRL2, wxDefaultPosition, wxSize(200, 290), wxLC_SMALL_ICON | wxLC_ALIGN_LEFT | wxLC_AUTOARRANGE, wxDefaultValidator, _T("ID_LISTCTRL2"));
ListCtrl2->SetMinSize(wxSize(-1, 40));
ListCtrl2->SetBackgroundColour(wxColour(240, 255, 210));

AuiNotebook1->AddPage(ListCtrl1, _("Devices"), false,
                      wxBitmap(wxImage(_T("C:\\Projects\\Matesnap\\Logo\\MateSnap logo 22x19.jpg"))));

AuiNotebook1->AddPage(ListCtrl2, _("Macros"), false,
                      wxBitmap(wxImage(_T("C:\\Projects\\Matesnap\\Logo\\MateSnap logo 22x19.jpg"))));

SplitterWindow2 = new wxSplitterWindow(SplitterWindow1, ID_SPLITTERWINDOW3, wxPoint(0, 0),
                                       wxSize(200, 290), wxSP_3D, _T("ID_SPLITTERWINDOW3"));

SplitterWindow2->SetMinSize(wxSize(10, 10));
SplitterWindow2->SetMinimumPaneSize(10);
SplitterWindow2->SetSashGravity(0);

StaticText1 = new wxStaticText(SplitterWindow2, ID_STATICTEXT1, _("Actions"), wxPoint(0, 0), wxSize(200, 20), wxALIGN_CENTRE | wxDOUBLE_BORDER, _T("ID_STATICTEXT1"));
StaticText1->SetBackgroundColour(wxColour(240, 255, 210));

ListCtrl3 = new wxListCtrl(SplitterWindow2, ID_LISTCTRL3, wxPoint(0, 20), wxSize(200, 270), wxLC_SMALL_ICON | wxLC_ALIGN_LEFT | wxLC_AUTOARRANGE, wxDefaultValidator, _T("ID_LISTCTRL3"));
ListCtrl3->SetBackgroundColour(wxColour(240, 255, 210));

Please have a look at it even though you got the solution since it might be useful in your future projects.It might help you a lot.

Upvotes: 0

Related Questions