com gtk/php-gtk: Implement a bunch of get_group() and set_group() methods.: ext/gtk+/gtk.overrides

[email protected] (David Soria Parra)
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    58ae6088b51037c9203e67ebe18abd5f2e6f86e9
Author:    Andrei Zmievski <[email protected]>         Mon, 24 Apr 2006 02:10:10 +0000
Parents:   12ff112fc1a0dcd4647c00f0ef088e2a0f8a8f75
Branches:  master

Link:       http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=58ae6088b51037c9203e67ebe18abd5f2e6f86e9

Log:
Implement a bunch of get_group() and set_group() methods.

Changed paths:
  M  ext/gtk+/gtk.overrides


Diff:
58ae6088b51037c9203e67ebe18abd5f2e6f86e9
diff --git a/ext/gtk+/gtk.overrides b/ext/gtk+/gtk.overrides
index a6f7b8f..dce9eee 100644
--- a/ext/gtk+/gtk.overrides
+++ b/ext/gtk+/gtk.overrides
@@ -2440,6 +2440,156 @@ PHP_METHOD
 
 %% }}}
 
+%% {{{ GtkRadioAction
+
+%%
+override gtk_radio_action_get_group
+PHP_METHOD
+{
+    GSList *group, *current;
+    zval *item;
+
+    NOT_STATIC_METHOD();
+
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), ""))
+        return;
+
+    group = gtk_radio_action_get_group(GTK_RADIO_ACTION(PHPG_GOBJECT(this_ptr)));
+
+    array_init(return_value);
+    for (current = group; current; current = current->next) {
+        MAKE_STD_ZVAL(item);
+        phpg_gobject_new(&item, G_OBJECT(current->data) TSRMLS_CC);
+        add_next_index_zval(return_value, item);
+    }
+}
+
+%%
+override gtk_radio_action_set_group
+PHP_METHOD
+{
+    zval *php_action = NULL;
+    GSList *list;
+
+    NOT_STATIC_METHOD();
+
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "O", &php_action, gtkradioaction_ce))
+        return;
+
+    list = gtk_radio_action_get_group(GTK_RADIO_ACTION(PHPG_GOBJECT(php_action)));
+    if (list == gtk_radio_action_get_group(GTK_RADIO_ACTION(PHPG_GOBJECT(this_ptr)))) {
+        return;
+    }
+    gtk_radio_action_set_group(GTK_RADIO_ACTION(PHPG_GOBJECT(this_ptr)), list);
+}
+
+%% }}}
+
+%% {{{ GtkRadioButton
+
+%%
+add-arginfo GtkRadioButton __construct
+static
+ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 0)
+    ZEND_ARG_OBJ_INFO(0, group, GtkRadioButton, 1)
+    ZEND_ARG_INFO(0, text)
+    ZEND_ARG_INFO(0, use_underline)
+ZEND_END_ARG_INFO();
+
+%%
+override gtk_radio_button_new
+PHP_METHOD
+{
+    zval *php_group = NULL;
+    char *label = NULL;
+    zend_bool free_label, use_underline = 1;
+    GtkRadioButton *group = NULL;
+    GObject *wrapped_obj;
+    GType gtype = phpg_gtype_from_zval(this_ptr);
+
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "|Nub", &php_group, gtkradiobutton_ce, &label, &free_label, &use_underline)) {
+        PHPG_THROW_CONSTRUCT_EXCEPTION(GtkRadioButton);
+    }
+
+    if (php_group && Z_TYPE_P(php_group) != IS_NULL) {
+        group = GTK_RADIO_BUTTON(PHPG_GOBJECT(php_group));
+    }
+
+    if (group) {
+        if (label) {
+            wrapped_obj = (GObject *) g_object_new(gtype, "group", group, "label", label,
+                                                   "use-underline", use_underline, NULL);
+        } else {
+            wrapped_obj = (GObject *) g_object_new(gtype, "group", group, NULL);
+        }
+    } else {
+        if (label) {
+            wrapped_obj = (GObject *) g_object_new(gtype, "label", label, "use-underline",
+                                                   use_underline, NULL);
+        } else {
+            wrapped_obj = (GObject *) g_object_new(gtype, NULL);
+        }
+    }
+
+    if (free_label) g_free(label);
+
+    if (!wrapped_obj) {
+        PHPG_THROW_CONSTRUCT_EXCEPTION(GtkRadioButton);
+    }
+    phpg_gobject_set_wrapper(this_ptr, wrapped_obj TSRMLS_CC);
+}
+
+%%
+override gtk_radio_button_get_group
+PHP_METHOD
+{
+    GSList *group, *current;
+    zval *item;
+
+    NOT_STATIC_METHOD();
+    
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), ""))
+        return;
+
+    group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(PHPG_GOBJECT(this_ptr)));
+
+    array_init(return_value);
+    for (current = group; current; current = current->next) {
+        MAKE_STD_ZVAL(item);
+        phpg_gobject_new(&item, G_OBJECT(current->data) TSRMLS_CC);
+        add_next_index_zval(return_value, item);
+    }
+}
+
+%%
+override gtk_radio_button_set_group
+PHP_METHOD
+{
+    zval *php_button = NULL;
+    GSList *list;
+
+    NOT_STATIC_METHOD();
+
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "O", &php_button, gtkradiobutton_ce))
+        return;
+
+    list = gtk_radio_button_get_group(GTK_RADIO_BUTTON(PHPG_GOBJECT(php_button)));
+    if (list == gtk_radio_button_get_group(GTK_RADIO_BUTTON(PHPG_GOBJECT(this_ptr)))) {
+        return;
+    }
+    gtk_radio_button_set_group(GTK_RADIO_BUTTON(PHPG_GOBJECT(this_ptr)), list);
+}
+
+%%
+override gtk_radio_button_group
+PHP_METHOD
+{
+    phpg_warn_deprecated("use GtkRadioButton::get_group()" TSRMLS_CC);
+    PHP_FN(GtkRadioButton_get_group)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+}
+
+%% }}}
+
 %% {{{ GtkRadioMenuItem
 %%
 add-arginfo GtkRadioMenuItem __construct
@@ -2513,7 +2663,7 @@ PHP_METHOD
 
     NOT_STATIC_METHOD();
 
-    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "V", &php_group, gtkradiomenuitem_ce)) {
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "O", &php_group, gtkradiomenuitem_ce)) {
         return;
     }
 
@@ -2546,60 +2696,6 @@ PHP_METHOD
         add_next_index_zval(return_value, item);
     }
 }
-/* }}} */
-
-%% {{{ GtkRadioButton
-%%
-add-arginfo GtkRadioButton __construct
-static
-ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 0)
-    ZEND_ARG_OBJ_INFO(0, group, GtkRadioButton, 1)
-    ZEND_ARG_INFO(0, text)
-    ZEND_ARG_INFO(0, use_underline)
-ZEND_END_ARG_INFO();
-
-%%
-override gtk_radio_button_new
-PHP_METHOD
-{
-    zval *php_group = NULL;
-    char *label = NULL;
-    zend_bool free_label, use_underline = 1;
-    GtkRadioButton *group = NULL;
-    GObject *wrapped_obj;
-    GType gtype = phpg_gtype_from_zval(this_ptr);
-
-    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "|Nub", &php_group, gtkradiobutton_ce, &label, &free_label, &use_underline)) {
-        PHPG_THROW_CONSTRUCT_EXCEPTION(GtkRadioButton);
-    }
-
-    if (php_group && Z_TYPE_P(php_group) != IS_NULL) {
-        group = GTK_RADIO_BUTTON(PHPG_GOBJECT(php_group));
-    }
-
-    if (group) {
-        if (label) {
-            wrapped_obj = (GObject *) g_object_new(gtype, "group", group, "label", label,
-                                                   "use-underline", use_underline, NULL);
-        } else {
-            wrapped_obj = (GObject *) g_object_new(gtype, "group", group, NULL);
-        }
-    } else {
-        if (label) {
-            wrapped_obj = (GObject *) g_object_new(gtype, "label", label, "use-underline",
-                                                   use_underline, NULL);
-        } else {
-            wrapped_obj = (GObject *) g_object_new(gtype, NULL);
-        }
-    }
-
-    if (free_label) g_free(label);
-
-    if (!wrapped_obj) {
-        PHPG_THROW_CONSTRUCT_EXCEPTION(GtkRadioButton);
-    }
-    phpg_gobject_set_wrapper(this_ptr, wrapped_obj TSRMLS_CC);
-}
 
 %% }}}
 
@@ -2653,6 +2749,48 @@ PHP_METHOD
     }
     phpg_gobject_set_wrapper(this_ptr, wrapped_obj TSRMLS_CC);
 }
+
+%%
+override gtk_radio_tool_button_get_group
+PHP_METHOD
+{
+    GSList *group, *current;
+    zval *item;
+
+    NOT_STATIC_METHOD();
+    
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), ""))
+        return;
+
+    group = gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(PHPG_GOBJECT(this_ptr)));
+
+    array_init(return_value);
+    for (current = group; current; current = current->next) {
+        MAKE_STD_ZVAL(item);
+        phpg_gobject_new(&item, G_OBJECT(current->data) TSRMLS_CC);
+        add_next_index_zval(return_value, item);
+    }
+}
+
+%%
+override gtk_radio_tool_button_set_group
+PHP_METHOD
+{
+    zval *php_button = NULL;
+    GSList *list;
+
+    NOT_STATIC_METHOD();
+
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "O", &php_button, gtkradiotoolbutton_ce))
+        return;
+
+    list = gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(PHPG_GOBJECT(php_button)));
+    if (list == gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(PHPG_GOBJECT(this_ptr)))) {
+        return;
+    }
+    gtk_radio_tool_button_set_group(GTK_RADIO_TOOL_BUTTON(PHPG_GOBJECT(this_ptr)), list);
+}
+
 %% }}}
 
 %% {{{ GtkRuler
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.