diff options
| author | kamalpreetgrewal <grewalkamal005@gmail.com> | 2016-07-26 16:15:08 +0000 |
|---|---|---|
| committer | kamalpreetgrewal <grewalkamal005@gmail.com> | 2016-07-26 16:15:08 +0000 |
| commit | 39c55178f470bf12c6a7fc51d5d17b65b319faf2 (patch) | |
| tree | e0ace3704585743c55074375ab3ce21a6b18d017 /src/ui/dialog/cssdialog.cpp | |
| parent | Add robust implementation of _getSelectorVec() (diff) | |
| download | inkscape-39c55178f470bf12c6a7fc51d5d17b65b319faf2.tar.gz inkscape-39c55178f470bf12c6a7fc51d5d17b65b319faf2.zip | |
Add functionality to add and delete CSS property in CSS panel
(bzr r14949.1.61)
Diffstat (limited to 'src/ui/dialog/cssdialog.cpp')
| -rw-r--r-- | src/ui/dialog/cssdialog.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index 9007faafc..cd2f74d15 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -22,6 +22,23 @@ namespace UI { namespace Dialog { /** + * @brief CssDialog::_styleButton + * @param btn + * @param iconName + * @param tooltip + * This function sets the style of '+'button at the bottom of dialog. + */ +void CssDialog::_styleButton(Gtk::Button& btn, char const* iconName, + char const* tooltip) +{ + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show(child); + btn.add(*manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); + btn.set_tooltip_text (tooltip); +} + +/** * Constructor * A treeview whose each row corresponds to a CSS property of selector selected. * TODO: Further, buttons to add and delete properties will be added. @@ -54,10 +71,18 @@ CssDialog::CssDialog(): int nameColNum = _treeView.append_column("Property", *_textRenderer) - 1; _propCol = _treeView.get_column(nameColNum); + create = manage(new Gtk::Button()); + _styleButton(*create, "list-add", "Add a new property"); + + _mainBox.pack_end(_buttonBox, Gtk::PACK_SHRINK); + _buttonBox.pack_start(*create, Gtk::PACK_SHRINK); + _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); _targetDesktop = getDesktop(); setDesktop(_targetDesktop); + + create->signal_clicked().connect(sigc::mem_fun(*this, &CssDialog::_addProperty)); } CssDialog::~CssDialog() @@ -70,6 +95,18 @@ void CssDialog::setDesktop( SPDesktop* desktop ) _desktop = desktop; } +/** + * @brief CssDialog::_addProperty + * This function is a slot to signal_clicked for '+' button at the bottom of CSS + * panel. A new row is added, double clicking which text for new property can be + * added. _newProperty is set to true in which case the value is appended. + */ +void CssDialog::_addProperty() +{ + _propRow = *(_store->append()); + _newProperty = true; +} + } // namespace Dialog } // namespace UI } // namespace Inkscape |
