Example for deriving from ListboxItem?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

cyberjunk
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Fri Jan 17, 2014 02:39

Example for deriving from ListboxItem?

Postby cyberjunk » Wed Jan 22, 2014 17:13

Dear readers,

I've already figured out how to create a fully customized ItemEntry with all kind of combined childwindows for use in ItemListbox, the wiki example for the checkbox was quite helpful.
It was confusing with both these Listbox types and their different itemtypes at first, but I'm past that confustion now :-)

Now I'm trying to figure out how to create a custom ListboxItem (like ListboxTextItem) for use in Listbox and MultiColumnList.
It seems to me this variant is quite more low-level implented, e.g. there is no easy way to just "reuse" or attach existing child widgets (checkboxes, editboxes, ..) to it, right?

I've gone through the code of ListboxItem and ListboxTextItem and I've created my own class deriving from ListboxItem.
I had to at least implement the abstract methods draw(...) and getPixelSize().
Now my code compiles but I'm a bit stuck how to implement the mentioned methods correctly to show up a checkbox, an image, an editbox and so on and to make them even interactable to the user.

Is there any example how to create a more custom ListboxItem for ListBox/MultiColumnList?
It makes me sad to see this wonderful MultiColumnList widget being stuck with just the simple ListboxTextItem :-(

Thanks.

PS: I know I can use the embedded tagging to show up an image in a MultiColumnList cell, but I'd like to have more than just images.

Here's a list with forum threads more or less linked to this topic:
viewtopic.php?f=2&t=6233&p=29529&hilit=ListboxItem#p29529
viewtopic.php?f=2&t=4762&p=22527&hilit=ListboxItem#p22527
viewtopic.php?f=2&t=4574&p=21412&hilit=ListboxItem#p21412
viewtopic.php?f=2&t=4208&p=19364&hilit=ListboxItem#p19364
viewtopic.php?f=2&t=3885&p=17757&hilit=ListboxItem#p17757
viewtopic.php?f=2&t=3656&p=16468&hilit=ListboxItem#p16468
viewtopic.php?f=2&t=1146&p=6320&hilit=ListboxItem#p6320
viewtopic.php?f=2&t=770&p=4495&hilit=ListboxItem#p4495
viewtopic.php?f=2&t=567&p=3609&hilit=ListboxItem#p3609

User avatar
Ident
CEGUI Team
Posts: 1836
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Example for deriving from ListboxItem?

Postby Ident » Fri Jan 24, 2014 06:09

We are aware of the problem of having those different classes of items... an optimal solution would be to only use one type of class ( and its derivatives like the -Text- version) for lists. However, none of us has yet started changing this. If you want to you can try to add the necessary changes yourself, and adapt the existing widgets to all use an improved unified item class (ItemEntry is the latest class i think), we can then try to integrate it into CEGUI if it meets the code conventions and works flawlessly.

Now to help you with your request: ItemEntry allows adding children. ListboxItem doesn't and i do not think it is currently possible to add windows to it.
CrazyEddie: "I don't like GUIs"

cyberjunk
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Fri Jan 17, 2014 02:39

Re: Example for deriving from ListboxItem?

Postby cyberjunk » Fri Jan 24, 2014 17:41

ItemEntry allows adding children. ListboxItem doesn't and i do not think it is currently possible to add windows to it.


Yes. Using a customized ItemEntry class and ItemListbox is highly customizable and my preferred solution so far.
It allows you to define any childwindows/widgets in the ItemEntry, so you can just assemble them together from the existing window/widgettypes (buttons, labels, editboxes, ...)

Also I've figured out that in case you need a grid and you want it to have more custom cells than you get get from MultiColumnList and its ListboxTextItem:
Just use "GridLayoutContainer". It also allows adding existing/custom windows/widgets to "cells" like ItemEntry does.

It's missing few things related to the headercells of MultiColumnList (sorting/reordering) tho, but it's sufficient for my requirements...

User avatar
Ident
CEGUI Team
Posts: 1836
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Example for deriving from ListboxItem?

Postby Ident » Sat Jan 25, 2014 04:02

I am not sure what exactly it does but there is an AutoPositioning feature - I assume if you overload it you can define a custom way to position (reorder) the elements on request. But I am not 100% sure, i never use this feature.
CrazyEddie: "I don't like GUIs"


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 2 guests