How to clip the child windows with given rect

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

zaexage
Just popping in
Just popping in
Posts: 15
Joined: Wed Mar 02, 2011 02:43

How to clip the child windows with given rect

Postby zaexage » Thu Jun 30, 2011 10:48

Hi, all
I'm making a UI control that kind of like the GridLayoutContainer, but it could make constraints on the width/height of some columns or rows.
When the size of the cell is determined by client's specified value, I wanna clip the child window inside the cell.
My question is how to clip the a child window with the area of the cell it resides in. Or in another word, how to clip children windows with a given Rect?

I don't quite want to change the size of the children windows, by which I will have to remember the original size of them in case of the re-layouting.

Thanks in advance.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: How to clip the child windows with given rect

Postby Kulik » Mon Jul 04, 2011 17:17

I don't think this is possible without custom a window renderer.

As a workaround you could put them into a fake window that would represent the rect and make them "ClippedByParent".

zaexage
Just popping in
Just popping in
Posts: 15
Joined: Wed Mar 02, 2011 02:43

Re: How to clip the child windows with given rect

Postby zaexage » Wed Jul 06, 2011 02:21

I do have written a WindowRenderer (but it is just for rendering separator & frame anyway), how can i use it to clip the children windows?

I'm thinking about using GeometryBuffer::setClippingRegion for this task. Is it a viable method?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: How to clip the child windows with given rect

Postby Kulik » Wed Jul 06, 2011 14:08

This can be done (I think) but you have to have a special renderer for all children and that renderer will merge the clip rect with your rect. I think the easiest solution is to use a dummy wrapper default window that will clip children to itself.

zaexage
Just popping in
Just popping in
Posts: 15
Joined: Wed Mar 02, 2011 02:43

Re: How to clip the child windows with given rect

Postby zaexage » Thu Jul 07, 2011 01:16

I tried SetClippingRegion and it does work, but the hitTest still failed, I think maybe this method needs a hack to add setUnclippedRect to CEGUI::Window...

Anyway, I think your method should be better. :)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests