1/* 2 * Copyright (C) 2010 Stephan A��mus <superstippi@gmx.de> 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6#ifndef TAB_MANAGER_H 7#define TAB_MANAGER_H 8 9#include <Messenger.h> 10#include <TabView.h> 11 12enum { 13 TAB_CHANGED = 'tcha', 14 CLOSE_TAB = 'cltb' 15}; 16 17class BBitmap; 18class BCardLayout; 19class BGroupView; 20class BGroupLayout; 21class BMenu; 22class TabContainerGroup; 23class TabContainerView; 24class TabManagerController; 25 26#define INTEGRATE_MENU_INTO_TAB_BAR 0 27 28 29class TabManager { 30public: 31 TabManager(const BMessenger& target, 32 BMessage* newTabMessage); 33 virtual ~TabManager(); 34 35 void SetTarget(const BMessenger& target); 36 const BMessenger& Target() const; 37 38#if INTEGRATE_MENU_INTO_TAB_BAR 39 BGroupLayout* MenuContainerLayout() const; 40#endif 41 42 BView* TabGroup() const; 43 BView* GetTabContainerView() const; 44 BView* ContainerView() const; 45 46 BView* ViewForTab(int32 tabIndex) const; 47 int32 TabForView(const BView* containedView) const; 48 bool HasView(const BView* containedView) const; 49 50 void SelectTab(int32 tabIndex); 51 void SelectTab(const BView* containedView); 52 int32 SelectedTabIndex() const; 53 void CloseTab(int32 tabIndex); 54 55 void AddTab(BView* view, const char* label, 56 int32 index = -1); 57 BView* RemoveTab(int32 index); 58 int32 CountTabs() const; 59 60 void SetTabLabel(int32 tabIndex, const char* label); 61 const BString& TabLabel(int32); 62 void SetTabIcon(const BView* containedView, 63 const BBitmap* icon); 64 void SetCloseButtonsAvailable(bool available); 65 66private: 67#if INTEGRATE_MENU_INTO_TAB_BAR 68 BGroupView* fMenuContainer; 69#endif 70 TabContainerGroup* fTabContainerGroup; 71 TabContainerView* fTabContainerView; 72 BView* fContainerView; 73 BCardLayout* fCardLayout; 74 TabManagerController* fController; 75 76 BMessenger fTarget; 77}; 78 79#endif // TAB_MANAGER_H 80