Page 1 of 1

How to write Unity style grid property?

Posted: Tue Feb 16, 2016 8:44 am
by beyondlwm
QQ图片20160216164311.png (21.48 KiB) Viewed 2191 times
Two float property can be in same row. with an extra button.

Re: How to write Unity style grid property?

Posted: Tue Feb 16, 2016 10:05 pm
by New Pagodi
The closest out of the box tool included with wxWidgets is of course wxPropertyGrid. It only has 2 columns though.

Another option, although it will be a bit of a pain is to use something like the accordion control I wrote a while back. Using the builder sample, I was able to get this close:
acc.png (6.93 KiB) Viewed 2168 times
You could then add panels with a flex grid sizer or a grid bag sizer to hold the labels and the controls for changing the properties to the accordion.

Another possibility would be to use a wxGrid and add the grid to the accordion. But you'll have to set custom renderers and editors for the grid to get the checkboxes and things.

If that seems close enough for you, here is the code from the builder sample to generate the accordion above:

Code: Select all

wxAccordion* m_accordion;
m_accordion = new wxAccordion( <insert parent here> );
m_accordion->SetBackgroundColour( wxColour(56,56,56) );
m_accordion->SetExpandButton( wxBitmap("<your file here>",wxBITMAP_TYPE_ANY) );
m_accordion->SetCollapseButton( wxBitmap("<your file here>",wxBITMAP_TYPE_ANY) );
wxImageList* m_imagelist = new wxImageList(16,16);
\Add icons to the image list here.
m_accordion->GetCollapsedStyle().SetColour1( wxColour(87,87,87) );
m_accordion->GetCollapsedStyle().SetColour2( wxColour(87,87,87) );
m_accordion->GetCollapsedStyle().SetTextColour( wxColour(201,201,201) );
m_accordion->GetExpandedStyle().SetColour1( wxColour(87,87,87) );
m_accordion->GetExpandedStyle().SetColour2( wxColour(87,87,87) );
m_accordion->GetPageStyle().SetColour1( wxColour(60,60,60) );
m_accordion->GetPageStyle().SetColour2( wxColour(60,60,60) );
m_accordion->GetPageStyle().SetBorderColour( wxColour(40,40,40) );

Re: How to write Unity style grid property?

Posted: Wed Feb 17, 2016 2:21 am
by beyondlwm

The accordion control is very cool, it can resolve some of our problem for sure.
However, we have already heavily lean on property grid, so I have to find a way out in property grid.