From 1ddc4476d74bfb61c80dd72123a94187f872dfdd Mon Sep 17 00:00:00 2001 From: Tametomo Date: Fri, 15 May 2009 14:17:31 -0600 Subject: Fixed TabbedAreas stealing click focus from their children widgets. Signed-off-by: Tametomo --- src/gui/widgets/tabbedarea.cpp | 13 +++++++++++++ src/gui/widgets/tabbedarea.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index c0d070cf..970a5cb1 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -156,6 +156,19 @@ void TabbedArea::logic() logicChildren(); } +void TabbedArea::mousePressed(gcn::MouseEvent &mouseEvent) +{ + if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + { + gcn::Widget *widget = mTabContainer->getWidgetAt(mouseEvent.getX(), + mouseEvent.getY()); + gcn::Tab *tab = dynamic_cast(widget); + + if (tab) + setSelectedTab(tab); + } +} + void TabbedArea::setSelectedTab(gcn::Tab *tab) { gcn::TabbedArea::setSelectedTab(tab); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index d2344e13..7d2b649b 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -107,6 +107,9 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener void widgetResized(const gcn::Event &event); + // Inherited from MouseListener + + void mousePressed(gcn::MouseEvent &mouseEvent); private: typedef std::vector< std::pair > TabContainer; }; -- cgit v1.2.3-70-g09d2