From 8d47c5cda33ba5cac262ee11df713ac88b56d021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20P=2E=20Gon=C3=A7alves?= Date: Mon, 27 May 2019 21:00:08 -0300 Subject: [PATCH] Added GtkSeparatorToolItem and some GtkWindow --- main.cpp | 9 +++++++++ main.h | 1 + src/GtkSeparatorToolItem.cpp | 34 ++++++++++++++++++++++++++++++++++ src/GtkSeparatorToolItem.h | 35 +++++++++++++++++++++++++++++++++++ src/GtkWindow.cpp | 4 ++-- 5 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 src/GtkSeparatorToolItem.cpp create mode 100644 src/GtkSeparatorToolItem.h diff --git a/main.cpp b/main.cpp index 9e484b9..07d4111 100644 --- a/main.cpp +++ b/main.cpp @@ -1298,6 +1298,14 @@ extern "C" gtktoolitem.method<&GtkToolItem_::get_text_size_group>("get_text_size_group"); + // GtkSeparatorToolItem + Php::Class gtkseparatortoolitem("GtkSeparatorToolItem"); + gtkseparatortoolitem.extends(gtktoolitem); + gtkseparatortoolitem.method<&GtkSeparatorToolItem_::__construct>("__construct"); + gtkseparatortoolitem.method<&GtkSeparatorToolItem_::set_draw>("set_draw"); + gtkseparatortoolitem.method<&GtkSeparatorToolItem_::get_draw>("get_draw"); + + // GtkToolbar Php::Class gtktoolbar("GtkToolbar"); gtktoolbar.extends(gtkcontainer); @@ -1635,6 +1643,7 @@ extern "C" extension.add(std::move(gtkreliefstyle)); extension.add(std::move(gtksizegroup)); extension.add(std::move(gtktoolitem)); + extension.add(std::move(gtkseparatortoolitem)); extension.add(std::move(gtktoolbar)); extension.add(std::move(gtktoolbutton)); extension.add(std::move(gtktexttagtable)); diff --git a/main.h b/main.h index 0625b2a..3b37323 100644 --- a/main.h +++ b/main.h @@ -101,6 +101,7 @@ #include "src/GtkToolItem.h" #include "src/GtkToolButton.h" + #include "src/GtkSeparatorToolItem.h" #include "src/GtkTextTagTable.h" diff --git a/src/GtkSeparatorToolItem.cpp b/src/GtkSeparatorToolItem.cpp new file mode 100644 index 0000000..63c9876 --- /dev/null +++ b/src/GtkSeparatorToolItem.cpp @@ -0,0 +1,34 @@ + +#include "GtkSeparatorToolItem.h" + +/** + * Constructor + */ +GtkSeparatorToolItem_::GtkSeparatorToolItem_() = default; + +/** + * Destructor + */ +GtkSeparatorToolItem_::~GtkSeparatorToolItem_() = default; + +void GtkSeparatorToolItem_::__construct() +{ + instance = (gpointer *)gtk_separator_tool_item_new (); + +} + +void GtkSeparatorToolItem_::set_draw(Php::Parameters ¶meters) +{ + gboolean homogeneous = (gboolean)parameters[0]; + + gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM(instance), homogeneous); + +} + +Php::Value GtkSeparatorToolItem_::get_draw() +{ + gboolean ret = gtk_separator_tool_item_get_draw (GTK_SEPARATOR_TOOL_ITEM(instance)); + + return ret; +} + diff --git a/src/GtkSeparatorToolItem.h b/src/GtkSeparatorToolItem.h new file mode 100644 index 0000000..07d471b --- /dev/null +++ b/src/GtkSeparatorToolItem.h @@ -0,0 +1,35 @@ + +#ifndef _PHPGTK_GTKSEPARATORTOOLITEM_H_ +#define _PHPGTK_GTKSEPARATORTOOLITEM_H_ + + #include + #include + + #include "GtkToolItem.h" + + /** + * GtkSeparatorToolItem_ + * + * https://developer.gnome.org/gtk3/stable/GtkSeparatorToolItem.html + */ + class GtkSeparatorToolItem_ : public GtkToolItem_ + { + /** + * Publics + */ + public: + + /** + * C++ constructor and destructor + */ + GtkSeparatorToolItem_(); + ~GtkSeparatorToolItem_(); + + void __construct(); + + void set_draw(Php::Parameters ¶meters); + + Php::Value get_draw(); + }; + +#endif diff --git a/src/GtkWindow.cpp b/src/GtkWindow.cpp index 89669d3..983a5b3 100644 --- a/src/GtkWindow.cpp +++ b/src/GtkWindow.cpp @@ -173,8 +173,8 @@ Php::Value GtkWindow_::get_position() // Cria o retorno Php::Value arr; - arr["x"] = x; - arr["y"] = y; + arr[0] = arr["x"] = x; + arr[1] = arr["y"] = y; return arr; }