-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenioTabView.h
93 lines (63 loc) · 2.07 KB
/
GenioTabView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright 2024, Andrea Anzani <andrea.anzani@gmail.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#pragma once
#include <SupportDefs.h>
#include <TabView.h>
#include <cstdio>
#include <map>
#include "Draggable.h"
class GTab;
typedef uint32 tab_drag_affinity;
typedef uint32 tab_id;
typedef std::map<uint32, BTab*> IdMap;
class GenioTabView : public BTabView, private Draggable {
public:
GenioTabView(const char* name,
tab_drag_affinity affinity,
orientation orientation = B_HORIZONTAL,
bool withCloseButtons = false);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
virtual void MessageReceived(BMessage* msg);
virtual void FrameResized(float newWidth, float newHeight);
//
// virtual BSize MaxSize();
// virtual BSize MinSize();
// virtual BSize PreferredSize();
void AddTab(BView* target, tab_id id);
BTab* TabFromView(BView* view) const;
void SelectTab(tab_id id);
bool HasTab(tab_id id);
virtual BRect TabFrame(int32 index) const;
void DebugFrame();
void ScrollBy(float y);
private:
using BTabView::TabAt;
using BTabView::Select;
using BTabView::AddTab;
BTab* RemoveTab(int32 tabIndex);
BView* ContainerView() const = delete;
BView* ViewForTab(int32 tabIndex) const = delete;
void _AddTab(GTab* tab);
//virtual void AddTab(BView* target, BTab* tab);
virtual BRect DrawTabs();
void MoveTabs(uint32 from, uint32 to, GenioTabView* fromTabView);
bool InitiateDrag(BPoint where);
void _OnDrop(BMessage* msg);
int32 _TabAt(BPoint where);
BTab* _TabFromPoint(BPoint where, int32& index);
void _DrawTabIndicator();
bool _ValidDragAndDrop(const BMessage* msg, bool* sameTabView = nullptr);
void _ChangeGroupViewDirection(GTab* tab);
void _PrintMap();
BRect fDropTargetHighlightFrame;
tab_drag_affinity fTabAffinity;
orientation fOrientation;
IdMap fTabIdMap;
bool fWithCloseButtons;
float fScrollByY;
};