2 * Copyright 2007-2010, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Stefano Ceccherini (burton666@libero.it)
7 * Ingo Weinhold (ingo_weinhold@gmx.de)
9 #ifndef SMART_TAB_VIEW_H
10 #define SMART_TAB_VIEW_H
20 class SmartTabView
: public BTabView
{
25 SmartTabView(BRect frame
, const char* name
,
26 button_width width
= B_WIDTH_AS_USUAL
,
27 uint32 resizingMode
= B_FOLLOW_ALL
,
28 uint32 flags
= B_FULL_UPDATE_ON_RESIZE
29 | B_WILL_DRAW
| B_NAVIGABLE_JUMP
30 | B_FRAME_EVENTS
| B_NAVIGABLE
);
31 SmartTabView(const char* name
,
32 button_width width
= B_WIDTH_AS_USUAL
,
33 uint32 flags
= B_FULL_UPDATE_ON_RESIZE
34 | B_WILL_DRAW
| B_NAVIGABLE_JUMP
35 | B_FRAME_EVENTS
| B_NAVIGABLE
37 virtual ~SmartTabView();
39 void SetInsets(float left
, float top
, float right
,
42 virtual void MouseDown(BPoint where
);
44 virtual void AttachedToWindow();
45 virtual void AllAttached();
47 virtual void Select(int32 tab
);
49 virtual void AddTab(BView
* target
, BTab
* tab
= NULL
);
50 virtual BTab
* RemoveTab(int32 index
);
51 void MoveTab(int32 index
, int32 newIndex
);
53 virtual BRect
DrawTabs();
55 void SetScrollView(BScrollView
* scrollView
);
57 void SetListener(Listener
* listener
)
58 { fListener
= listener
; }
61 int32
_ClickedTabIndex(const BPoint
& point
);
65 BScrollView
* fScrollView
;
70 class SmartTabView::Listener
{
74 virtual void TabSelected(SmartTabView
* tabView
, int32 index
);
75 virtual void TabDoubleClicked(SmartTabView
* tabView
,
76 BPoint point
, int32 index
);
77 virtual void TabMiddleClicked(SmartTabView
* tabView
,
78 BPoint point
, int32 index
);
79 virtual void TabRightClicked(SmartTabView
* tabView
,
80 BPoint point
, int32 index
);
84 #endif // SMART_TAB_VIEW_H