[gtkmm] Widget: Add set_margin().



commit e66ff815b1d8a6f9ce4891ad369d053cd56efadd
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Dec 17 21:15:54 2016 +0100

    Widget: Add set_margin().
    
    This is slightly nicer than using property_margin(),
    which is apparently the appropriate replacement for
    Gtk::Container::set_border_width(),
    or gtk_container_set_border_width.
    That GtkWidget margin property sets all 4 other properties.

 gtk/src/widget.ccg |    5 +++++
 gtk/src/widget.hg  |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/src/widget.ccg b/gtk/src/widget.ccg
index 30ac2ee..d32c2ed 100644
--- a/gtk/src/widget.ccg
+++ b/gtk/src/widget.ccg
@@ -560,4 +560,9 @@ void Widget::remove_action_group(const Glib::ustring& name)
   gtk_widget_insert_action_group(gobj(), name.c_str(), nullptr /* see C docs */);
 }
 
+void Widget::set_margin(int margin)
+{
+  property_margin() = margin;
+}
+
 } // namespace Gtk
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 4973f3d..7c7b3bc 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -364,6 +364,11 @@ public:
   _WRAP_METHOD(int get_margin_bottom() const, gtk_widget_get_margin_bottom)
   _WRAP_METHOD(void set_margin_bottom(int margin), gtk_widget_set_margin_bottom)
 
+  /** Set all 4 margins to the same value.
+   * @param margin The start, end, top, and bottom margin.
+   */
+  void set_margin(int margin);
+
   _WRAP_METHOD(Gdk::EventMask get_events() const, gtk_widget_get_events)
   _WRAP_METHOD(Gdk::EventMask get_device_events(const Glib::RefPtr<const Gdk::Device>& device) const, 
gtk_widget_get_device_events)
   _WRAP_METHOD(bool is_ancestor(Widget &ancestor) const, gtk_widget_is_ancestor)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]