summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/dock.h
blob: f061f598d1b821fb05668e1a3e974e650f3e3ced (plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
 * @brief A desktop dock pane to dock dialogs, a custom wrapper around gdl-dock.
 */
/* Author:
 *   Gustav Broberg <broberg@kth.se>
 *
 * Copyright (C) 2007 Authors
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef INKSCAPE_UI_WIDGET_DOCK_H
#define INKSCAPE_UI_WIDGET_DOCK_H

#include <gtkmm/box.h>
#include <list>
#include "ui/widget/dock-item.h"

struct _GdlDock;
typedef _GdlDock GdlDock;
struct _GdlDockBar;
typedef _GdlDockBar GdlDockBar;

namespace Gtk {
class Paned;
class ScrolledWindow;
}

namespace Inkscape {
namespace UI {
namespace Widget {

class Dock {

public:

    Dock(Gtk::Orientation orientation=Gtk::ORIENTATION_VERTICAL);
    ~Dock();

    void addItem(DockItem& item, GdlDockPlacement placement);

    Gtk::Widget& getWidget();     //< return the top widget
    Gtk::Paned *getParentPaned();
    Gtk::Paned *getPaned();

    GtkWidget* getGdlWidget();    //< return the top gdl widget

    bool isEmpty() const;         //< true iff none of the dock's items are in a docked state
    bool hasIconifiedItems() const;

    Glib::SignalProxy0<void> signal_layout_changed();

    void hide();
    void show();

    /** Toggle size of dock between the previous dimensions and the ones sent as parameters */
    void toggleDockable(int width=0, int height=0);

    /** Scrolls the scrolled window container to make the provided dock item visible, if needed */
    void scrollToItem(DockItem& item);

protected:

    std::list<const DockItem *> _dock_items;   //< added dock items

    /** Interface widgets, will be packed like 
     * _scrolled_window -> (_dock_box -> (_paned -> (_dock -> _filler) | _dock_bar))
     */
    Gtk::Box            *_dock_box;
    Gtk::Paned          *_paned;
    GtkWidget           *_gdl_dock;
    GdlDockBar          *_gdl_dock_bar;
    Gtk::Box             _filler;
    Gtk::ScrolledWindow *_scrolled_window;

    /** Internal signal handlers */
    void _onLayoutChanged();
    void _onPanedButtonEvent(GdkEventButton *event);

    static gboolean _on_paned_button_event(GtkWidget *widget, GdkEventButton *event, 
                                           gpointer user_data);

    /** GdlDock signal proxy structures */
    static const Glib::SignalProxyInfo _signal_layout_changed_proxy;

    /** Standard widths */
    static const int _default_empty_width;
    static const int _default_dock_bar_width;
};

} // namespace Widget
} // namespace UI
} // namespace Inkscape

#endif //INKSCAPE_UI_DIALOG_BEHAVIOUR_H

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :