summaryrefslogtreecommitdiff
path: root/gtk/gtkradiobutton.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-06-24 06:25:14 +0000
committerTim Janik <timj@src.gnome.org>1998-06-24 06:25:14 +0000
commitdbce6083ef090a3971be3397f899d770b368c5e2 (patch)
tree1e2999ef5f7257a49d6df0acbe4e8dd06c7d3a5a /gtk/gtkradiobutton.c
parent00362c03f732591722343789fb22d9f6e371eafb (diff)
downloadgtk+-dbce6083ef090a3971be3397f899d770b368c5e2.tar.gz
added a frame with radio buttons to select the resize_mode for the
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org> * gtk/testgtk.c (create_idle_test): added a frame with radio buttons to select the resize_mode for the idle-labels container. * gtk/gtkframe.h: * gtk/gtkframe.c: GtkType and macro corrections. * gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to support radio grouping. Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize unconditionally if resize_mode has changed. * gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set GTK_RESIZE_QUEUE on the scrolled window. (gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport. Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.h: * gtk/gtkcontainer.c: (GTK_IS_RESIZE_CONTAINER): new macro to find out if a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT. (gtk_container_queue_resize): new function to queue a container for a *size* reallocation (doesn't affect its position, and thus its parent is left untouched usually). (gtk_container_get_resize_container): new function to retrive the next most resize container which is not itself queued for a resize. (gtk_container_idle_sizer): new function to carefully process the container_resize_queue since it can change during invokation of gtk_container_check_resize(). (gtk_container_resize_children): total rework of this function to properly handle resize containers. makes a lot of assumptions whitch are stated in the comments. * gtk/gtkcontainer.c: (gtk_container_real_check_resize): only requeue ourselves if we are not a resize container. (gtk_container_clear_resize_widgets): care for automatic deletion of our resize_widgets list on size_allocate through a handler connection. * gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the focus and default widget of a window, so to take the burden from gtk_widget_unparent. * gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried to be clever, but actually messed up the resize_children logic and caused unneccessary allocations on its whole branch. besides this, it messed up the display by not invoking a redraw after the allocation. * gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so that it is the child again that is queued for a resize. (gtk_table_attach): likewise. (gtk_table_remove): likewise.
Diffstat (limited to 'gtk/gtkradiobutton.c')
-rw-r--r--gtk/gtkradiobutton.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 52f4b290ad..741c84cf50 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -21,6 +21,11 @@
#include "gtksignal.h"
+enum {
+ ARG_0,
+ ARG_GROUP
+};
+
#define CHECK_BUTTON_CLASS(w) GTK_CHECK_BUTTON_CLASS (GTK_OBJECT (w)->klass)
@@ -30,6 +35,12 @@ static void gtk_radio_button_destroy (GtkObject *object);
static void gtk_radio_button_clicked (GtkButton *button);
static void gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
GdkRectangle *area);
+static void gtk_radio_button_set_arg (GtkRadioButton *radio_button,
+ GtkArg *arg,
+ guint arg_id);
+static void gtk_radio_button_get_arg (GtkRadioButton *radio_button,
+ GtkArg *arg,
+ guint arg_id);
static GtkCheckButtonClass *parent_class = NULL;
@@ -49,8 +60,8 @@ gtk_radio_button_get_type (void)
sizeof (GtkRadioButtonClass),
(GtkClassInitFunc) gtk_radio_button_class_init,
(GtkObjectInitFunc) gtk_radio_button_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
+ (GtkArgSetFunc) gtk_radio_button_set_arg,
+ (GtkArgGetFunc) gtk_radio_button_get_arg,
};
radio_button_type = gtk_type_unique (gtk_check_button_get_type (), &radio_button_info);
@@ -72,6 +83,8 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
parent_class = gtk_type_class (gtk_check_button_get_type ());
+ gtk_object_add_arg_type ("GtkRadioButton::group", GTK_TYPE_RADIO_BUTTON, GTK_ARG_WRITABLE, ARG_GROUP);
+
object_class->destroy = gtk_radio_button_destroy;
button_class->clicked = gtk_radio_button_clicked;
@@ -85,6 +98,40 @@ gtk_radio_button_init (GtkRadioButton *radio_button)
radio_button->group = g_slist_prepend (NULL, radio_button);
}
+static void
+gtk_radio_button_set_arg (GtkRadioButton *radio_button,
+ GtkArg *arg,
+ guint arg_id)
+{
+ switch (arg_id)
+ {
+ GSList *slist;
+
+ case ARG_GROUP:
+ if (GTK_VALUE_OBJECT (*arg))
+ slist = gtk_radio_button_group ((GtkRadioButton*) GTK_VALUE_OBJECT (*arg));
+ else
+ slist = NULL;
+ gtk_radio_button_set_group (radio_button, slist);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+gtk_radio_button_get_arg (GtkRadioButton *radio_button,
+ GtkArg *arg,
+ guint arg_id)
+{
+ switch (arg_id)
+ {
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
void
gtk_radio_button_set_group (GtkRadioButton *radio_button,
GSList *group)