GTK docking interfaces and more

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 gpanthera.hh

View raw Download
text/x-c++ • 2.24 kiB
C++ source, ASCII text
        
            
1
#ifndef GPANTHERA_LIBRARY_H
2
#define GPANTHERA_LIBRARY_H
3
4
#include <gtkmm.h>
5
#include <glibmm.h>
6
#include <glibmm/ustring.h>
7
#include <utility>
8
#include <vector>
9
#include <memory>
10
11
namespace gPanthera {
12
void init();
13
14
class DockStack;
15
class DockWindow;
16
class LayoutManager;
17
18
class DockablePane : public Gtk::Box {
19
private:
20
Gtk::Label label;
21
Glib::ustring name;
22
Gtk::Image *icon;
23
DockStack *stack;
24
DockWindow *window = nullptr;
25
std::unique_ptr<Gtk::HeaderBar> header;
26
Gtk::Widget *child;
27
std::shared_ptr<LayoutManager> layout;
28
public:
29
DockablePane(std::shared_ptr<LayoutManager> layout, Gtk::Widget &child, const Glib::ustring &name, const Glib::ustring &label, Gtk::Image *icon, DockStack *stack = nullptr, Gtk::Widget *custom_header = nullptr);
30
Glib::ustring get_identifier() const;
31
Gtk::Image *get_icon() const;
32
Gtk::Label *get_label();
33
void redock(DockStack *stack);
34
void pop_out();
35
Gtk::Widget *get_child() const;
36
};
37
38
class DockWindow : public Gtk::Window {
39
private:
40
DockablePane *pane;
41
public:
42
explicit DockWindow(DockablePane *pane);
43
};
44
45
class LayoutManager : public Glib::ObjectBase {
46
private:
47
public:
48
std::vector<DockablePane*> panes;
49
std::vector<DockStack*> stacks;
50
LayoutManager();
51
52
void add_pane(DockablePane *pane);
53
54
void add_stack(DockStack *stack);
55
};
56
57
class DockStack : public Gtk::Stack {
58
private:
59
public:
60
std::shared_ptr<LayoutManager> layout;
61
Glib::ustring name;
62
explicit DockStack(std::shared_ptr<LayoutManager> layout, const Glib::ustring &name);
63
64
void add_pane(DockablePane &child);
65
};
66
67
class DockButton : public Gtk::Button {
68
private:
69
public:
70
DockablePane *pane;
71
explicit DockButton(DockablePane *pane);
72
};
73
74
class DockStackSwitcher : public Gtk::ButtonBox {
75
private:
76
DockStack *stack;
77
sigc::connection add_handler, remove_handler;
78
public:
79
void update_buttons();
80
explicit DockStackSwitcher(DockStack *stack);
81
~DockStackSwitcher() override;
82
};
83
} // namespace gPanthera
84
85
#endif // GPANTHERA_LIBRARY_H