Custom CEGUI Component inheriting from ImageComponent

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

thk123
Just popping in
Just popping in
Posts: 2
Joined: Thu Dec 22, 2011 18:07

Custom CEGUI Component inheriting from ImageComponent

Postby thk123 » Thu Dec 22, 2011 18:15

Hi, I am writing a custom CEGUI component to present theora video. I am having a problem with what I inherit from.

The way I have got video on to a CEGUI control before was by using the Image CEGUI component and using setProperty("Image", ...). My aim was to continue using this.

My problem is I am not sure what to inherit from in my class to let my component be based on this component. Clearly it isn't CEGUI::Image as this isn't a component. When I use CEGUI::Window I can do all the stuff I need to like addProperty calls and casting the class to a PropertyReciever. However, when I try to set the image property, it says it cannot find property Image (unsurprisingly).

However, if I use ImageryComponent (what I assume the Image control is), then I can't cast it to a PropertyReciever, do addProperty calls etc. because it doesn't inherit from Window.

My question is, is there a class I can inherit from that inherits from Window but has the Image property already. If not, will I need to reimplement the image control or is there a shortcut?

Thanks,
Thomas

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

Re: Custom CEGUI Component inheriting from ImageComponent

Postby CrazyEddie » Fri Dec 23, 2011 08:50

Your post is not clear on exactly why you want to inherit an existing component, nor precisely what you wish to do with it. This is not to say that you should not go that route, but rather that it makes answering the post difficult, since there are parts of the post which seem confusing and contradictory to me. You state that you've used the Image property in the past to put video onto a component, wish to continue doing that, but then there's all this stuff about inheriting which makes no sense to me given the earlier statement :?

ImageryComponent is the 'code side' object that corresponds to the <ImageryComponent> tag used in the looknfeel XML files, likely does not do what you think it does and is not easily expanded within the system unless you intend specifying an entire WidgetLook in code.

There is no stock Window based class that adds an 'Image' property, but rather those more specialised properties come from some WindowRenderer subclass that is mapped along with a Window subclass in the scheme file to define the final Window / widget types that get created (such as "TaharezLook/StaticImage", this combines the DefaultWindow with the StaticImage WindowRenderer to give the final behavior).

CE.

thk123
Just popping in
Just popping in
Posts: 2
Joined: Thu Dec 22, 2011 18:07

Re: Custom CEGUI Component inheriting from ImageComponent

Postby thk123 » Fri Dec 23, 2011 10:19

Originally, I just had an ImageryComponent in my layout file and I was using the setProperty on that. However, I am trying to modify my code so that I just have a TheoraVideo component that can be entered in to the layout file. Sorry for the confusion, hopefully that makes it a bit clearer.

So, just to check I understand, in a scheme file, I would define my video component by setting the TargetType to be my class (which will inherit from window) but then also Renderer to be ImageryComponent?

Thanks


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 2 guests