2
* \brief A custom wrapper around gdl-dock-item
5
* Gustav Broberg <broberg@kth.se>
7
* Copyright (C) 2007 Authors
9
* Released under GNU GPL. Read the file 'COPYING' for more information.
13
#ifndef INKSCAPE_UI_WIGET_DOCK_ITEM_H
14
#define INKSCAPE_UI_WIGET_DOCK_ITEM_H
16
#include <gtkmm/button.h>
17
#include <gtkmm/buttonbox.h>
18
#include <gtkmm/frame.h>
19
#include <gtkmm/paned.h>
20
#include <gtkmm/window.h>
22
#include "libgdl/libgdl.h"
34
enum State { UNATTACHED, // item not bound to the dock (a temporary state)
35
FLOATING_STATE, // item not in its dock (but can be docked in other,
36
// e.g. floating, docks)
37
DOCKED_STATE }; // item in its assigned dock
42
BOTTOM = GDL_DOCK_BOTTOM,
43
RIGHT = GDL_DOCK_RIGHT,
45
CENTER = GDL_DOCK_CENTER,
46
FLOATING = GDL_DOCK_FLOATING
49
DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& long_name,
50
const Glib::ustring& icon_name, State state);
54
Gtk::Widget& getWidget();
57
Gtk::VBox *get_vbox();
59
void get_position(int& x, int& y);
60
void get_size(int& width, int& height);
62
void resize(int width, int height);
63
void move(int x, int y);
64
void set_position(Gtk::WindowPosition);
65
void set_size_request(int width, int height);
66
void size_request(Gtk::Requisition& requisition);
67
void set_title(Glib::ustring title);
69
bool isAttached() const;
70
bool isFloating() const;
71
bool isIconified() const;
72
State getState() const;
73
State getPrevState() const;
74
Placement getPlacement() const;
76
Gtk::Window *getWindow(); //< gives the parent window, if the dock item has one (i.e. it's floating)
86
Glib::SignalProxy0<void> signal_show();
87
Glib::SignalProxy0<void> signal_hide();
88
Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event();
89
Glib::SignalProxy0<void> signal_drag_begin();
90
Glib::SignalProxy1<void, bool> signal_drag_end();
91
Glib::SignalProxy0<void> signal_realize();
93
sigc::signal<void, State, State> signal_state_changed();
96
Dock &_dock; //< parent dock
98
State _prev_state; //< last known state
102
Gtk::Window *_window; //< reference to floating window, if any
103
int _x, _y; //< last known position of window, if floating
105
bool _grab_focus_on_realize; //< if the dock item should grab focus on the next realize
107
GtkWidget *_gdl_dock_item;
108
Glib::RefPtr<Gdk::Pixbuf> _icon_pixbuf;
110
/** Interface widgets, will be packed like
111
* gdl_dock_item -> _frame -> _dock_item_box -> (_dock_item_action_area)
114
Gtk::VBox _dock_item_box;
115
Gtk::HButtonBox *_dock_item_action_area;
117
/** Internal signal handlers */
119
void _onHideWindow();
122
void _onDragEnd(bool cancelled);
125
bool _onKeyPress(GdkEventKey *event);
126
void _onStateChanged(State prev_state, State new_state);
127
bool _onDeleteEvent(GdkEventAny *event);
129
sigc::connection _signal_key_press_event_connection;
131
/** GdlDockItem signal proxy structures */
132
static const Glib::SignalProxyInfo _signal_show_proxy;
133
static const Glib::SignalProxyInfo _signal_hide_proxy;
134
static const Glib::SignalProxyInfo _signal_delete_event_proxy;
136
static const Glib::SignalProxyInfo _signal_drag_begin_proxy;
137
static const Glib::SignalProxyInfo _signal_drag_end_proxy;
138
static const Glib::SignalProxyInfo _signal_realize_proxy;
140
static gboolean _signal_delete_event_callback(GtkWidget *self, GdkEventAny *event, void *data);
141
static void _signal_drag_end_callback(GtkWidget* self, gboolean p0, void* data);
143
sigc::signal<void, State, State> _signal_state_changed;
148
} // namespace Widget
150
} // namespace Inkscape
152
#endif // INKSCAPE_UI_WIGET_DOCK_ITEM_H
157
c-file-style:"stroustrup"
158
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
163
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :