gimp/libgimp/gimpfontmenu.c
Sven Neumann a9bd28e458 libgimp/gimpfontselectbutton.[ch] libgimp/gimpgradientselectbutton.[ch]
2006-06-28  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpfontselectbutton.[ch]
	* libgimp/gimpgradientselectbutton.[ch]
	* libgimp/gimppaletteselectbutton.[ch]
	* libgimp/gimppatternselectbutton.[ch]: for consistency with
	GimpBrushSelectButton dropped the _name suffix from the getter
	and setter API.

	* libgimp/gimpfontmenu.c
	* libgimp/gimpgradientmenu.c
	* libgimp/gimppalettemenu.c
	* libgimp/gimppatternmenu.c
	* plug-ins/gfig/gfig-style.c
	* plug-ins/script-fu/script-fu-interface.c: changed accordingly.

	* libgimp/gimpbrushmenu.c
	* libgimp/gimpbrushselectbutton.[ch]
	* libgimp/gimpselectbutton.c: cleanup for consistency.

2006-06-28  Sven Neumann  <sven@gimp.org>

	* libgimp/tmpl/gimpbrushselectbutton.sgml
	* libgimp/tmpl/gimpgradientselectbutton.sgml
	* libgimp/tmpl/gimppaletteselectbutton.sgml
	* libgimp/tmpl/gimppatternselectbutton.sgml
	* libgimp/tmpl/gimpselectbutton.sgml: new files.

	* libgimp/libgimp-docs.sgml
	* libgimp/libgimp-sections.txt
	* libgimp/libgimp.types: added docs for GimpSelectButton widgets.

	* libgimp/tmpl/gimpfontselectbutton.sgml: regenerated.

	* libgimpcolor/libgimpcolor-sections.txt: added docs for GValue API.

	* libgimpcolor/tmpl/gimprgb.sgml: regenerated.

	* libgimpwidgets/libgimpwidgets-sections.txt: updated.

	* libgimpwidgets/tmpl/gimppropwidgets.sgml
	* libgimpwidgets/tmpl/gimpstock.sgml: regenerated.
2006-06-28 10:35:22 +00:00

129 lines
3.8 KiB
C

/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpfontmenu.c
* Copyright (C) 2003 Sven Neumann <sven@gimp.org>
*
* 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
* Library 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 "config.h"
#include "gimp.h"
#include "gimpuitypes.h"
#include "gimpfontselectbutton.h"
#undef GIMP_DISABLE_DEPRECATED
#include "gimpfontmenu.h"
typedef struct _CompatCallbackData CompatCallbackData;
struct _CompatCallbackData
{
GimpRunFontCallback callback;
gpointer data;
};
static void compat_callback (GimpFontSelectButton *font_button,
const gchar *font_name,
gboolean dialog_closing,
gpointer data);
/**
* gimp_font_select_widget_new:
* @title: Title of the dialog to use or %NULL to use the default title.
* @font_name: Initial font name.
* @callback: A function to call when the selected font changes.
* @data: A pointer to arbitary data to be used in the call to @callback.
*
* Creates a new #GtkWidget that completely controls the selection of
* a font. This widget is suitable for placement in a table in a
* plug-in dialog.
*
* Returns: A #GtkWidget that you can use in your UI.
*/
GtkWidget *
gimp_font_select_widget_new (const gchar *title,
const gchar *font_name,
GimpRunFontCallback callback,
gpointer data)
{
GtkWidget *font_button;
CompatCallbackData *compat_data;
g_return_val_if_fail (callback != NULL, NULL);
font_button = gimp_font_select_button_new (title, font_name);
compat_data = g_new (CompatCallbackData, 1);
compat_data->callback = callback;
compat_data->data = data;
g_signal_connect_data (font_button, "font-set",
G_CALLBACK (compat_callback),
compat_data, (GClosureNotify) g_free, 0);
return font_button;
}
/**
* gimp_font_select_widget_close:
* @widget: A font select widget.
*
* Closes the popup window associated with @widget.
*/
void
gimp_font_select_widget_close (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
gimp_select_button_close_popup (GIMP_SELECT_BUTTON (widget));
}
/**
* gimp_font_select_widget_set;
* @widget: A font select widget.
* @font_name: Font name to set; %NULL means no change.
*
* Sets the current font for the font select widget. Calls the
* callback function if one was supplied in the call to
* gimp_font_select_widget_new().
*/
void
gimp_font_select_widget_set (GtkWidget *widget,
const gchar *font_name)
{
g_return_if_fail (widget != NULL);
gimp_font_select_button_set_font (GIMP_FONT_SELECT_BUTTON (widget),
font_name);
}
static void
compat_callback (GimpFontSelectButton *font_button,
const gchar *font_name,
gboolean dialog_closing,
gpointer data)
{
CompatCallbackData *compat_data = data;
compat_data->callback (font_name, dialog_closing, compat_data->data);
}