gtk2/gtk/gtkradiotoolbutton.c
Soeren Sandmann 7913e63f69 remove correction on x when detail is "menuitem". With the new menu look
Tue Jul  8 19:57:14 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtkstyle.c (gtk_default_draw_arrow): remove correction on x
	when detail is "menuitem". With the new menu look is isn't needed
	anymore.

	* gtk/gtktoolitem.c (gtk_tool_item_toolbar_reconfigured): queue a
	resize here, so that tool items will get a chance to relayout
	themselves based on the toolbar configuration.

	change DEFAULT_SPACE_SIZE to 4 instead of 5

	* gtk/gtktoolbar.c
	Get rid of "!GTK_BIN (item)->child means separator". Separators
	are widgets in their own right

	change DEFAULT_SPACE_SIZE to 4 instead of 5

	(get_space_size): remove this function
	(toolbar_item_is_homogeneous): new function

	* gtk/gtkseparatortoolitem.c
	(gtk_separator_tool_item_size_request): new function.

Tue Jul  8 14:10:35 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtktoggletoolbutton.h: use private data, add new
	internal function _gtk_toggle_tool_button_get_button()

	* gtk/gtktoolbutton.h: move to private data

	* gtk/gtkradiotoolbutton.c, gtk/gtktoolbutton.c: updates for new
	private data.
2003-07-08 18:20:45 +00:00

155 lines
4.0 KiB
C

/* gtkradiotoolbutton.c
*
* Copyright (C) 2002 Anders Carlsson <andersca@codefactory.se>
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gtkradiotoolbutton.h"
#include "gtkradiobutton.h"
#include "gtkintl.h"
static void gtk_radio_tool_button_init (GtkRadioToolButton *button);
static void gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass);
GType
gtk_radio_tool_button_get_type (void)
{
static GType type = 0;
if (!type)
{
static const GTypeInfo type_info =
{
sizeof (GtkRadioToolButtonClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gtk_radio_tool_button_class_init,
(GClassFinalizeFunc) NULL,
NULL,
sizeof (GtkRadioToolButton),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_radio_tool_button_init
};
type = g_type_register_static (GTK_TYPE_TOGGLE_TOOL_BUTTON,
"GtkRadioToolButton", &type_info, 0);
}
return type;
}
static void
gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass)
{
GtkToolButtonClass *toolbutton_class;
toolbutton_class = (GtkToolButtonClass *)klass;
toolbutton_class->button_type = GTK_TYPE_RADIO_BUTTON;
}
static void
gtk_radio_tool_button_init (GtkRadioToolButton *button)
{
GtkToolButton *tool_button = GTK_TOOL_BUTTON (button);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button)), FALSE);
}
GtkToolItem *
gtk_radio_tool_button_new (GSList *group)
{
GtkRadioToolButton *button;
button = g_object_new (GTK_TYPE_RADIO_TOOL_BUTTON,
NULL);
gtk_radio_tool_button_set_group (button, group);
return GTK_TOOL_ITEM (button);
}
GtkToolItem *
gtk_radio_tool_button_new_from_stock (GSList *group,
const gchar *stock_id)
{
GtkRadioToolButton *button;
g_return_val_if_fail (stock_id != NULL, NULL);
button = g_object_new (GTK_TYPE_RADIO_TOOL_BUTTON,
"stock_id", stock_id,
NULL);
gtk_radio_tool_button_set_group (button, group);
return GTK_TOOL_ITEM (button);
}
GtkToolItem *
gtk_radio_tool_button_new_from_widget (GtkWidget *group,
const gchar *stock_id)
{
GSList *list = NULL;
g_return_val_if_fail (GTK_IS_RADIO_TOOL_BUTTON (group), NULL);
if (group)
list = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (group));
return gtk_radio_tool_button_new_from_stock (list, stock_id);
}
GtkToolItem *
gtk_radio_tool_button_new_with_stock_from_widget (GtkWidget *group)
{
GSList *list = NULL;
g_return_val_if_fail (GTK_IS_RADIO_TOOL_BUTTON (group), NULL);
if (group)
list = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (group));
return gtk_radio_tool_button_new (list);
}
static GtkRadioButton *
get_radio_button (GtkRadioToolButton *button)
{
return GTK_RADIO_BUTTON (_gtk_tool_button_get_button (GTK_TOOL_BUTTON (button)));
}
GSList *
gtk_radio_tool_button_get_group (GtkRadioToolButton *button)
{
g_return_val_if_fail (GTK_IS_RADIO_TOOL_BUTTON (button), NULL);
return gtk_radio_button_get_group (get_radio_button (button));
}
void
gtk_radio_tool_button_set_group (GtkRadioToolButton *button,
GSList *group)
{
g_return_if_fail (GTK_IS_RADIO_TOOL_BUTTON (button));
gtk_radio_button_set_group (get_radio_button (button), group);
}