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
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser 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
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtklabel.h"
|
|
|
|
#include "gtkmain.h"
|
|
|
|
#include "gtksignal.h"
|
|
|
|
#include "gtktogglebutton.h"
|
2001-05-13 22:41:30 +00:00
|
|
|
#include "gtkintl.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
#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 {
|
2001-05-13 22:41:30 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_ACTIVE,
|
|
|
|
PROP_INCONSISTENT,
|
|
|
|
PROP_DRAW_INDICATOR
|
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
|
|
|
};
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-05-13 22:41:30 +00:00
|
|
|
static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass);
|
|
|
|
static void gtk_toggle_button_init (GtkToggleButton *toggle_button);
|
|
|
|
static void gtk_toggle_button_paint (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
|
|
|
static void gtk_toggle_button_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
static gint gtk_toggle_button_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
|
|
|
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_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_toggle_button_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_toggle_button_realize (GtkWidget *widget);
|
|
|
|
static void gtk_toggle_button_unrealize (GtkWidget *widget);
|
|
|
|
static void gtk_toggle_button_map (GtkWidget *widget);
|
|
|
|
static void gtk_toggle_button_unmap (GtkWidget *widget);
|
2001-08-25 23:11:46 +00:00
|
|
|
static void gtk_toggle_button_update_state (GtkButton *button);
|
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;
|
2001-05-13 22:41:30 +00:00
|
|
|
GObjectClass *gobject_class;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
|
|
|
GtkButtonClass *button_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) class;
|
2001-05-13 22:41:30 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (class);
|
1997-11-24 22:37:52 +00:00
|
|
|
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);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-05-13 22:41:30 +00:00
|
|
|
gobject_class->set_property = gtk_toggle_button_set_property;
|
|
|
|
gobject_class->get_property = gtk_toggle_button_get_property;
|
1998-06-28 07:46:10 +00:00
|
|
|
|
1999-01-12 15:12:14 +00:00
|
|
|
widget_class->size_allocate = gtk_toggle_button_size_allocate;
|
|
|
|
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;
|
2001-08-25 23:11:46 +00:00
|
|
|
button_class->enter = gtk_toggle_button_update_state;
|
|
|
|
button_class->leave = gtk_toggle_button_update_state;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
class->toggled = NULL;
|
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
2000-12-13 01:34:41 +00:00
|
|
|
|
2001-05-13 22:41:30 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_ACTIVE,
|
|
|
|
g_param_spec_boolean ("active",
|
|
|
|
_("Active"),
|
|
|
|
_("If the toggle button should be pressed in or not"),
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_INCONSISTENT,
|
|
|
|
g_param_spec_boolean ("inconsistent",
|
|
|
|
_("Inconsistent"),
|
|
|
|
_("If the toggle button is in an \"in between\" state."),
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_DRAW_INDICATOR,
|
|
|
|
g_param_spec_boolean ("draw_indicator",
|
|
|
|
_("Draw Indicator"),
|
|
|
|
_("If the toggle part of the button is displayed"),
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE));
|
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
2000-12-13 01:34:41 +00:00
|
|
|
|
|
|
|
toggle_button_signals[TOGGLED] =
|
|
|
|
gtk_signal_new ("toggled",
|
|
|
|
GTK_RUN_FIRST,
|
|
|
|
GTK_CLASS_TYPE (object_class),
|
|
|
|
GTK_SIGNAL_OFFSET (GtkToggleButtonClass, toggled),
|
|
|
|
gtk_marshal_VOID__VOID,
|
|
|
|
GTK_TYPE_NONE, 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2001-08-27 01:05:07 +00:00
|
|
|
return g_object_new (GTK_TYPE_TOGGLE_BUTTON, "label", label, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 18:22:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_toggle_button_new_with_mnemonic:
|
|
|
|
* @label: the text of the button, with an underscore in front of the
|
|
|
|
* mnemonic character
|
|
|
|
* @returns: a new #GtkToggleButton
|
|
|
|
*
|
|
|
|
* Creates a new #GtkToggleButton containing a label. The label
|
|
|
|
* will be created using gtk_label_new_with_mnemonic(), so underscores
|
|
|
|
* in @label indicate the mnemonic for the button.
|
|
|
|
**/
|
|
|
|
GtkWidget*
|
|
|
|
gtk_toggle_button_new_with_mnemonic (const gchar *label)
|
|
|
|
{
|
2001-08-27 01:05:07 +00:00
|
|
|
return g_object_new (GTK_TYPE_TOGGLE_BUTTON, "label", label, "use_underline", TRUE, NULL);
|
2001-06-05 18:22:30 +00:00
|
|
|
}
|
|
|
|
|
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
|
2001-05-13 22:41:30 +00:00
|
|
|
gtk_toggle_button_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
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
|
|
|
{
|
|
|
|
GtkToggleButton *tb;
|
|
|
|
|
|
|
|
tb = GTK_TOGGLE_BUTTON (object);
|
|
|
|
|
2001-05-13 22:41:30 +00:00
|
|
|
switch (prop_id)
|
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
|
|
|
{
|
2001-05-13 22:41:30 +00:00
|
|
|
case PROP_ACTIVE:
|
|
|
|
gtk_toggle_button_set_active (tb, g_value_get_boolean (value));
|
|
|
|
break;
|
|
|
|
case PROP_INCONSISTENT:
|
|
|
|
gtk_toggle_button_set_inconsistent (tb, g_value_get_boolean (value));
|
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;
|
2001-05-13 22:41:30 +00:00
|
|
|
case PROP_DRAW_INDICATOR:
|
|
|
|
gtk_toggle_button_set_mode (tb, g_value_get_boolean (value));
|
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;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-05-13 22:41:30 +00:00
|
|
|
gtk_toggle_button_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
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
|
|
|
{
|
|
|
|
GtkToggleButton *tb;
|
|
|
|
|
|
|
|
tb = GTK_TOGGLE_BUTTON (object);
|
|
|
|
|
2001-05-13 22:41:30 +00:00
|
|
|
switch (prop_id)
|
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
|
|
|
{
|
2001-05-13 22:41:30 +00:00
|
|
|
case PROP_ACTIVE:
|
|
|
|
g_value_set_boolean (value, tb->active);
|
|
|
|
break;
|
|
|
|
case PROP_INCONSISTENT:
|
|
|
|
g_value_set_boolean (value, tb->inconsistent);
|
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;
|
2001-05-13 22:41:30 +00:00
|
|
|
case PROP_DRAW_INDICATOR:
|
|
|
|
g_value_set_boolean (value, tb->draw_indicator);
|
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;
|
|
|
|
default:
|
2001-05-13 22:41:30 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 (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));
|
2001-05-13 22:41:30 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (toggle_button), "draw_indicator");
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
/**
|
|
|
|
* gtk_toggle_button_get_mode:
|
|
|
|
* @toggle_button: a #GtkToggleButton
|
|
|
|
*
|
|
|
|
* Retrieves whether the button is displayed as a separate indicator
|
|
|
|
* and label. See gtk_toggle_button_set_mode().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the togglebutton is drawn as a separate indicator
|
|
|
|
* and label.
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_toggle_button_get_mode (GtkToggleButton *toggle_button)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button), FALSE);
|
|
|
|
|
|
|
|
return toggle_button->draw_indicator;
|
|
|
|
}
|
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 (GTK_IS_TOGGLE_BUTTON (toggle_button));
|
|
|
|
|
2001-05-13 22:41:30 +00:00
|
|
|
is_active = is_active != FALSE;
|
1999-01-11 18:49:54 +00:00
|
|
|
|
|
|
|
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 (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 (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]);
|
|
|
|
}
|
|
|
|
|
2001-02-19 22:25:30 +00:00
|
|
|
/**
|
|
|
|
* gtk_toggle_button_set_inconsistent:
|
|
|
|
* @toggle_button: a #GtkToggleButton
|
|
|
|
* @setting: %TRUE if state is inconsistent
|
|
|
|
*
|
|
|
|
* If the user has selected a range of elements (such as some text or
|
|
|
|
* spreadsheet cells) that are affected by a toggle button, and the
|
|
|
|
* current values in that range are inconsistent, you may want to
|
|
|
|
* display the toggle in an "in between" state. This function turns on
|
|
|
|
* "in between" display. Normally you would turn off the inconsistent
|
|
|
|
* state again if the user toggles the toggle button. This has to be
|
|
|
|
* done manually, gtk_toggle_button_set_inconsistent() only affects
|
|
|
|
* visual appearance, it doesn't affect the semantics of the button.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_toggle_button_set_inconsistent (GtkToggleButton *toggle_button,
|
|
|
|
gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
|
|
|
|
|
|
|
|
setting = setting != FALSE;
|
|
|
|
|
|
|
|
if (setting != toggle_button->inconsistent)
|
|
|
|
{
|
|
|
|
toggle_button->inconsistent = setting;
|
2001-08-25 23:11:46 +00:00
|
|
|
|
|
|
|
gtk_toggle_button_update_state (GTK_BUTTON (toggle_button));
|
2001-02-19 22:25:30 +00:00
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (toggle_button));
|
2001-05-13 22:41:30 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (toggle_button), "inconsistent");
|
2001-02-19 22:25:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_toggle_button_get_inconsistent:
|
|
|
|
* @toggle_button: a #GtkToggleButton
|
|
|
|
*
|
|
|
|
* Gets the value set by gtk_toggle_button_set_inconsistent().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the button is displayed as inconsistent, %FALSE otherwise
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_toggle_button_get_inconsistent (GtkToggleButton *toggle_button)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button), FALSE);
|
|
|
|
|
|
|
|
return toggle_button->inconsistent;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
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;
|
2001-02-19 22:25:30 +00:00
|
|
|
GtkStateType state_type;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint width, height;
|
Fix G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
Mon Apr 2 10:47:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init): Fix
G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
stupidity.
Mon Apr 2 00:51:11 2001 Owen Taylor <otaylor@redhat.com>
[ First pass at adding style properties. Still needs some definite
fine-tuning. ]
* gtk/gtkbutton.c: Add ::default_spacing style property.
* gtk/gtkcheckbutton.[ch] gtkradiobutton.c: Add ::indicator_size,
::indicator_spacing style properties.
* gtk/gtkoptionmenu.c: Add ::indicator_size, ::indicator_spacing
style properties.
* gtk/gtk{,h,v}paned.[ch]: Make handle_size a style property
rather than a normal property.
* gtk/gtkwidget.c: Add an ::interior_focus style property to
draw focus inside buttons, in the Windows/Java Metal/etc. style.
* gtk/gtkbutton.c gtk/gtkcheckbutton.c gtk/gtktogglenbutton.c:
Honor ::interior_focus.
* gtk/gtkentry.c: Don't draw focus at all when ::interior_focus is
TRUE.
* gtk/gtkrange.[ch] gtk/gtk{h,v}scrollbar.c gtk/gtk{h,v}scale.c:
Add ::slider_width, ::trough_border, ::stepper_size,
::stepper_spacing style properties.
* gtk/gtkscale.[ch] Add ::slider-length style property.
2001-04-02 15:51:28 +00:00
|
|
|
gboolean interior_focus;
|
1997-11-24 22:37:52 +00:00
|
|
|
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
|
|
|
{
|
Fix G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
Mon Apr 2 10:47:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init): Fix
G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
stupidity.
Mon Apr 2 00:51:11 2001 Owen Taylor <otaylor@redhat.com>
[ First pass at adding style properties. Still needs some definite
fine-tuning. ]
* gtk/gtkbutton.c: Add ::default_spacing style property.
* gtk/gtkcheckbutton.[ch] gtkradiobutton.c: Add ::indicator_size,
::indicator_spacing style properties.
* gtk/gtkoptionmenu.c: Add ::indicator_size, ::indicator_spacing
style properties.
* gtk/gtk{,h,v}paned.[ch]: Make handle_size a style property
rather than a normal property.
* gtk/gtkwidget.c: Add an ::interior_focus style property to
draw focus inside buttons, in the Windows/Java Metal/etc. style.
* gtk/gtkbutton.c gtk/gtkcheckbutton.c gtk/gtktogglenbutton.c:
Honor ::interior_focus.
* gtk/gtkentry.c: Don't draw focus at all when ::interior_focus is
TRUE.
* gtk/gtkrange.[ch] gtk/gtk{h,v}scrollbar.c gtk/gtk{h,v}scale.c:
Add ::slider_width, ::trough_border, ::stepper_size,
::stepper_spacing style properties.
* gtk/gtkscale.[ch] Add ::slider-length style property.
2001-04-02 15:51:28 +00:00
|
|
|
gtk_widget_style_get (widget, "interior_focus", &interior_focus, NULL);
|
|
|
|
|
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))
|
|
|
|
{
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
x += widget->style->xthickness;
|
|
|
|
y += widget->style->ythickness;
|
1997-11-24 22:37:52 +00:00
|
|
|
width -= 2 * x + DEFAULT_SPACING;
|
|
|
|
height -= 2 * y + DEFAULT_SPACING;
|
|
|
|
x += DEFAULT_LEFT_POS;
|
|
|
|
y += DEFAULT_TOP_POS;
|
|
|
|
}
|
|
|
|
|
Fix G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
Mon Apr 2 10:47:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init): Fix
G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
stupidity.
Mon Apr 2 00:51:11 2001 Owen Taylor <otaylor@redhat.com>
[ First pass at adding style properties. Still needs some definite
fine-tuning. ]
* gtk/gtkbutton.c: Add ::default_spacing style property.
* gtk/gtkcheckbutton.[ch] gtkradiobutton.c: Add ::indicator_size,
::indicator_spacing style properties.
* gtk/gtkoptionmenu.c: Add ::indicator_size, ::indicator_spacing
style properties.
* gtk/gtk{,h,v}paned.[ch]: Make handle_size a style property
rather than a normal property.
* gtk/gtkwidget.c: Add an ::interior_focus style property to
draw focus inside buttons, in the Windows/Java Metal/etc. style.
* gtk/gtkbutton.c gtk/gtkcheckbutton.c gtk/gtktogglenbutton.c:
Honor ::interior_focus.
* gtk/gtkentry.c: Don't draw focus at all when ::interior_focus is
TRUE.
* gtk/gtkrange.[ch] gtk/gtk{h,v}scrollbar.c gtk/gtk{h,v}scale.c:
Add ::slider_width, ::trough_border, ::stepper_size,
::stepper_spacing style properties.
* gtk/gtkscale.[ch] Add ::slider-length style property.
2001-04-02 15:51:28 +00:00
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
x += 1;
|
|
|
|
y += 1;
|
|
|
|
width -= 2;
|
|
|
|
height -= 2;
|
|
|
|
}
|
|
|
|
|
2001-02-19 22:25:30 +00:00
|
|
|
state_type = GTK_WIDGET_STATE (widget);
|
|
|
|
|
|
|
|
if (toggle_button->inconsistent)
|
|
|
|
{
|
|
|
|
if (state_type == GTK_STATE_ACTIVE)
|
|
|
|
state_type = GTK_STATE_NORMAL;
|
|
|
|
shadow_type = GTK_SHADOW_ETCHED_IN;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
2001-08-25 23:11:46 +00:00
|
|
|
shadow_type = button->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
|
2001-03-09 13:28:26 +00:00
|
|
|
|
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,
|
2001-02-19 22:25:30 +00:00
|
|
|
state_type,
|
1998-11-12 23:38:42 +00:00
|
|
|
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))
|
|
|
|
{
|
Fix G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
Mon Apr 2 10:47:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_class_init): Fix
G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
stupidity.
Mon Apr 2 00:51:11 2001 Owen Taylor <otaylor@redhat.com>
[ First pass at adding style properties. Still needs some definite
fine-tuning. ]
* gtk/gtkbutton.c: Add ::default_spacing style property.
* gtk/gtkcheckbutton.[ch] gtkradiobutton.c: Add ::indicator_size,
::indicator_spacing style properties.
* gtk/gtkoptionmenu.c: Add ::indicator_size, ::indicator_spacing
style properties.
* gtk/gtk{,h,v}paned.[ch]: Make handle_size a style property
rather than a normal property.
* gtk/gtkwidget.c: Add an ::interior_focus style property to
draw focus inside buttons, in the Windows/Java Metal/etc. style.
* gtk/gtkbutton.c gtk/gtkcheckbutton.c gtk/gtktogglenbutton.c:
Honor ::interior_focus.
* gtk/gtkentry.c: Don't draw focus at all when ::interior_focus is
TRUE.
* gtk/gtkrange.[ch] gtk/gtk{h,v}scrollbar.c gtk/gtk{h,v}scale.c:
Add ::slider_width, ::trough_border, ::stepper_size,
::stepper_spacing style properties.
* gtk/gtkscale.[ch] Add ::slider-length style property.
2001-04-02 15:51:28 +00:00
|
|
|
if (interior_focus)
|
|
|
|
{
|
|
|
|
x += widget->style->xthickness + 1;
|
|
|
|
y += widget->style->xthickness + 1;
|
|
|
|
width -= 2 * (widget->style->xthickness + 1);
|
|
|
|
height -= 2 * (widget->style->ythickness + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x -= 1;
|
|
|
|
y -= 1;
|
|
|
|
width += 2;
|
|
|
|
height += 2;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
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)
|
|
|
|
{
|
2000-12-02 18:05:34 +00:00
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
2001-05-11 04:09:47 +00:00
|
|
|
GtkWidget *child = GTK_BIN (widget)->child;
|
|
|
|
|
2000-12-02 18:05:34 +00:00
|
|
|
gtk_toggle_button_paint (widget, &event->area);
|
2001-05-11 04:09:47 +00:00
|
|
|
|
|
|
|
if (child)
|
|
|
|
gtk_container_propagate_expose (GTK_CONTAINER (widget), child, event);
|
2000-12-02 18:05:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
1999-01-12 15:12:14 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_toggle_button_pressed (GtkButton *button)
|
|
|
|
{
|
|
|
|
button->button_down = TRUE;
|
|
|
|
|
2001-08-25 23:11:46 +00:00
|
|
|
gtk_toggle_button_update_state (button);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_released (GtkButton *button)
|
|
|
|
{
|
|
|
|
if (button->button_down)
|
|
|
|
{
|
|
|
|
button->button_down = FALSE;
|
|
|
|
|
|
|
|
if (button->in_button)
|
2001-08-25 23:11:46 +00:00
|
|
|
gtk_button_clicked (button);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-08-25 23:11:46 +00:00
|
|
|
gtk_toggle_button_update_state (button);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_clicked (GtkButton *button)
|
|
|
|
{
|
2001-08-25 23:11:46 +00:00
|
|
|
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
|
1997-11-24 22:37:52 +00:00
|
|
|
toggle_button->active = !toggle_button->active;
|
|
|
|
|
|
|
|
gtk_toggle_button_toggled (toggle_button);
|
|
|
|
|
2001-08-25 23:11:46 +00:00
|
|
|
gtk_toggle_button_update_state (button);
|
2001-05-13 22:41:30 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (toggle_button), "active");
|
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 (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 (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 (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 (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);
|
|
|
|
}
|
2001-08-25 23:11:46 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_toggle_button_update_state (GtkButton *button)
|
|
|
|
{
|
|
|
|
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
|
|
|
|
gboolean depressed;
|
|
|
|
GtkStateType new_state;
|
|
|
|
|
|
|
|
if (toggle_button->inconsistent)
|
|
|
|
depressed = FALSE;
|
|
|
|
else if (button->in_button && button->button_down)
|
|
|
|
depressed = !toggle_button->active;
|
|
|
|
else
|
|
|
|
depressed = toggle_button->active;
|
|
|
|
|
|
|
|
if (!button->button_down && button->in_button)
|
|
|
|
new_state = GTK_STATE_PRELIGHT;
|
|
|
|
else
|
|
|
|
new_state = depressed ? GTK_STATE_ACTIVE: GTK_STATE_NORMAL;
|
|
|
|
|
|
|
|
_gtk_button_set_depressed (button, depressed);
|
|
|
|
gtk_widget_set_state (GTK_WIDGET (toggle_button), new_state);
|
|
|
|
}
|