wxAccordion - an accordion control

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Post Reply
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

wxAccordion - an accordion control

Post 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.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxAccordion - an accordion control

Post 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.
Use the source, Luke!
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxAccordion - an accordion control

Post 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.
iwbnwif
Super wx Problem Solver
Super wx Problem Solver
Posts: 282
Joined: Tue Mar 19, 2013 8:52 pm

Re: wxAccordion - an accordion control

Post 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?
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
User avatar
yasriady
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Apr 28, 2014 5:17 am

Re: wxAccordion - an accordion control

Post 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.
wxWidgets Journal at http://yasriady.blogspot.com
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxAccordion - an accordion control

Post 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.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxAccordion - an accordion control

Post 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
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Post Reply