[Fix] Fixed issue with tooltips not disappearing.
This commit is contained in:
		
							parent
							
								
									fecd2866f5
								
							
						
					
					
						commit
						c3f8582aa0
					
				| @ -3,6 +3,17 @@ | ||||
| 
 | ||||
| namespace Gui { | ||||
| 
 | ||||
| Container::Container(void) { | ||||
|   onMouseLeave.connect(sigc::mem_fun(this, &Container::_OnMouseLeave)); | ||||
| } | ||||
| 
 | ||||
| void Container::_OnMouseLeave(void) { | ||||
|   for(std::list<widget_pos>::iterator i = m_children.begin(); i != m_children.end(); ++i) { | ||||
|     if((*i).w->IsMouseOver() == true) | ||||
|       (*i).w->OnMouseLeave(); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| bool Container::OnMouseMotion(MouseMotionEvent* e) { | ||||
|   float x = e->x; | ||||
|   float y = e->y; | ||||
|  | ||||
| @ -7,6 +7,7 @@ | ||||
| namespace Gui { | ||||
|   class Container : public Widget { | ||||
|   public: | ||||
|     Container(void); | ||||
|     bool OnMouseDown(MouseButtonEvent* e); | ||||
|     bool OnMouseUp(MouseButtonEvent* e); | ||||
|     bool OnMouseMotion(MouseMotionEvent* e); | ||||
| @ -15,6 +16,7 @@ namespace Gui { | ||||
|     virtual void ShowAll(void); | ||||
|     virtual void HideAll(void); | ||||
|   private: | ||||
|     void _OnMouseLeave(void); | ||||
|     bool HandleMouseEvent(MouseButtonEvent* e); | ||||
|   protected: | ||||
|     void PrependChild(Widget* w, float x, float y); | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
| 
 | ||||
| namespace Gui { | ||||
| 
 | ||||
| Fixed::Fixed(float w, float h) { | ||||
| Fixed::Fixed(float w, float h): Container() { | ||||
|   SetSize(w, h); | ||||
|   memcpy(m_bgcol, Color::bg, 3*sizeof(float)); | ||||
|   m_w = w; m_h = h; | ||||
|  | ||||
| @ -37,6 +37,7 @@ void Widget::GetAbsolutePosition(float pos[2]) { | ||||
| void Widget::OnMouseEnter(void) { | ||||
|   m_mouseOver = true; | ||||
|   Gui::AddTimer(1000, &m_tooltipTimerSignal); | ||||
|   onMouseEnter.emit(); | ||||
| } | ||||
| 
 | ||||
| void Widget::OnMouseLeave(void) { | ||||
| @ -46,6 +47,7 @@ void Widget::OnMouseLeave(void) { | ||||
|     m_tooltipWidget = 0; | ||||
|   } | ||||
|   Gui::RemoveTimer(&m_tooltipTimerSignal); | ||||
|   onMouseLeave.emit(); | ||||
| } | ||||
| 
 | ||||
| void Widget::UpdateOverriddenTooltip(void) { | ||||
|  | ||||
| @ -44,6 +44,9 @@ namespace Gui { | ||||
|       EVENT_ALL         = 0xffffffff | ||||
|     }; | ||||
|     unsigned int GetEventMask(void)   { return m_eventMask; } | ||||
| 
 | ||||
|     sigc::signal<void> onMouseEnter; | ||||
|     sigc::signal<void> onMouseLeave; | ||||
|   protected: | ||||
|     unsigned int m_eventMask; | ||||
|     struct { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rtch90
						Rtch90