summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/tabbedarea.cpp13
-rw-r--r--src/gui/widgets/tabbedarea.h3
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;
};