1 /**
2 * \brief Generic Panel widget - A generic dockable container.
3 *
4 * Authors:
5 * Bryce Harrington <bryce@bryceharrington.org>
6 * Jon A. Cruz <jon@joncruz.org>
7 *
8 * Copyright (C) 2004 Bryce Harrington
9 * Copyright (C) 2005 Jon A. Cruz
10 *
11 * Released under GNU GPL. Read the file 'COPYING' for more information.
12 */
14 #ifndef SEEN_INKSCAPE_UI_WIDGET_PANEL_H
15 #define SEEN_INKSCAPE_UI_WIDGET_PANEL_H
17 #include <vector>
18 #include <gtkmm/arrow.h>
19 #include <gtkmm/box.h>
20 #include <gtkmm/button.h>
21 #include <gtkmm/buttonbox.h>
22 #include <gtkmm/eventbox.h>
23 #include <gtkmm/frame.h>
24 #include <gtkmm/label.h>
25 #include <gtkmm/menu.h>
26 #include <gtkmm/optionmenu.h>
27 #include <gtkmm/table.h>
28 #include <gtkmm/tooltips.h>
30 #include "ui/previewfillable.h"
31 #include "selection.h"
33 namespace Inkscape {
34 namespace UI {
35 namespace Widget {
37 class Panel : public Gtk::VBox {
39 public:
40 virtual ~Panel();
41 Panel(Glib::ustring const &label = "", gchar const *prefs_path = 0,
42 int verb_num = 0, Glib::ustring const &apply_label = "",
43 bool menu_desired = false);
45 gchar const *getPrefsPath() const;
46 void setLabel(Glib::ustring const &label);
47 Glib::ustring const &getLabel() const;
48 int const &getVerb() const;
49 Glib::ustring const &getApplyLabel() const;
51 virtual void setOrientation(Gtk::AnchorType how);
53 virtual void present(); //< request to be present
55 void restorePanelPrefs();
57 /** Signal accessors */
58 virtual sigc::signal<void, int> &signalResponse();
59 virtual sigc::signal<void> &signalPresent();
61 /** Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE
62 * signals on click. */
63 Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id);
64 Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id);
65 void setDefaultResponse(int response_id);
66 void setResponseSensitive(int response_id, bool setting);
68 protected:
69 Gtk::Box *_getContents() { return &_contents; }
70 void _setTargetFillable(PreviewFillable *target);
71 void _regItem(Gtk::MenuItem* item, int group, int id);
73 virtual void _handleAction(int set_id, int item_id);
74 virtual void _apply();
76 virtual void _handleResponse(int response_id);
78 /** Helper methods */
79 void _addResponseButton(Gtk::Button *button, int response_id);
80 Inkscape::Selection *_getSelection();
82 /** Tooltips object for all descendants to use */
83 Gtk::Tooltips _tooltips;
85 const gchar *_prefs_path;
87 bool _menu_desired;
88 Gtk::AnchorType _anchor;
90 /** Signals */
91 sigc::signal<void, int> _signal_response;
92 sigc::signal<void> _signal_present;
94 private:
95 void _init();
96 void _bounceCall(int i, int j);
98 void _popper(GdkEventButton *btn);
99 void _wrapToggled(Gtk::CheckMenuItem *toggler);
101 Glib::ustring _label;
102 Glib::ustring _apply_label;
103 int _verb_num;
105 Gtk::HBox _top_bar;
106 Gtk::VBox _right_bar;
107 Gtk::VBox _contents;
108 Gtk::Label _tab_title;
109 Gtk::Arrow _temp_arrow;
110 Gtk::EventBox _menu_popper;
111 Gtk::Button _close_button;
112 Gtk::Menu *_menu;
113 Gtk::HButtonBox *_action_area; //< stores response buttons
114 std::vector<Gtk::Widget *> _non_horizontal;
115 std::vector<Gtk::Widget *> _non_vertical;
116 PreviewFillable *_fillable;
118 /** A map to store which widget that emits a certain response signal */
119 typedef std::map<int, Gtk::Widget *> ResponseMap;
120 ResponseMap _response_map;
121 };
123 } // namespace Widget
124 } // namespace UI
125 } // namespace Inkscape
127 #endif // SEEN_INKSCAPE_UI_WIDGET_PANEL_H
129 /*
130 Local Variables:
131 mode:c++
132 c-file-style:"stroustrup"
133 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
134 indent-tabs-mode:nil
135 fill-column:99
136 End:
137 */
138 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :