From a86324d5fb520823ecb35e828dfeccf9ac2bba81 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Apr 2012 02:42:26 +0300 Subject: By default dont switch tabs by left/right keys. --- src/gui/widgets/tabbedarea.cpp | 19 ++++++++++--------- src/gui/widgets/tabbedarea.h | 4 ++++ 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index b24ae32e5..5896af304 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -34,14 +34,15 @@ #include "debug.h" -TabbedArea::TabbedArea() - : gcn::TabbedArea(), - mTabsWidth(0), - mVisibleTabsWidth(0), - mTabScrollIndex(0), - mEnableScrollButtons(false), - mRightMargin(0), - mFollowDownScroll(false) +TabbedArea::TabbedArea() : + gcn::TabbedArea(), + mTabsWidth(0), + mVisibleTabsWidth(0), + mTabScrollIndex(0), + mEnableScrollButtons(false), + mRightMargin(0), + mFollowDownScroll(false), + mBlockSwitching(true) { mWidgetContainer->setOpaque(false); addWidgetListener(this); @@ -482,7 +483,7 @@ void TabbedArea::removeAll() void TabbedArea::keyPressed(gcn::KeyEvent& keyEvent) { - if (keyEvent.isConsumed() || !isFocused()) + if (mBlockSwitching || keyEvent.isConsumed() || !isFocused()) return; int actionId = static_cast(&keyEvent)->getActionId(); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index c36a3ab1d..85209691b 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -150,6 +150,9 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener void keyPressed(gcn::KeyEvent& keyEvent); + void setBlockSwitching(bool b) + { mBlockSwitching = b; } + private: typedef std::vector< std::pair > TabContainer; @@ -193,6 +196,7 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener bool mEnableScrollButtons; int mRightMargin; bool mFollowDownScroll; + bool mBlockSwitching; }; #endif -- cgit v1.2.3-70-g09d2