Maki
Formally verified low-code orchestration
Toggle main menu visibility
Loading...
Searching...
No Matches
editor_workspace.h
1
#pragma once
2
3
#include <QHash>
4
#include <QIcon>
5
#include <QMimeData>
6
#include <QPointer>
7
#include <QTabBar>
8
#include <QTabWidget>
9
#include <QVBoxLayout>
10
#include <QWidget>
11
12
class
QDragEnterEvent;
13
class
QDragMoveEvent;
14
class
QDropEvent;
15
class
QSplitter;
16
class
QMouseEvent;
17
class
QPaintEvent;
18
class
QResizeEvent;
19
20
namespace
maki
21
{
22
class
EditorTabGroup
;
23
24
constexpr
auto
MAKI_EDITOR_MIME_TYPE =
"application/x-maki-editor-id"
;
25
26
class
EditorWorkspace final :
public
QWidget
27
{
28
Q_OBJECT
29
public
:
30
enum class
SplitDirection
31
{
32
Left,
33
Right,
34
Top,
35
Bottom
36
};
37
Q_ENUM(SplitDirection)
38
39
explicit
EditorWorkspace(QWidget* parent =
nullptr
);
40
virtual
~EditorWorkspace();
41
42
QWidget* addEditor(
const
QString&
id
, QWidget* editor,
const
QString& title,
const
QIcon& icon = {},
bool
closable =
true
);
43
QWidget* findEditor(
const
QString&
id
)
const
;
44
QString editorId(
const
QWidget* editor)
const
;
45
QList<QWidget*> editors()
const
;
46
47
QWidget* activeEditor()
const
;
48
EditorTabGroup* activeGroup()
const
;
49
50
bool
activateEditor(
const
QString&
id
);
51
bool
closeEditor(
const
QString&
id
);
52
void
closeAllExcept(
const
QString&
id
);
53
54
bool
moveEditor(
const
QString&
id
, EditorTabGroup* target,
int
index = -1);
55
bool
splitEditor(
const
QString&
id
, EditorTabGroup* target, SplitDirection direction);
56
bool
splitEditor(
const
QString&
id
, QWidget* targetEditor, SplitDirection direction);
57
58
void
beginTabDrag();
59
void
endTabDrag();
60
bool
acceptsDrag(
const
QMimeData* data)
const
;
61
QString dragId(
const
QMimeData* data)
const
;
62
63
void
setEditorTitle(
const
QString&
id
,
const
QString& title);
64
void
setEditorIcon(
const
QString&
id
,
const
QIcon& icon);
65
66
signals:
67
void
activeEditorChanged(QWidget* editor);
68
void
editorCloseRequested(QWidget* editor);
69
void
editorClosed(
const
QString&
id
);
70
71
protected
:
72
bool
eventFilter(QObject* watched, QEvent* event)
override
;
73
74
private
:
75
friend
class
EditorTabGroup;
76
77
struct
Entry
78
{
79
QPointer<QWidget> widget;
80
QString title;
81
QIcon icon;
82
bool
closable =
true
;
83
};
84
85
QHash<QString, Entry> mEntries;
86
QPointer<EditorTabGroup> mActiveGroup;
87
QPointer<QWidget> mActiveEditor;
88
QWidget* mRoot =
nullptr
;
89
QVBoxLayout* mLayout =
nullptr
;
90
bool
mTransferring =
false
;
91
92
EditorTabGroup* createGroup();
93
EditorTabGroup* groupFor(QWidget* editor)
const
;
94
95
void
setActiveGroup(EditorTabGroup* group);
96
void
removeEmptyGroup(EditorTabGroup* group);
97
98
void
normalize(QSplitter* splitter);
99
bool
transfer(QWidget* editor, EditorTabGroup* target,
int
index);
100
101
int
groupCount()
const
;
102
};
103
104
}
// namespace maki
maki::EditorTabGroup
Definition
editor_tab_group.h:13
maki
Contains UI helper widgets and layout grouping utilities used by MAKI.
Definition
macros.h:9
maki::EditorWorkspace::Entry
Definition
editor_workspace.h:78
Generated for
MAKI
· © 2026 with
Doxygen
1.9.8
GitHub
Research