1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
#include "gtklabel.h"
|
|
|
|
#include "gtkmain.h"
|
|
|
|
#include "gtksignal.h"
|
|
|
|
#include "gtktogglebutton.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_LEFT_POS 4
|
|
|
|
#define DEFAULT_TOP_POS 4
|
|
|
|
#define DEFAULT_SPACING 7
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TOGGLED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
enum {
|
|
|
|
ARG_0,
|
|
|
|
ARG_ACTIVE,
|
|
|
|
ARG_DRAW_INDICATOR
|
|
|
|
};
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass);
|
|
|
|
static void gtk_toggle_button_init (GtkToggleButton *toggle_button);
|
1998-11-12 23:38:42 +00:00
|
|
|
static void gtk_toggle_button_paint (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
1999-01-12 15:12:14 +00:00
|
|
|
static void gtk_toggle_button_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
1998-11-12 23:38:42 +00:00
|
|
|
static void gtk_toggle_button_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
1999-01-12 15:12:14 +00:00
|
|
|
static gint gtk_toggle_button_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_toggle_button_pressed (GtkButton *button);
|
|
|
|
static void gtk_toggle_button_released (GtkButton *button);
|
|
|
|
static void gtk_toggle_button_clicked (GtkButton *button);
|
|
|
|
static void gtk_toggle_button_enter (GtkButton *button);
|
|
|
|
static void gtk_toggle_button_leave (GtkButton *button);
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
static void gtk_toggle_button_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_toggle_button_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_toggle_button_leave (GtkButton *button);
|
|
|
|
static void gtk_toggle_button_realize (GtkWidget *widget);
|
|
|
|
static void gtk_toggle_button_unrealize (GtkWidget *widget);
|
1998-11-13 16:07:04 +00:00
|
|
|
static void gtk_toggle_button_map (GtkWidget *widget);
|
|
|
|
static void gtk_toggle_button_unmap (GtkWidget *widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-09 15:16:28 +00:00
|
|
|
static guint toggle_button_signals[LAST_SIGNAL] = { 0 };
|
1998-11-06 22:05:02 +00:00
|
|
|
static GtkContainerClass *parent_class = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_toggle_button_get_type (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
static GtkType toggle_button_type = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!toggle_button_type)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo toggle_button_info =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
"GtkToggleButton",
|
|
|
|
sizeof (GtkToggleButton),
|
|
|
|
sizeof (GtkToggleButtonClass),
|
|
|
|
(GtkClassInitFunc) gtk_toggle_button_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_toggle_button_init,
|
1998-07-04 15:31:30 +00:00
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
1998-06-28 07:46:10 +00:00
|
|
|
(GtkClassInitFunc) NULL,
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
toggle_button_type = gtk_type_unique (GTK_TYPE_BUTTON, &toggle_button_info);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return toggle_button_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_class_init (GtkToggleButtonClass *class)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
|
|
|
GtkButtonClass *button_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) class;
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
|
|
|
container_class = (GtkContainerClass*) class;
|
|
|
|
button_class = (GtkButtonClass*) class;
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
parent_class = gtk_type_class (GTK_TYPE_BUTTON);
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gtk_object_add_arg_type ("GtkToggleButton::active", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ACTIVE);
|
|
|
|
gtk_object_add_arg_type ("GtkToggleButton::draw_indicator", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_INDICATOR);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
toggle_button_signals[TOGGLED] =
|
|
|
|
gtk_signal_new ("toggled",
|
|
|
|
GTK_RUN_FIRST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkToggleButtonClass, toggled),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__NONE,
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
gtk_object_class_add_signals (object_class, toggle_button_signals, LAST_SIGNAL);
|
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
object_class->set_arg = gtk_toggle_button_set_arg;
|
|
|
|
object_class->get_arg = gtk_toggle_button_get_arg;
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
widget_class->size_allocate = gtk_toggle_button_size_allocate;
|
1998-11-12 23:38:42 +00:00
|
|
|
widget_class->draw = gtk_toggle_button_draw;
|
1999-01-12 15:12:14 +00:00
|
|
|
widget_class->expose_event = gtk_toggle_button_expose;
|
1998-11-06 22:05:02 +00:00
|
|
|
widget_class->realize = gtk_toggle_button_realize;
|
|
|
|
widget_class->unrealize = gtk_toggle_button_unrealize;
|
1998-11-13 16:07:04 +00:00
|
|
|
widget_class->map = gtk_toggle_button_map;
|
|
|
|
widget_class->unmap = gtk_toggle_button_unmap;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
button_class->pressed = gtk_toggle_button_pressed;
|
|
|
|
button_class->released = gtk_toggle_button_released;
|
|
|
|
button_class->clicked = gtk_toggle_button_clicked;
|
1998-12-19 03:24:15 +00:00
|
|
|
button_class->enter = gtk_toggle_button_enter;
|
|
|
|
button_class->leave = gtk_toggle_button_leave;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
class->toggled = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_init (GtkToggleButton *toggle_button)
|
|
|
|
{
|
|
|
|
toggle_button->active = FALSE;
|
|
|
|
toggle_button->draw_indicator = FALSE;
|
1999-01-12 15:12:14 +00:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GtkWidget*
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_toggle_button_new (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return GTK_WIDGET (gtk_type_new (gtk_toggle_button_get_type ()));
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
gtk_toggle_button_new_with_label (const gchar *label)
|
|
|
|
{
|
|
|
|
GtkWidget *toggle_button;
|
|
|
|
GtkWidget *label_widget;
|
|
|
|
|
|
|
|
toggle_button = gtk_toggle_button_new ();
|
|
|
|
label_widget = gtk_label_new (label);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label_widget), 0.5, 0.5);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (toggle_button), label_widget);
|
|
|
|
gtk_widget_show (label_widget);
|
|
|
|
|
|
|
|
return toggle_button;
|
|
|
|
}
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
static void
|
|
|
|
gtk_toggle_button_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkToggleButton *tb;
|
|
|
|
|
|
|
|
tb = GTK_TOGGLE_BUTTON (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_ACTIVE:
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_toggle_button_set_active (tb, GTK_VALUE_BOOL (*arg));
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
break;
|
|
|
|
case ARG_DRAW_INDICATOR:
|
|
|
|
gtk_toggle_button_set_mode (tb, GTK_VALUE_BOOL (*arg));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkToggleButton *tb;
|
|
|
|
|
|
|
|
tb = GTK_TOGGLE_BUTTON (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_ACTIVE:
|
|
|
|
GTK_VALUE_BOOL (*arg) = tb->active;
|
|
|
|
break;
|
|
|
|
case ARG_DRAW_INDICATOR:
|
|
|
|
GTK_VALUE_BOOL (*arg) = tb->draw_indicator;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
|
1999-01-11 18:49:54 +00:00
|
|
|
gboolean draw_indicator)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
GtkWidget *widget;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (toggle_button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
widget = GTK_WIDGET (toggle_button);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
draw_indicator = draw_indicator ? TRUE : FALSE;
|
|
|
|
|
|
|
|
if (toggle_button->draw_indicator != draw_indicator)
|
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (toggle_button))
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
gboolean visible = GTK_WIDGET_VISIBLE (toggle_button);
|
|
|
|
|
|
|
|
if (visible)
|
|
|
|
gtk_widget_hide (widget);
|
|
|
|
|
|
|
|
gtk_widget_unrealize (widget);
|
1998-11-06 22:05:02 +00:00
|
|
|
toggle_button->draw_indicator = draw_indicator;
|
1999-01-12 15:12:14 +00:00
|
|
|
|
|
|
|
if (toggle_button->draw_indicator)
|
|
|
|
GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
|
|
|
|
else
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_widget_realize (widget);
|
|
|
|
|
|
|
|
if (visible)
|
|
|
|
gtk_widget_show (widget);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
else
|
1999-01-12 15:12:14 +00:00
|
|
|
{
|
|
|
|
toggle_button->draw_indicator = draw_indicator;
|
|
|
|
|
|
|
|
if (toggle_button->draw_indicator)
|
|
|
|
GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
|
|
|
|
else
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (toggle_button))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-21 00:37:48 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
|
|
|
|
gboolean is_active)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (toggle_button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
is_active = is_active != 0;
|
|
|
|
|
|
|
|
if (toggle_button->active != is_active)
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_button_clicked (GTK_BUTTON (toggle_button));
|
|
|
|
}
|
|
|
|
|
1999-01-21 00:37:48 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
gtk_toggle_button_get_active (GtkToggleButton *toggle_button)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (toggle_button != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button), FALSE);
|
|
|
|
|
|
|
|
return (toggle_button->active) ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_toggle_button_toggled (GtkToggleButton *toggle_button)
|
|
|
|
{
|
1999-01-11 18:49:54 +00:00
|
|
|
g_return_if_fail (toggle_button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (toggle_button), toggle_button_signals[TOGGLED]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
1998-11-12 23:38:42 +00:00
|
|
|
gtk_toggle_button_paint (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkButton *button;
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
GtkShadowType shadow_type;
|
|
|
|
gint width, height;
|
|
|
|
gint x, y;
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
button = GTK_BUTTON (widget);
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (widget);
|
|
|
|
|
1998-03-26 21:57:45 +00:00
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
1998-03-26 21:57:45 +00:00
|
|
|
width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
|
|
|
|
height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-11-12 23:38:42 +00:00
|
|
|
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
|
|
|
|
gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_HAS_DEFAULT (widget) &&
|
|
|
|
GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
|
|
|
|
{
|
|
|
|
gtk_paint_box (widget->style, widget->window,
|
|
|
|
GTK_STATE_NORMAL, GTK_SHADOW_IN,
|
|
|
|
area, widget, "togglebuttondefault",
|
|
|
|
x, y, width, height);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_CAN_DEFAULT (widget))
|
|
|
|
{
|
|
|
|
x += widget->style->klass->xthickness;
|
|
|
|
y += widget->style->klass->ythickness;
|
|
|
|
width -= 2 * x + DEFAULT_SPACING;
|
|
|
|
height -= 2 * y + DEFAULT_SPACING;
|
|
|
|
x += DEFAULT_LEFT_POS;
|
|
|
|
y += DEFAULT_TOP_POS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
{
|
|
|
|
x += 1;
|
|
|
|
y += 1;
|
|
|
|
width -= 2;
|
|
|
|
height -= 2;
|
|
|
|
}
|
|
|
|
|
1998-11-12 23:38:42 +00:00
|
|
|
if ((GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE) ||
|
|
|
|
toggle_button->active)
|
1997-11-24 22:37:52 +00:00
|
|
|
shadow_type = GTK_SHADOW_IN;
|
|
|
|
else
|
|
|
|
shadow_type = GTK_SHADOW_OUT;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
if (button->relief != GTK_RELIEF_NONE ||
|
|
|
|
(GTK_WIDGET_STATE(widget) != GTK_STATE_NORMAL &&
|
|
|
|
GTK_WIDGET_STATE(widget) != GTK_STATE_INSENSITIVE))
|
1998-11-12 23:38:42 +00:00
|
|
|
gtk_paint_box (widget->style, widget->window,
|
|
|
|
GTK_WIDGET_STATE (widget),
|
|
|
|
shadow_type, area, widget, "togglebutton",
|
|
|
|
x, y, width, height);
|
1999-01-11 18:49:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
{
|
|
|
|
x -= 1;
|
|
|
|
y -= 1;
|
|
|
|
width += 2;
|
|
|
|
height += 2;
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_paint_focus (widget->style, widget->window,
|
1998-11-12 23:38:42 +00:00
|
|
|
area, widget, "togglebutton",
|
1998-11-06 22:05:02 +00:00
|
|
|
x, y, width - 1, height - 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-11-12 23:38:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
static void
|
|
|
|
gtk_toggle_button_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
|
|
|
if (!GTK_WIDGET_NO_WINDOW (widget) &&
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->size_allocate)
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_toggle_button_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
|
|
|
{
|
|
|
|
if (!GTK_WIDGET_NO_WINDOW (widget) &&
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->expose_event)
|
|
|
|
return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-11-12 23:38:42 +00:00
|
|
|
static void
|
|
|
|
gtk_toggle_button_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
|
|
|
{
|
|
|
|
GdkRectangle child_area;
|
|
|
|
GdkRectangle tmp_area;
|
1999-01-11 18:49:54 +00:00
|
|
|
GtkBin *bin;
|
1998-11-12 23:38:42 +00:00
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
|
|
|
|
g_return_if_fail (area != NULL);
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
bin = GTK_BIN (widget);
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
if (GTK_WIDGET_DRAWABLE (widget) && !GTK_WIDGET_NO_WINDOW (widget))
|
1998-11-12 23:38:42 +00:00
|
|
|
{
|
|
|
|
tmp_area = *area;
|
1999-01-11 18:49:54 +00:00
|
|
|
tmp_area.x -= GTK_CONTAINER (widget)->border_width;
|
|
|
|
tmp_area.y -= GTK_CONTAINER (widget)->border_width;
|
1998-11-12 23:38:42 +00:00
|
|
|
|
|
|
|
gtk_toggle_button_paint (widget, &tmp_area);
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
if (bin->child && gtk_widget_intersect (bin->child, &tmp_area, &child_area))
|
|
|
|
gtk_widget_draw (bin->child, &child_area);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_pressed (GtkButton *button)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
GtkStateType new_state;
|
|
|
|
|
|
|
|
g_return_if_fail (button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
|
|
|
|
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (button);
|
|
|
|
|
|
|
|
button->button_down = TRUE;
|
|
|
|
|
|
|
|
if (toggle_button->active)
|
|
|
|
new_state = (button->in_button ? GTK_STATE_NORMAL : GTK_STATE_ACTIVE);
|
|
|
|
else
|
|
|
|
new_state = (button->in_button ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_STATE (button) != new_state)
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_widget_set_state (GTK_WIDGET (button), new_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_released (GtkButton *button)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
GtkStateType new_state;
|
|
|
|
|
|
|
|
g_return_if_fail (button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
|
|
|
|
|
|
|
|
if (button->button_down)
|
|
|
|
{
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (button);
|
|
|
|
|
|
|
|
button->button_down = FALSE;
|
|
|
|
|
|
|
|
if (button->in_button)
|
|
|
|
{
|
|
|
|
gtk_button_clicked (button);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (toggle_button->active)
|
|
|
|
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
|
|
|
|
else
|
|
|
|
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_STATE (button) != new_state)
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_widget_set_state (GTK_WIDGET (button), new_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_clicked (GtkButton *button)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
GtkStateType new_state;
|
|
|
|
|
|
|
|
g_return_if_fail (button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
|
|
|
|
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (button);
|
|
|
|
toggle_button->active = !toggle_button->active;
|
|
|
|
|
|
|
|
gtk_toggle_button_toggled (toggle_button);
|
|
|
|
|
|
|
|
if (toggle_button->active)
|
|
|
|
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
|
|
|
|
else
|
|
|
|
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_STATE (button) != new_state)
|
|
|
|
gtk_widget_set_state (GTK_WIDGET (button), new_state);
|
1999-01-11 18:49:54 +00:00
|
|
|
else
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (button));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_enter (GtkButton *button)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
GtkStateType new_state;
|
|
|
|
|
|
|
|
g_return_if_fail (button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
|
|
|
|
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (button);
|
|
|
|
|
|
|
|
if (toggle_button->active)
|
|
|
|
new_state = (button->button_down ? GTK_STATE_NORMAL : GTK_STATE_PRELIGHT);
|
|
|
|
else
|
|
|
|
new_state = (button->button_down ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_STATE (button) != new_state)
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_widget_set_state (GTK_WIDGET (button), new_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_leave (GtkButton *button)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
GtkStateType new_state;
|
|
|
|
|
|
|
|
g_return_if_fail (button != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
|
|
|
|
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (button);
|
|
|
|
|
|
|
|
new_state = (toggle_button->active ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_STATE (button) != new_state)
|
1999-01-11 18:49:54 +00:00
|
|
|
gtk_widget_set_state (GTK_WIDGET (button), new_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_realize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
GdkWindowAttr attributes;
|
|
|
|
gint attributes_mask;
|
|
|
|
gint border_width;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
|
|
|
|
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (widget);
|
|
|
|
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
|
|
|
|
|
|
|
border_width = GTK_CONTAINER (widget)->border_width;
|
|
|
|
|
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
|
|
|
attributes.x = widget->allocation.x + border_width;
|
|
|
|
attributes.y = widget->allocation.y + border_width;
|
|
|
|
attributes.width = widget->allocation.width - border_width * 2;
|
|
|
|
attributes.height = widget->allocation.height - border_width * 2;
|
|
|
|
attributes.event_mask = gtk_widget_get_events (widget);
|
|
|
|
attributes.event_mask |= (GDK_EXPOSURE_MASK |
|
|
|
|
GDK_BUTTON_PRESS_MASK |
|
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
|
|
|
GDK_ENTER_NOTIFY_MASK |
|
|
|
|
GDK_LEAVE_NOTIFY_MASK);
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
if (GTK_WIDGET_NO_WINDOW (widget))
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
attributes.wclass = GDK_INPUT_ONLY;
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
widget->window = gtk_widget_get_parent_window (widget);
|
|
|
|
gdk_window_ref (widget->window);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
1999-01-11 18:49:54 +00:00
|
|
|
toggle_button->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
|
|
|
&attributes, attributes_mask);
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_window_set_user_data (toggle_button->event_window, toggle_button);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
|
|
|
attributes.visual = gtk_widget_get_visual (widget);
|
|
|
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
1999-01-11 18:49:54 +00:00
|
|
|
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
|
|
|
&attributes, attributes_mask);
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_window_set_user_data (widget->window, toggle_button);
|
|
|
|
}
|
1998-12-07 06:37:27 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
1998-12-07 06:37:27 +00:00
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
if (!GTK_WIDGET_NO_WINDOW (widget))
|
1998-12-07 06:37:27 +00:00
|
|
|
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
1998-11-06 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_unrealize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
|
|
|
|
|
|
|
|
toggle_button = GTK_TOGGLE_BUTTON (widget);
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
if (GTK_WIDGET_NO_WINDOW (widget))
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
|
|
|
gdk_window_set_user_data (toggle_button->event_window, NULL);
|
|
|
|
gdk_window_destroy (toggle_button->event_window);
|
|
|
|
toggle_button->event_window = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
|
|
|
|
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
|
|
|
|
}
|
1998-11-13 16:07:04 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_map (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
if (GTK_WIDGET_NO_WINDOW (widget))
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_window_show (GTK_TOGGLE_BUTTON (widget)->event_window);
|
1998-11-13 16:07:04 +00:00
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_unmap (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
|
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
if (GTK_WIDGET_NO_WINDOW (widget))
|
1999-01-11 18:49:54 +00:00
|
|
|
gdk_window_hide (GTK_TOGGLE_BUTTON (widget)->event_window);
|
1998-11-13 16:07:04 +00:00
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
|
|
|
|
}
|