diff options
author | Tametomo <irarice@gmail.com> | 2009-05-15 14:17:31 -0600 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-14 20:54:03 +0100 |
commit | 1ddc4476d74bfb61c80dd72123a94187f872dfdd (patch) | |
tree | 767b7a5a8ea2919ca68b3cb62da0ff6a59e60249 | |
parent | 9ddc6cc057798a3d6898516c76960d4a5611ba1c (diff) | |
download | Mana-1ddc4476d74bfb61c80dd72123a94187f872dfdd.tar.gz Mana-1ddc4476d74bfb61c80dd72123a94187f872dfdd.tar.bz2 Mana-1ddc4476d74bfb61c80dd72123a94187f872dfdd.tar.xz Mana-1ddc4476d74bfb61c80dd72123a94187f872dfdd.zip |
Fixed TabbedAreas stealing click focus from their children widgets.
Signed-off-by: Tametomo <irarice@gmail.com>
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 13 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 3 |
2 files changed, 16 insertions, 0 deletions
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<gcn::Tab*>(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<gcn::Tab*, gcn::Widget*> > TabContainer; }; |