diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-04-17 08:31:13 +0000 |
|---|---|---|
| committer | John Smith <removethis.john.q.public@bigmail.com> | 2012-04-17 08:31:13 +0000 |
| commit | 0c63499f4369d78f9f7186438dfc2051d4f677bb (patch) | |
| tree | 58693855f3c7b6108f150197faed10a621bba234 /src | |
| parent | some more string class usage as opposed to c-strings to prevent issues (diff) | |
| download | inkscape-0c63499f4369d78f9f7186438dfc2051d4f677bb.tar.gz inkscape-0c63499f4369d78f9f7186438dfc2051d4f677bb.zip | |
Fix for 169888 : HIG Style frame
(bzr r11260)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/ui/dialog/align-and-distribute.h | 3 | ||||
| -rw-r--r-- | src/ui/dialog/find.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/find.h | 73 | ||||
| -rw-r--r-- | src/ui/dialog/icon-preview.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/input.cpp | 25 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 1 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.h | 4 | ||||
| -rw-r--r-- | src/ui/dialog/object-properties.cpp | 3 | ||||
| -rw-r--r-- | src/ui/dialog/object-properties.h | 5 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.cpp | 3 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.h | 3 | ||||
| -rw-r--r-- | src/ui/dialog/tracedialog.cpp | 13 | ||||
| -rw-r--r-- | src/ui/widget/Makefile_insert | 2 | ||||
| -rw-r--r-- | src/ui/widget/frame.cpp | 83 | ||||
| -rw-r--r-- | src/ui/widget/frame.h | 79 |
16 files changed, 246 insertions, 64 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 85f0899a8..36a53dada 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -79,6 +79,7 @@ set(ui_SRC widget/dock.cpp widget/entity-entry.cpp widget/entry.cpp + widget/frame.cpp widget/filter-effect-chooser.cpp widget/handlebox.cpp widget/icon-widget.cpp @@ -209,6 +210,7 @@ set(ui_SRC widget/dock.h widget/entity-entry.h widget/entry.h + widget/frame.h widget/filter-effect-chooser.h widget/handlebox.h widget/icon-widget.h diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index 7edf9c30c..59cc0dba4 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -17,6 +17,7 @@ #include <list> #include "ui/widget/panel.h" +#include "ui/widget/frame.h" #include <gtkmm/frame.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/label.h> @@ -107,7 +108,7 @@ protected: #endif std::list<Action *> _actionList; - Gtk::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame; + UI::Widget::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame; #if WITH_GTKMM_3_0 Gtk::Grid _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable; #else diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 5fd6e18d8..641acd3f3 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -72,10 +72,10 @@ Find::Find() check_scope_selection(_("S_election"), _("Limit search to the current selection")), check_searchin_text(_("Te_xt"), _("Search in text objects")), check_searchin_property(_("_Properties"), _("Search in object properties, styles, attributes and IDs")), + vbox_searchin(0, false), frame_searchin(_("Search in")), frame_scope(_("Scope")), - check_case_sensitive(_("Case sensiti_ve"), _("Match upper/lower case"), false), check_exact_match(_("E_xact match"), _("Match whole objects only"), false), check_include_hidden(_("Include _hidden"), _("Include hidden objects in search"), false), @@ -120,8 +120,8 @@ Find::Find() Gtk::RadioButtonGroup grp_searchin = check_searchin_text.get_group(); check_searchin_property.set_group(grp_searchin); - vbox_searchin.pack_start(check_searchin_text, true, true); - vbox_searchin.pack_start(check_searchin_property, true, true); + vbox_searchin.pack_start(check_searchin_text, false, false); + vbox_searchin.pack_start(check_searchin_property, false, false); frame_searchin.add(vbox_searchin); Gtk::RadioButtonGroup grp_scope = check_scope_all.get_group(); diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h index 62ecd1763..64fb4cc3d 100644 --- a/src/ui/dialog/find.h +++ b/src/ui/dialog/find.h @@ -15,6 +15,7 @@ #include "ui/widget/panel.h" #include "ui/widget/button.h" #include "ui/widget/entry.h" +#include "ui/widget/frame.h" #include <glib.h> #include <gtkmm.h> @@ -198,78 +199,78 @@ private: /* * Find and replace combo box widgets */ - Inkscape::UI::Widget::Entry entry_find; - Inkscape::UI::Widget::Entry entry_replace; + UI::Widget::Entry entry_find; + UI::Widget::Entry entry_replace; /** * Scope and search in widgets */ - Inkscape::UI::Widget::RadioButton check_scope_all; - Inkscape::UI::Widget::RadioButton check_scope_layer; - Inkscape::UI::Widget::RadioButton check_scope_selection; - Inkscape::UI::Widget::RadioButton check_searchin_text; - Inkscape::UI::Widget::RadioButton check_searchin_property; + UI::Widget::RadioButton check_scope_all; + UI::Widget::RadioButton check_scope_layer; + UI::Widget::RadioButton check_scope_selection; + UI::Widget::RadioButton check_searchin_text; + UI::Widget::RadioButton check_searchin_property; Gtk::HBox hbox_searchin; Gtk::VBox vbox_scope; Gtk::VBox vbox_searchin; - Gtk::Frame frame_searchin; - Gtk::Frame frame_scope; + UI::Widget::Frame frame_searchin; + UI::Widget::Frame frame_scope; /** * General option widgets */ - Inkscape::UI::Widget::CheckButton check_case_sensitive; - Inkscape::UI::Widget::CheckButton check_exact_match; - Inkscape::UI::Widget::CheckButton check_include_hidden; - Inkscape::UI::Widget::CheckButton check_include_locked; + UI::Widget::CheckButton check_case_sensitive; + UI::Widget::CheckButton check_exact_match; + UI::Widget::CheckButton check_include_hidden; + UI::Widget::CheckButton check_include_locked; Gtk::VBox vbox_options1; Gtk::VBox vbox_options2; Gtk::HBox hbox_options; Gtk::VBox vbox_expander; Gtk::Expander expander_options; - Gtk::Frame frame_options; + UI::Widget::Frame frame_options; /** * Property type widgets */ - Inkscape::UI::Widget::CheckButton check_ids; - Inkscape::UI::Widget::CheckButton check_attributename; - Inkscape::UI::Widget::CheckButton check_attributevalue; - Inkscape::UI::Widget::CheckButton check_style; - Inkscape::UI::Widget::CheckButton check_font; + UI::Widget::CheckButton check_ids; + UI::Widget::CheckButton check_attributename; + UI::Widget::CheckButton check_attributevalue; + UI::Widget::CheckButton check_style; + UI::Widget::CheckButton check_font; Gtk::VBox vbox_properties; Gtk::HBox hbox_properties1; Gtk::HBox hbox_properties2; - Gtk::Frame frame_properties; + UI::Widget::Frame frame_properties; /** * A vector of all the properties widgets for easy processing */ - std::vector<Inkscape::UI::Widget::CheckButton *> checkProperties; + std::vector<UI::Widget::CheckButton *> checkProperties; /** * Object type widgets */ - Inkscape::UI::Widget::CheckButton check_alltypes; - Inkscape::UI::Widget::CheckButton check_rects; - Inkscape::UI::Widget::CheckButton check_ellipses; - Inkscape::UI::Widget::CheckButton check_stars; - Inkscape::UI::Widget::CheckButton check_spirals; - Inkscape::UI::Widget::CheckButton check_paths; - Inkscape::UI::Widget::CheckButton check_texts; - Inkscape::UI::Widget::CheckButton check_groups; - Inkscape::UI::Widget::CheckButton check_clones; - Inkscape::UI::Widget::CheckButton check_images; - Inkscape::UI::Widget::CheckButton check_offsets; + UI::Widget::CheckButton check_alltypes; + UI::Widget::CheckButton check_rects; + UI::Widget::CheckButton check_ellipses; + UI::Widget::CheckButton check_stars; + UI::Widget::CheckButton check_spirals; + UI::Widget::CheckButton check_paths; + UI::Widget::CheckButton check_texts; + UI::Widget::CheckButton check_groups; + UI::Widget::CheckButton check_clones; + UI::Widget::CheckButton check_images; + UI::Widget::CheckButton check_offsets; Gtk::VBox vbox_types1; Gtk::VBox vbox_types2; Gtk::HBox hbox_types; - Gtk::Frame frame_types; + UI::Widget::Frame frame_types; /** * A vector of all the check option widgets for easy processing */ - std::vector<Inkscape::UI::Widget::CheckButton *> checkTypes; + std::vector<UI::Widget::CheckButton *> checkTypes; //Gtk::HBox hbox_text; @@ -277,8 +278,8 @@ private: * Action Buttons and status */ Gtk::Label status; - Inkscape::UI::Widget::Button button_find; - Inkscape::UI::Widget::Button button_replace; + UI::Widget::Button button_find; + UI::Widget::Button button_replace; Gtk::HButtonBox box_buttons; Gtk::HBox hboxbutton_row; diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 19cdea9bc..de213ca85 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -25,6 +25,7 @@ #include <gtkmm/checkbutton.h> #include <gtkmm/frame.h> #include <gtkmm/stock.h> +#include "ui/widget/frame.h" #include "desktop.h" #include "desktop-handles.h" @@ -160,7 +161,7 @@ IconPreviewPanel::IconPreviewPanel() : Gtk::VBox* magBox = new Gtk::VBox(); - Gtk::Frame *magFrame = Gtk::manage(new Gtk::Frame(_("Magnified:"))); + UI::Widget::Frame *magFrame = Gtk::manage(new UI::Widget::Frame(_("Magnified:"))); magFrame->add( magnified ); magBox->pack_start( *magFrame, Gtk::PACK_EXPAND_WIDGET ); @@ -229,7 +230,7 @@ IconPreviewPanel::IconPreviewPanel() : iconBox.pack_start(splitter); splitter.pack1( *magBox, true, true ); - Gtk::Frame *actuals = Gtk::manage(new Gtk::Frame(_("Actual Size:"))); + UI::Widget::Frame *actuals = Gtk::manage(new UI::Widget::Frame (_("Actual Size:"))); actuals->add(*verts); splitter.pack2( *actuals, false, false ); diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 1e60d7f8a..eb2ddb88f 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -13,6 +13,8 @@ #include <set> #include <list> #include "ui/widget/panel.h" +#include "ui/widget/frame.h" + #include <glib/gprintf.h> #include <glibmm/i18n.h> #include <gtkmm/alignment.h> @@ -426,8 +428,8 @@ private: Glib::RefPtr<Gtk::TreeStore> store; Gtk::TreeIter tabletIter; Gtk::TreeView tree; - Gtk::Frame frame2; - Gtk::Frame testFrame; + Inkscape::UI::Widget::Frame detailFrame; + Inkscape::UI::Widget::Frame testFrame; Gtk::ScrolledWindow treeScroller; Gtk::ScrolledWindow detailScroller; Gtk::HPaned splitter; @@ -527,7 +529,7 @@ InputDialogImpl::InputDialogImpl() : store(Gtk::TreeStore::create(getCols())), tabletIter(), tree(store), - frame2(), + detailFrame(), testFrame(_("Test Area")), treeScroller(), detailScroller(), @@ -544,10 +546,11 @@ InputDialogImpl::InputDialogImpl() : treeScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + treeScroller.set_shadow_type(Gtk::SHADOW_IN); treeScroller.add(tree); treeScroller.set_size_request(50, 0); split2.pack1(testFrame, false, false); - split2.pack2(frame2, true, true); + split2.pack2(detailFrame, true, true); splitter.pack1(treeScroller); splitter.pack2(split2); @@ -591,7 +594,7 @@ InputDialogImpl::InputDialogImpl() : int rowNum = 0; - Gtk::Label* lbl = Gtk::manage(new Gtk::Label(_("Name:"))); +/* Gtk::Label* lbl = Gtk::manage(new Gtk::Label(_("Name:"))); devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); @@ -599,9 +602,9 @@ InputDialogImpl::InputDialogImpl() : ::Gtk::SHRINK, ::Gtk::SHRINK); - rowNum++; + rowNum++;*/ - lbl = Gtk::manage(new Gtk::Label(_("Link:"))); + Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:"))); devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1, ::Gtk::FILL, ::Gtk::SHRINK); @@ -700,9 +703,11 @@ InputDialogImpl::InputDialogImpl() : devDetails.set_sensitive(false); detailScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + detailScroller.set_shadow_type(Gtk::SHADOW_NONE); + detailScroller.set_border_width (0); detailScroller.add(devDetails); - frame2.add(detailScroller); - frame2.set_size_request(0, 60); + detailFrame.add(detailScroller); + detailFrame.set_size_request(0, 60); //- 16x16/devices // gnome-dev-mouse-optical @@ -1307,6 +1312,7 @@ void InputDialogImpl::resyncToSelection() { clear = false; devName.set_label(row[getCols().description]); + detailFrame.set_label(row[getCols().description]); setupValueAndCombo( dev->getNumAxes(), dev->getNumAxes(), devAxesCount, axesCombo); setupValueAndCombo( dev->getNumKeys(), dev->getNumKeys(), devKeyCount, buttonCombo); } @@ -1314,6 +1320,7 @@ void InputDialogImpl::resyncToSelection() { devDetails.set_sensitive(!clear); if (clear) { + detailFrame.set_label(""); devName.set_label(""); devAxesCount.set_label(""); devKeyCount.set_label(""); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 1f252c089..5b9f72453 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -84,7 +84,6 @@ LivePathEffectEditor::LivePathEffectEditor() effectwidget(NULL), status_label("", Gtk::ALIGN_CENTER), effectcontrol_frame(""), - effectlist_frame(_("Effect list")), button_add(), button_remove(), button_up(), diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index beebbc698..20b0a673d 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -16,6 +16,7 @@ #include <gtkmm/label.h> #include <gtkmm/frame.h> #include "ui/widget/combo-enums.h" +#include "ui/widget/frame.h" #include "live_effects/effect-enum.h" #include <gtkmm/liststore.h> #include <gtkmm/treeview.h> @@ -89,8 +90,7 @@ private: Gtk::Widget * effectwidget; Gtk::Label status_label; - Gtk::Frame effectcontrol_frame; - Gtk::Frame effectlist_frame; + UI::Widget::Frame effectcontrol_frame; Gtk::HBox effectapplication_hbox; Gtk::VBox effectcontrol_vbox; Gtk::VBox effectlist_vbox; diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 13d80e301..23c0f72ee 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -43,6 +43,7 @@ ObjectProperties::ObjectProperties (void) : LabelLabel(_("_Label:"), 1), LabelTitle(_("_Title:"),1), LabelDescription(_("_Description"),1), + FrameDescription("", FALSE), HBoxCheck(FALSE, 0), CheckTable(1, 2, TRUE), CBHide(_("_Hide"), 1), @@ -145,6 +146,8 @@ void ObjectProperties::MakeWidget(void) /* Create the frame for the object description */ FrameDescription.set_label_widget (LabelDescription); + FrameDescription.set_padding (4,0,0,0); + TopTable.attach (FrameDescription, 0, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0 ); diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h index d8d74cdb3..d9d1a3fdd 100644 --- a/src/ui/dialog/object-properties.h +++ b/src/ui/dialog/object-properties.h @@ -14,6 +14,7 @@ #define SEEN_DIALOGS_ITEM_PROPERTIES_H #include "ui/widget/panel.h" +#include "ui/widget/frame.h" #include <gtkmm/entry.h> #include <gtkmm/expander.h> #include <gtkmm/frame.h> @@ -61,8 +62,8 @@ private: Gtk::Entry EntryTitle; //the entry for the object title Gtk::Label LabelDescription; //the label for the object description - Gtk::Frame FrameDescription; //the frame for the object description - Gtk::Frame FrameTextDescription; //the frame for the text of the object description + UI::Widget::Frame FrameDescription; //the frame for the object description + Gtk::Frame FrameTextDescription; //the frame for the text of the object description Gtk::TextView TextViewDescription; //the text view object showing the object description Gtk::HBox HBoxCheck; // the HBox for the check boxes diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index b09096e63..791b49af9 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -64,7 +64,7 @@ namespace Dialog { TextEdit::TextEdit() : UI::Widget::Panel("", "/dialogs/textandfont", SP_VERB_DIALOG_TEXT), font_label(_("_Font"), true), - layout_frame(_("Layout")), + layout_frame(), text_label(_("_Text"), true), setasdefault_button(_("Set as _default")), close_button(Gtk::Stock::CLOSE), @@ -134,6 +134,7 @@ This conditional and its #else block can be deleted in the future. gtk_widget_set_tooltip_text (px, _("Spacing between lines (percent of font size)")); gtk_widget_set_tooltip_text (spacing_combo, _("Spacing between lines (percent of font size)")); layout_hbox.pack_start(*Gtk::manage(Glib::wrap(spacing_combo)), false, false); + layout_frame.set_padding(4,4,4,4); layout_frame.add(layout_hbox); /* Font preview */ diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index e750677c8..9fd9baa30 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -25,6 +25,7 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/separator.h> #include "ui/widget/panel.h" +#include "ui/widget/frame.h" #include "ui/dialog/desktop-tracker.h" class SPItem; @@ -165,7 +166,7 @@ private: Gtk::HBox fontsel_hbox; SPFontSelector *fsel; - Gtk::Frame layout_frame; + Gtk::Alignment layout_frame; Gtk::HBox layout_hbox; Gtk::RadioButton align_left; Gtk::RadioButton align_center; diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index 2751a9953..a6495c205 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -19,6 +19,7 @@ #include <gtkmm/notebook.h> #include <gtkmm/frame.h> #include "ui/widget/spinbutton.h" +#include "ui/widget/frame.h" #include <gtkmm/stock.h> #include <gtk/gtk.h> //for GTK_RESPONSE* types @@ -105,14 +106,14 @@ class TraceDialogImpl : public TraceDialog //# Single scan mode //brightness - Gtk::Frame modeBrightnessFrame; + UI::Widget::Frame modeBrightnessFrame; Gtk::VBox modeBrightnessVBox; Gtk::HBox modeBrightnessBox; Gtk::RadioButton modeBrightnessRadioButton; Gtk::Label modeBrightnessSpinnerLabel; Inkscape::UI::Widget::SpinButton modeBrightnessSpinner; //edge detection - Gtk::Frame modeCannyFrame; + UI::Widget::Frame modeCannyFrame; Gtk::HBox modeCannyBox; Gtk::VBox modeCannyVBox; Gtk::RadioButton modeCannyRadioButton; @@ -122,7 +123,7 @@ class TraceDialogImpl : public TraceDialog Gtk::Label modeCannyHiSpinnerLabel; Inkscape::UI::Widget::SpinButton modeCannyHiSpinner; //quantization - Gtk::Frame modeQuantFrame; + UI::Widget::Frame modeQuantFrame; Gtk::HBox modeQuantBox; Gtk::VBox modeQuantVBox; Gtk::RadioButton modeQuantRadioButton; @@ -133,7 +134,7 @@ class TraceDialogImpl : public TraceDialog Gtk::HBox modeInvertBox; //# Multiple path scanning mode - Gtk::Frame modeMultiScanFrame; + UI::Widget::Frame modeMultiScanFrame; Gtk::VBox modeMultiScanVBox; //brightness Gtk::HBox modeMultiScanHBox1; @@ -158,7 +159,7 @@ class TraceDialogImpl : public TraceDialog // potrace parameters - Gtk::Frame optionsFrame; + UI::Widget::Frame optionsFrame; Gtk::VBox optionsVBox; Gtk::HBox optionsSpecklesBox; Gtk::CheckButton optionsSpecklesButton; @@ -190,7 +191,7 @@ class TraceDialogImpl : public TraceDialog //#### Preview - Gtk::Frame previewFrame; + UI::Widget::Frame previewFrame; Gtk::VBox previewVBox; Gtk::Button previewButton; Gtk::Image previewImage; diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert index 4dc83a81d..cea869300 100644 --- a/src/ui/widget/Makefile_insert +++ b/src/ui/widget/Makefile_insert @@ -19,6 +19,8 @@ ink_common_sources += \ ui/widget/entry.h \ ui/widget/filter-effect-chooser.h \ ui/widget/filter-effect-chooser.cpp \ + ui/widget/frame.cpp \ + ui/widget/frame.h \ ui/widget/handlebox.cpp \ ui/widget/handlebox.h \ ui/widget/icon-widget.cpp \ 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 : diff --git a/src/ui/widget/frame.h b/src/ui/widget/frame.h new file mode 100644 index 000000000..cf736d8a1 --- /dev/null +++ b/src/ui/widget/frame.h @@ -0,0 +1,79 @@ +/* + * Authors: + * Murray C + * + * Copyright (C) 2012 Authors + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_UI_WIDGET_FRAME_H +#define INKSCAPE_UI_WIDGET_FRAME_H + +#include <gtkmm.h> + +namespace Gtk { +class Frame; +} + +namespace Inkscape { +namespace UI { +namespace Widget { + +/** + * Creates a Gnome HIG style indented frame with bold label + * See http://developer.gnome.org/hig-book/stable/controls-frames.html.en + */ +class Frame : public Gtk::Frame +{ +public: + + /** + * Construct a Frame Widget. + * + * @param label The frame text. + */ + Frame(Glib::ustring const &label = "", gboolean label_bold = TRUE); + + /** + * Return the label widget + */ + Gtk::Label const *get_label_widget() const; + + /** + * Add a widget to this frame + */ + virtual void add(Widget& widget); + + /** + * Set the frame label text and if bold or not + */ + void set_label(const Glib::ustring &label, gboolean label_bold = TRUE); + + /** + * Set the frame padding + */ + void set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right); + +protected: + Gtk::Label _label; + Gtk::Alignment _alignment; + +}; + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +#endif // INKSCAPE_UI_WIDGET_FRAME_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 : |
