GTK docking interfaces

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 gpanthera.hh

View raw Download
text/x-c++ • 2.6 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
sigc::signal<void(Gtk::Widget*)> signal_child_added;
61
sigc::signal<void(Gtk::Widget*)> signal_child_removed;
62
std::shared_ptr<LayoutManager> layout;
63
Glib::ustring name;
64
explicit DockStack(std::shared_ptr<LayoutManager> layout, const Glib::ustring &name);
65
66
void add_pane(DockablePane &child);
67
void add(Gtk::Widget &child, const Glib::ustring &name);
68
void remove(Gtk::Widget &child);
69
void add(Gtk::Widget &child) = delete;
70
void add(Gtk::Widget &child, const Glib::ustring &name, const Glib::ustring &title) = delete;
71
};
72
73
class DockButton : public Gtk::Button {
74
private:
75
public:
76
DockablePane *pane;
77
explicit DockButton(DockablePane *pane);
78
};
79
80
class DockStackSwitcher : public Gtk::Box {
81
private:
82
DockStack *stack;
83
sigc::connection add_handler, remove_handler;
84
public:
85
void update_buttons();
86
explicit DockStackSwitcher(DockStack *stack);
87
~DockStackSwitcher() override;
88
};
89
} // namespace gPanthera
90
91
#endif // GPANTHERA_LIBRARY_H