From a4190c35493a50641014af1b2ec2c13638e49f41 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Tue, 8 Mar 2011 23:52:24 +0100 Subject: Added a tab scrolling system in tabarea. Currently working on the chat window. Resolves: Mana-Mantis #308. Reviewed-by: Thorbjorn. --- src/gui/widgets/tabbedarea.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/gui/widgets/tabbedarea.h') diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index aff47929d..e5a00e277 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -28,6 +28,8 @@ #include #include +#include "gui/widgets/button.h" + #include #ifdef __GNUC__ @@ -119,12 +121,53 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener void moveRight(gcn::Tab *tab); */ + void adjustTabPositions(); + + void action(const gcn::ActionEvent& actionEvent); + // Inherited from MouseListener void mousePressed(gcn::MouseEvent &mouseEvent); private: typedef std::vector< std::pair > TabContainer; + + /** The tab arrows */ + gcn::Button *mArrowButton[2]; + + /** Check whether the arrow should be clickable */ + void updateArrowEnableState(); + + /** + * Update the overall width of all tab. Used to know whether the arrows + * have to be drawn or not. + */ + void updateTabsWidth(); + + /** + * The overall width of all tab. + */ + int mTabsWidth; + + /** + * Update the overall width of visible tab. Used to know whether + * the arrows have to be enable or not. + */ + void updateVisibleTabsWidth(); + + /** + * The overall width of visible tab. + */ + int mVisibleTabsWidth; + + + /** + * The tab scroll index. When scrolling with the arrows, the tabs + * must be displayed according to the current index. + * So the first tab displayed may not be the first in the list. + * @note the index must start at 0. + */ + unsigned mTabScrollIndex; }; #endif -- cgit v1.2.3-60-g2f50