1 /* 2 * Copyright 2007-2009, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stefano Ceccherini (burton666@libero.it) 7 */ 8 #ifndef SMART_TAB_VIEW_H 9 #define SMART_TAB_VIEW_H 10 11 12 #include <TabView.h> 13 14 15 class BPopUpMenu; 16 class BScrollView; 17 18 19 class SmartTabView : public BTabView { 20 public: 21 SmartTabView(BRect frame, const char* name, 22 button_width width = B_WIDTH_AS_USUAL, 23 uint32 resizingMode = B_FOLLOW_ALL, 24 uint32 flags = B_FULL_UPDATE_ON_RESIZE 25 | B_WILL_DRAW | B_NAVIGABLE_JUMP 26 | B_FRAME_EVENTS | B_NAVIGABLE); 27 SmartTabView(const char* name, 28 button_width width = B_WIDTH_AS_USUAL, 29 uint32 flags = B_FULL_UPDATE_ON_RESIZE 30 | B_WILL_DRAW | B_NAVIGABLE_JUMP 31 | B_FRAME_EVENTS | B_NAVIGABLE 32 | B_SUPPORTS_LAYOUT); 33 virtual ~SmartTabView(); 34 35 void SetInsets(float left, float top, float right, 36 float bottom); 37 38 virtual void MouseDown(BPoint where); 39 40 virtual void AttachedToWindow(); 41 virtual void AllAttached(); 42 43 virtual void MessageReceived(BMessage* message); 44 45 virtual void Select(int32 tab); 46 47 virtual void RemoveAndDeleteTab(int32 index); 48 49 virtual void AddTab(BView* target, BTab* tab = NULL); 50 virtual BTab* RemoveTab(int32 index); 51 52 virtual BRect DrawTabs(); 53 54 void SetScrollView(BScrollView* scrollView); 55 56 private: 57 int32 _ClickedTabIndex(const BPoint& point); 58 59 private: 60 BRect fInsets; 61 BScrollView* fScrollView; 62 }; 63 64 #endif // SMART_TAB_VIEW_H 65