repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / webpositive / tabview / TabContainerView.h
bloba740f4ad85a530d178f734815f7ea64b07d1ed28
1 /*
2 * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
4 * All rights reserved. Distributed under the terms of the MIT License.
5 */
6 #ifndef TAB_CONTAINER_VIEW_H
7 #define TAB_CONTAINER_VIEW_H
9 #include <GroupView.h>
12 class TabView;
15 class TabContainerView : public BGroupView {
16 public:
17 class Controller {
18 public:
19 virtual void TabSelected(int32 tabIndex) = 0;
20 virtual bool HasFrames() = 0;
21 virtual TabView* CreateTabView() = 0;
22 virtual void DoubleClickOutsideTabs() = 0;
23 virtual void UpdateTabScrollability(bool canScrollLeft,
24 bool canScrollRight) = 0;
25 virtual void SetToolTip(const BString& text) = 0;
28 public:
29 TabContainerView(Controller* controller);
30 virtual ~TabContainerView();
32 virtual BSize MinSize();
34 virtual void MessageReceived(BMessage*);
36 virtual void Draw(BRect updateRect);
38 virtual void MouseDown(BPoint where);
39 virtual void MouseUp(BPoint where);
40 virtual void MouseMoved(BPoint where, uint32 transit,
41 const BMessage* dragMessage);
43 virtual void DoLayout();
45 void AddTab(const char* label, int32 index = -1);
46 void AddTab(TabView* tab, int32 index = -1);
47 TabView* RemoveTab(int32 index);
48 TabView* TabAt(int32 index) const;
50 int32 IndexOf(TabView* tab) const;
52 void SelectTab(int32 tabIndex);
53 void SelectTab(TabView* tab);
55 void SetTabLabel(int32 tabIndex, const char* label);
57 void SetFirstVisibleTabIndex(int32 index);
58 int32 FirstVisibleTabIndex() const;
59 int32 MaxFirstVisibleTabIndex() const;
61 bool CanScrollLeft() const;
62 bool CanScrollRight() const;
64 private:
65 TabView* _TabAt(const BPoint& where) const;
66 void _MouseMoved(BPoint where, uint32 transit,
67 const BMessage* dragMessage);
68 void _ValidateTabVisibility();
69 void _UpdateTabVisibility();
70 float _AvailableWidthForTabs() const;
71 void _SendFakeMouseMoved();
73 private:
74 TabView* fLastMouseEventTab;
75 bool fMouseDown;
76 uint32 fClickCount;
77 TabView* fSelectedTab;
78 Controller* fController;
79 int32 fFirstVisibleTabIndex;
82 #endif // TAB_CONTAINER_VIEW_H