Page 1 of 1

wxAccordion - an accordion control

Posted: Mon Oct 12, 2015 6:54 am
by New Pagodi
In case anyone wants to make to make their programs feel like an annoying webpage, I've written an accordion control. I derived it wxBookCtrlBase, so if you know how to use wxNotebook, you should be able to use this as well. The code is a little more than can easily be dumped here, but you can get a zip file on my github page. Here are a few examples:

Image

I wanted this to be simple but highly customizable. But that's not an easy balance to maintain and I ended up with over 100 methods. However, it's mostly the same 15 commands repeated several times for different pieces of the control. There's a doxyfile to generate documentation. I tried to make it look like the wxWidgets documentation, but there were a few things I couldn't figure out. There are also 3 samples. A basic sample shows how to set a few things and add stuff to the control. An extended sample explores more of its capabilities. And finally, a builder sample uses a property grid to set an accordion's properties and can generate c++ code to make an accordion with those properties.

Any suggestions or spelling/grammar/phrasing corrections for the documentation would be appreciated.

Re: wxAccordion - an accordion control

Posted: Mon Oct 12, 2015 9:44 am
by doublemax
Very nice, thanks.

To reduce the number of methods, i think you should introduce a new class, e.g. wxAccordionCaptionStyle. You would have one instance for each state. That would also have the advantage that you could copy a style and modify it, as many styles will have attributes that are identical to the other styles.

Re: wxAccordion - an accordion control

Posted: Tue Oct 13, 2015 11:43 pm
by New Pagodi
Thanks for the suggestion. I just did that.

Also I just learned how to host doxygen documentation on github. If anyone is interested, the documentation is available here.

Re: wxAccordion - an accordion control

Posted: Wed Oct 14, 2015 11:55 am
by iwbnwif
Thank you, a very nice control and very nice documentation :)

I would like to suggest creating an entry on the wxCode page if possible, and maybe also add a note to the foldbar entry?

Re: wxAccordion - an accordion control

Posted: Wed Oct 14, 2015 10:55 pm
by yasriady
Very good control, nice looking and well documentation..
Anyway, could you add Makefile to build both source lib and examples? Due to not all of users able to build the control without complete guidance.

Re: wxAccordion - an accordion control

Posted: Fri Oct 16, 2015 4:28 am
by New Pagodi
I don't really know how to make build files, so I used the wxCode bakefiles to generate a set of build files. I hope they work, but I've only tested them with visualc with monlithic-shared and multilib-static configurations.

Since the bakefiles were from the wxCode project, they stick a "wxcode-" in front of the library name. Sorry if that confuses anyone.

Re: wxAccordion - an accordion control

Posted: Fri Oct 16, 2015 5:48 pm
by evstevemd
Great Control. Thanks!
New Pagodi wrote:I don't really know how to make build files, so I used the wxCode bakefiles to generate a set of build files. I hope they work, but I've only tested them with visualc with monlithic-shared and multilib-static configurations.

Since the bakefiles were from the wxCode project, they stick a "wxcode-" in front of the library name. Sorry if that confuses anyone.
I think bakefile isn't good option. I had same question and I went with CMake. Very easy to follow from their tutorial.
You can seem some reasoning to avoid Bakefile in this link:
https://github.com/mtangoo/wxDatabase/issues/2