Stopping my own mouseover events when CEGUI has one

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
pokemoen
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu Mar 10, 2005 10:55
Contact:

Stopping my own mouseover events when CEGUI has one

Postby pokemoen » Fri Sep 16, 2005 13:50

Hello,

I'd like to stop handling my own mouseover events when the mouse is over a CEGUI widget. I'm aware of the screenToWindow and windowToScreen functions which could be used to create certain zones which, when the mouse is over them, could stop my own mouseover checks. But that isn't the most desireable solution I think, and might get hairy when dialogboxes appear and stuff..

Also I thought of stopping my mouseover-checks whenever the mouseover bool of a widget becomes true, but this would involve having eventhandlers for every single widget and isn't good performance-wise I think...

Any suggestions/ideas? Does CEGUI have a "mouseOverAnyWidget" bool built-in that I don't know of?

Thanks in advance,
Alex

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Stopping my own mouseover events when CEGUI has one

Postby lindquist » Fri Sep 16, 2005 14:56

take a look at

Code: Select all

CEGUI::System::getWindowContainingMouse

User avatar
pokemoen
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu Mar 10, 2005 10:55
Contact:

Re: Stopping my own mouseover events when CEGUI has one

Postby pokemoen » Sun Sep 18, 2005 22:45

Thanks for the good tip!
Having some probs though, my func only returns true for a combobox I have, the rest of my controls don't...
Here's my code:

Code: Select all

bool SWCCG_GUI::isMouseOverGui(float const& x, float const& y){
   using namespace CEGUI;
   Window* mouseOverWin = System::getSingleton().getWindowContainingMouse();
   CEGUI::String type = mouseOverWin->getType();
   if(type == ((utf8*)"DefaultWindow")) return false;
   const char* type_c = type.c_str();   // For testing
   Rect mouseOverWinRect = mouseOverWin->getRect();
   mouseOverWinRect = mouseOverWin->windowToScreen(mouseOverWinRect);   
   Point* mousePos = new Point(x, (0-y)+600);
   if( mouseOverWin == NULL || !mouseOverWinRect.isPointInRect(*mousePos) ){
      return false;
   } else {
      return true;
   }
}


Blurry suspicions: Other controls recognized as DefaultWindow? Origin at bottomleft to topleft conversion? Quick pointer-hack on mousePos?

Thanks,
Alex

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

Re: Stopping my own mouseover events when CEGUI has one

Postby CrazyEddie » Mon Sep 19, 2005 09:15

DefaultWindow is the only Window that will return "DefaultWindow" as its type.

The origin for all windows is the top-left.

Your mouseOverWin->getRect() call is probably returning relative co-ords which should be converted to absolute values prior to converting to screen values.

User avatar
pokemoen
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu Mar 10, 2005 10:55
Contact:

Re: Stopping my own mouseover events when CEGUI has one

Postby pokemoen » Mon Sep 19, 2005 11:09

The values in the rect correspond with the screenpositions of the widget pretty much exactly.
I added "mouseOverWinRect = mouseOverWin->relativeToAbsolute(mouseOverWinRect);" just for the heck of it and there's no change in the behaviour... Only widgets of type "TaharezLook/Combobox" return true.
Any other ideas? I find it hard to debug this somehow..

TIA
Alex

User avatar
pokemoen
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu Mar 10, 2005 10:55
Contact:

Re: Stopping my own mouseover events when CEGUI has one

Postby pokemoen » Fri Sep 23, 2005 11:56

Okay, I ditched the doublecheck and now trust CEGUI solely... :/
Here's my code :)

Code: Select all

bool SWCCG_GUI::isMouseOverGui(float const& x, float const& y){
   using namespace CEGUI;
   Window* mouseOverWin = System::getSingleton().getWindowContainingMouse();
   if (mouseOverWin == NULL) return false;
   CEGUI::String type = mouseOverWin->getType();
   if(type == ((utf8*)"DefaultWindow")) {
      return false;
   } else {
      return true;
   }
}

And that seems to work good enough..

Tnx!
Ltr,
Alex

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

Re: Stopping my own mouseover events when CEGUI has one

Postby CrazyEddie » Sun Sep 25, 2005 08:44

You can always trust cegui ;)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 1 guest