diff options
| author | Denis Declara <declara91@gmail.com> | 2012-04-26 11:14:34 +0000 |
|---|---|---|
| committer | Denis Declara <declara91@gmail.com> | 2012-04-26 11:14:34 +0000 |
| commit | 95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4 (patch) | |
| tree | 506de5a8437cb39917a66d74b68d78692d10a993 /src/ui/widget/frame.cpp | |
| parent | Added first support for elliptical arrangements (diff) | |
| parent | powerstroke: cautious fix. (diff) | |
| download | inkscape-95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4.tar.gz inkscape-95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4.zip | |
Trunk merge
(bzr r11073.1.20)
Diffstat (limited to 'src/ui/widget/frame.cpp')
| -rw-r--r-- | src/ui/widget/frame.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp new file mode 100644 index 000000000..b2968f806 --- /dev/null +++ b/src/ui/widget/frame.cpp @@ -0,0 +1,83 @@ +/* + * Authors: + * Murray C + * + * Copyright (C) 2012 Authors + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "frame.h" + + +// Inkscape::UI::Widget::Frame + +namespace Inkscape { +namespace UI { +namespace Widget { + +Frame::Frame(Glib::ustring const &label_text /*= ""*/, gboolean label_bold /*= TRUE*/ ) + : _label(label_text, 1.0, 0.5, TRUE), + _alignment() +{ + set_shadow_type(Gtk::SHADOW_NONE); + + //Put an indented GtkAlignment inside the frame. + //Further children should be children of this GtkAlignment: + Gtk::Frame::add(_alignment); + set_padding(4, 0, 8, 0); + + set_label_widget(_label); + set_label(label_text, label_bold); + + show_all_children(); +} + +void +Frame::add(Widget& widget) +{ + _alignment.add(widget); +} + +void +Frame::set_label(const Glib::ustring &label_text, gboolean label_bold /*= TRUE*/) +{ + if (label_bold) { + _label.set_markup(Glib::ustring("<b>") + label_text + "</b>"); + } else { + _label.set_text(label_text); + } +} + +void +Frame::set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right) +{ +#if WITH_GTKMM_2_24 + _alignment.set_padding(padding_top, padding_bottom, padding_left, padding_right); +#endif +} + +Gtk::Label const * +Frame::get_label_widget() const +{ + return &_label; +} + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +/* + 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 : |
