Setting a buttons images

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

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Setting a buttons images

Postby CrazyEddie » Thu Jul 22, 2004 12:25

Im trying to fashion a basic tab header out of a custom ListHeader. I have two questions on this:

1) Is there a way to tell which list header column is currently selected, if any, out of all the columns? Would I be able to track this using the sort functionality (even though Im not interested in actually sorting anything)?

Yes, this is exactly the approach that you need to take.

2) ListHeader Images - how do I set my own custom ones? I.e. Hover and normal. I tried going down the same route as what I did for the pushbutton, but couldnt get it to work. Is the ListHeader made up of TLButton's under the hood?

Unfortunately not :( The ListHeader is made up of ListHeaderSegment objects (more specifically TLListHeaderSegments for Taharez Look) which, at the moment anyway, do not derive from the button classes (even though this would have been an acceptable design choice).

There are currently only really two ways to change the appearance of this widget:
1) Edit the Taharez 'layout.tga' file - which will only offer limited scope (especially for this widget), and obviously will affect the 'real' list header.

2) Create your own derived widget types for the list header and segments... :shock: Not that bad actually, read on ;) The ListHeaderSegment derived class is very simple; just needs a constructor and two rendering methods (for normal and hover). The ListHeader itself has an (optionally) emtpy rendering method, and methods to create and return an object of the segment type, and finally a method to destroy a segment object (typically these two methods are only a single line). If you need the ability to modify the images used, then you'll need some supoort methods for that. Additionally you need the factory classes for the new derived widgets (cut & paste is your friend ;)). This probably all sounds like a lot of work but it's really not :) If you decide to take this approach, I'm willing to assist in virtually any way I can :)

I'll mention again that eventually I'll offer some classes which can read all the required imagery layout from an XML file, thus removing the need to code new classes for 95% of cases, but this will be a while yet...

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Setting a buttons images

Postby spannerman » Thu Jul 22, 2004 23:40

Cool. Ok cheers, ummm, I think I'll go for number 1.

hehe only joking, yeah I'll give it a go and try create some derived widget types. I'll be back here soon enough with some questions, no doubt :P

User avatar
pratty70
Just popping in
Just popping in
Posts: 1
Joined: Wed Jan 12, 2005 12:06

Setting a buttons images

Postby pratty70 » Thu Dec 30, 2004 16:02

Hi,

Have been looking around the forums for the way to have a custom image per button. This is the nearest thread to it as far as I see. I was wondering if anything has been included since this time to allow for custom bitmaps on buttons (either instead of text) or to change the whole button. I want to use the power of mk2 and be able to switch between using taharez and windows look dynamically and not have to include specific headers for either look.

Maybe I've missed something somewhere, but I've only been looking into to upgrading my Ogre based app to CEGUI from native built in GUI elements.

So far, looks really powerfull - except I need buttons with images and not text.

Many thanks for any help you can give.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Setting a buttons images

Postby CrazyEddie » Sun Jan 02, 2005 11:31

I had said (in this thread IIRC) that I would probably bump this functionality into the base class (whcih is what you're after); well I have not yet gotten around to doing this.

I'll see if I can get to this very soon.

User avatar
rincewind
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06

Setting a buttons images

Postby rincewind » Thu Jan 06, 2005 12:15

For the Taharez buttons, you can use properties to set the image. This works both from code and XML.

NormalImage, PushedImage, HoverImage, should be fairly clear. Syntax is the same as for image for StaticImage

You also have to set UseStandardImagery to False in order for this to work.

Greetings,

Rincewind


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 16 guests