[gtkmm] Wrap GtkRequisition as _CLASS_BOXEDTYPE_STATIC



commit a50fc3304f5cdd706d2e7099e7992f9707959600
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed Nov 4 18:52:43 2020 +0100

    Wrap GtkRequisition as _CLASS_BOXEDTYPE_STATIC

 gtk/src/requisition.ccg | 11 +++++++++++
 gtk/src/requisition.hg  | 25 ++++++++++++++++++++-----
 tools/m4/convert_gtk.m4 |  9 +++------
 3 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/gtk/src/requisition.ccg b/gtk/src/requisition.ccg
index fc446496..e7e580a0 100644
--- a/gtk/src/requisition.ccg
+++ b/gtk/src/requisition.ccg
@@ -14,3 +14,14 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
+
+namespace Gtk
+{
+
+Requisition::Requisition(int width, int height)
+{
+  gobject_.width  = width;
+  gobject_.height = height;
+}
+
+} // namespace Gtk
diff --git a/gtk/src/requisition.hg b/gtk/src/requisition.hg
index aaa9a07e..804ea10f 100644
--- a/gtk/src/requisition.hg
+++ b/gtk/src/requisition.hg
@@ -17,14 +17,29 @@
 
 _CONFIGINCLUDE(gtkmmconfig.h)
 
-#include <gtk/gtk.h> //TODO: Remove when we wrap it properly.
+#include <glibmm/value.h>
+#include <gtk/gtk.h>
+
 _DEFS(gtkmm,gtk)
 
 namespace Gtk
 {
 
-//TODO: Documentation.
-//TODO: Wrap this properly.
-typedef GtkRequisition Requisition;
+/** A %Gtk::Requisition represents the desired size of a widget.
+ */
+class GTKMM_API Requisition
+{
+  _CLASS_BOXEDTYPE_STATIC(Requisition, GtkRequisition, GTKMM_API)
+public:
+
+  /** Creates a new requisition instance with this size.
+   */
+  Requisition(int width, int height);
+
+  _MEMBER_GET(width, width, int, int)
+  _MEMBER_SET(width, width, int, int)
+  _MEMBER_GET(height, height, int, int)
+  _MEMBER_SET(height, height, int, int)
+};
 
-} //namespace Gtk
+} // namespace Gtk
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 30d06d5b..003ca0d0 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -397,12 +397,9 @@ _CONVERSION(const Gtk::Widget&,GtkWidget*,__CFR2P)
 
 _CONVERSION(`const Glib::RefPtr<Tooltip>&',`GtkTooltip*',__CONVERT_REFPTR_TO_P)
 
-_CONVERSION(`Requisition&', `GtkRequisition*', `($2)(&$3)')
-_CONVERSION(`const Requisition&', `GtkRequisition*', `($2)(&$3)')
-_CONVERSION(`GtkRequisition*', `Requisition&', `($2)(*$3)')
-_CONVERSION(`GtkRequisition*', `Requisition*', `($2)($3)')
-_CONVERSION(`Requisition*', `GtkRequisition*', `($2)($3)')
-_CONVERSION(`GtkRequisition', `Requisition', `static_cast<$2>($3)')
+_CONVERSION(`Requisition&', `GtkRequisition*', __FR2P)
+_CONVERSION(`const Requisition&', `GtkRequisition*', __FCR2P)
+_CONVERSION(`GtkRequisition*', `Requisition&', `Glib::wrap($3)')
 
 _CONVERSION(`Allocation&',`GtkAllocation*',`($2)($3.gobj())')
 _CONVERSION(`const Allocation&',`GtkAllocation*',`($2)($3.gobj())')


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