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.7 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
DockStack *last_stack = nullptr;
30
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);
31
Glib::ustring get_identifier() const;
32
Gtk::Image *get_icon() const;
33
Gtk::Label *get_label();
34
void redock(DockStack *stack);
35
void pop_out();
36
Gtk::Widget *get_child() const;
37
};
38
39
class DockWindow : public Gtk::Window {
40
private:
41
DockablePane *pane;
42
public:
43
explicit DockWindow(DockablePane *pane);
44
};
45
46
class LayoutManager : public Glib::ObjectBase {
47
private:
48
public:
49
std::vector<DockablePane*> panes;
50
std::vector<DockStack*> stacks;
51
LayoutManager();
52
53
void add_pane(DockablePane *pane);
54
55
void add_stack(DockStack *stack);
56
};
57
58
class DockStack : public Gtk::Stack {
59
private:
60
public:
61
sigc::signal<void(Gtk::Widget*)> signal_child_added;
62
sigc::signal<void(Gtk::Widget*)> signal_child_removed;
63
std::shared_ptr<LayoutManager> layout;
64
Glib::ustring name;
65
explicit DockStack(std::shared_ptr<LayoutManager> layout, const Glib::ustring &name);
66
67
void add_pane(DockablePane &child);
68
void add(Gtk::Widget &child, const Glib::ustring &name);
69
void remove(Gtk::Widget &child);
70
void add(Gtk::Widget &child) = delete;
71
void add(Gtk::Widget &child, const Glib::ustring &name, const Glib::ustring &title) = delete;
72
};
73
74
class DockButton : public Gtk::Button {
75
private:
76
public:
77
DockablePane *pane;
78
explicit DockButton(DockablePane *pane);
79
};
80
81
class DockStackSwitcher : public Gtk::Box {
82
private:
83
DockStack *stack;
84
sigc::connection add_handler, remove_handler;
85
public:
86
void update_buttons();
87
explicit DockStackSwitcher(DockStack *stack, Gtk::Orientation orientation = Gtk::Orientation::HORIZONTAL);
88
~DockStackSwitcher() override;
89
};
90
} // namespace gPanthera
91
92
#endif // GPANTHERA_LIBRARY_H