~ubuntu-branches/ubuntu/oneiric/inkscape/oneiric-updates

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/ui/widget/panel.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
13
 
 
14
#ifndef SEEN_INKSCAPE_UI_WIDGET_PANEL_H
 
15
#define SEEN_INKSCAPE_UI_WIDGET_PANEL_H
 
16
 
 
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>
 
29
 
 
30
#include "inkscape.h"
 
31
#include "ui/previewfillable.h"
 
32
#include "selection.h"
 
33
 
 
34
namespace Inkscape {
 
35
namespace UI {
 
36
namespace Widget {
 
37
 
 
38
class Panel : public Gtk::VBox {
 
39
 
 
40
public:
 
41
    static void prep();
 
42
 
 
43
    virtual ~Panel();
 
44
    Panel(Glib::ustring const &label = "", gchar const *prefs_path = 0,
 
45
          int verb_num = 0, Glib::ustring const &apply_label = "",
 
46
          bool menu_desired = false);
 
47
 
 
48
    gchar const *getPrefsPath() const;
 
49
    void setLabel(Glib::ustring const &label);
 
50
    Glib::ustring const &getLabel() const;
 
51
    int const &getVerb() const;
 
52
    Glib::ustring const &getApplyLabel() const;
 
53
 
 
54
    virtual void setOrientation(Gtk::AnchorType how);
 
55
 
 
56
    virtual void present();  //< request to be present
 
57
 
 
58
    void restorePanelPrefs();
 
59
 
 
60
    virtual void setDesktop(SPDesktop *desktop);
 
61
    SPDesktop *getDesktop() { return _desktop; }
 
62
 
 
63
    /** Signal accessors */
 
64
    virtual sigc::signal<void, int> &signalResponse();
 
65
    virtual sigc::signal<void> &signalPresent();
 
66
 
 
67
    /** Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE
 
68
     *  signals on click. */
 
69
    Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id);
 
70
    Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id);
 
71
    void setDefaultResponse(int response_id);
 
72
    void setResponseSensitive(int response_id, bool setting);
 
73
 
 
74
    virtual sigc::signal<void, SPDesktop *, SPDocument *> &signalDocumentReplaced();
 
75
    virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalActivateDesktop();
 
76
    virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalDeactiveDesktop();
 
77
 
 
78
protected:
 
79
    Gtk::Box *_getContents() { return &_contents; }
 
80
    void _setTargetFillable(PreviewFillable *target);
 
81
    void _regItem(Gtk::MenuItem* item, int group, int id);
 
82
 
 
83
    virtual void _handleAction(int set_id, int item_id);
 
84
    virtual void _apply();
 
85
 
 
86
    virtual void _handleResponse(int response_id);
 
87
 
 
88
    /** Helper methods */
 
89
    void _addResponseButton(Gtk::Button *button, int response_id);
 
90
    Inkscape::Selection *_getSelection();
 
91
 
 
92
    /** Tooltips object for all descendants to use */
 
93
    Gtk::Tooltips _tooltips;
 
94
 
 
95
    Glib::ustring const _prefs_path;
 
96
 
 
97
    bool _menu_desired;
 
98
    Gtk::AnchorType _anchor;
 
99
 
 
100
    /** Signals */
 
101
    sigc::signal<void, int> _signal_response;
 
102
    sigc::signal<void>      _signal_present;
 
103
    sigc::signal<void, SPDesktop *, SPDocument *> _signal_document_replaced;
 
104
    sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_activate_desktop;
 
105
    sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_deactive_desktop;
 
106
 
 
107
private:
 
108
    void _init();
 
109
    void _bounceCall(int i, int j);
 
110
 
 
111
    void _popper(GdkEventButton *btn);
 
112
    void _wrapToggled(Gtk::CheckMenuItem *toggler);
 
113
 
 
114
    SPDesktop       *_desktop;
 
115
 
 
116
    Glib::ustring    _label;
 
117
    Glib::ustring    _apply_label;
 
118
    int              _verb_num;
 
119
 
 
120
    Gtk::HBox        _top_bar;
 
121
    Gtk::VBox        _right_bar;
 
122
    Gtk::VBox        _contents;
 
123
    Gtk::Label       _tab_title;
 
124
    Gtk::Arrow       _temp_arrow;
 
125
    Gtk::EventBox    _menu_popper;
 
126
    Gtk::Button      _close_button;
 
127
    Gtk::Menu       *_menu;
 
128
    Gtk::HButtonBox *_action_area;  //< stores response buttons
 
129
    std::vector<Gtk::Widget *> _non_horizontal;
 
130
    std::vector<Gtk::Widget *> _non_vertical;
 
131
    PreviewFillable *_fillable;
 
132
 
 
133
    /** A map to store which widget that emits a certain response signal */
 
134
    typedef std::map<int, Gtk::Widget *> ResponseMap;
 
135
    ResponseMap _response_map;
 
136
};
 
137
 
 
138
} // namespace Widget
 
139
} // namespace UI
 
140
} // namespace Inkscape
 
141
 
 
142
#endif // SEEN_INKSCAPE_UI_WIDGET_PANEL_H
 
143
 
 
144
/*
 
145
  Local Variables:
 
146
  mode:c++
 
147
  c-file-style:"stroustrup"
 
148
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
149
  indent-tabs-mode:nil
 
150
  fill-column:99
 
151
  End:
 
152
*/
 
153
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :