diff options
| author | Stefano Facchini <stefano.facchini@gmail.com> | 2017-10-22 08:43:29 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2018-01-17 08:38:21 +0000 |
| commit | 9c354be236724132dcb03732b278113d13575f61 (patch) | |
| tree | 172b36d59850d5fa14745f051d8740dede51fa3d /src | |
| parent | Move code related to SwatchesPanel where it belongs (diff) | |
| download | inkscape-9c354be236724132dcb03732b278113d13575f61.tar.gz inkscape-9c354be236724132dcb03732b278113d13575f61.zip | |
panel: Cleanup code
- fold _addResponseButton into addResponseButton
- remove unused setDefaultResponse
- includes cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/swatches.h | 7 | ||||
| -rw-r--r-- | src/ui/widget/panel.cpp | 27 | ||||
| -rw-r--r-- | src/ui/widget/panel.h | 9 |
3 files changed, 14 insertions, 29 deletions
diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h index 33715cde3..8bc379ef9 100644 --- a/src/ui/dialog/swatches.h +++ b/src/ui/dialog/swatches.h @@ -12,11 +12,16 @@ #include <gtkmm/eventbox.h> #include <gtkmm/image.h> -#include <gtkmm/menu.h> #include "ui/widget/panel.h" #include "enums.h" +namespace Gtk { + class Menu; + class MenuItem; + class CheckMenuItem; +} + namespace Inkscape { namespace UI { diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 7ace6bf9e..281e6e21a 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -47,8 +47,8 @@ Panel::Panel(gchar const *prefs_path, int verb_num) : _verb_num(verb_num), _action_area(0) { - set_name( "InkscapePanel" ); - set_orientation( Gtk::ORIENTATION_VERTICAL ); + set_name("InkscapePanel"); + set_orientation(Gtk::ORIENTATION_VERTICAL); signalResponse().connect(sigc::mem_fun(*this, &Panel::_handleResponse)); signalActivateDesktop().connect(sigc::mem_fun(*this, &Panel::setDesktop)); @@ -99,13 +99,6 @@ void Panel::_apply() Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id, bool pack_start) { - Gtk::Button *button = new Gtk::Button(button_text, true); - _addResponseButton(button, response_id, pack_start); - return button; -} - -void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_start) -{ // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { _action_area = new Gtk::ButtonBox(); @@ -115,10 +108,12 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_s pack_end(*_action_area, Gtk::PACK_SHRINK, 0); } + Gtk::Button *button = new Gtk::Button(button_text, true); + _action_area->pack_end(*button); if (pack_start) { - _action_area->set_child_secondary( *button , true); + _action_area->set_child_secondary(*button , true); } if (response_id != 0) { @@ -126,18 +121,8 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_s button->signal_clicked().connect(sigc::bind(_signal_response.make_slot(), response_id)); _response_map[response_id] = button; } -} - -void Panel::setDefaultResponse(int response_id) -{ - ResponseMap::iterator widget_found; - widget_found = _response_map.find(response_id); - if (widget_found != _response_map.end()) { - widget_found->second->activate(); - widget_found->second->property_can_default() = true; - widget_found->second->grab_default(); - } + return button; } void Panel::setResponseSensitive(int response_id, bool setting) diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 764ff1db1..1461bdf2a 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -18,17 +18,14 @@ #endif #include <gtkmm/box.h> -#include "enums.h" #include <map> class SPDesktop; class SPDocument; namespace Gtk { - class CheckMenuItem; - class Button; - class ButtonBox; - class MenuItem; + class Button; + class ButtonBox; } struct InkscapeApplication; @@ -83,7 +80,6 @@ public: /* Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE * signals on click. */ Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id, bool pack_start=false); - void setDefaultResponse(int response_id); void setResponseSensitive(int response_id, bool setting); /* Return signals. Signals emitted by PanelDialog. */ @@ -101,7 +97,6 @@ protected: virtual void _handleResponse(int response_id); /* Helper methods */ - void _addResponseButton(Gtk::Button *button, int response_id, bool pack_start=false); Inkscape::Selection *_getSelection(); /** |
