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