Commit 268930f4 authored by Michael Natterer's avatar Michael Natterer 😴

libgimpwidgets: gimp_pixmap_button_new, gimp_unit_menu_update -> gimpoldwidgets

where they belog. gimp_unit_menu_update() is newly deprecated.
parent 844df2b4
......@@ -974,7 +974,6 @@ GIMP_RANDOM_SEED_TOGGLE
gimp_random_seed_new
GIMP_COORDINATES_CHAINBUTTON
gimp_coordinates_new
gimp_pixmap_button_new
gimp_toggle_button_sensitive_update
gimp_toggle_button_update
gimp_radio_button_update
......@@ -982,7 +981,6 @@ gimp_int_adjustment_update
gimp_uint_adjustment_update
gimp_float_adjustment_update
gimp_double_adjustment_update
gimp_unit_menu_update
gimp_table_attach_aligned
gimp_label_set_attributes
GIMP_WIDGETS_ERROR
......@@ -1267,6 +1265,8 @@ gimp_option_menu_set_history
GimpOptionMenuSensitivityCallback
gimp_option_menu_set_sensitive
gimp_menu_item_update
gimp_pixmap_button_new
gimp_unit_menu_update
</SECTION>
<SECTION>
......
......@@ -27,10 +27,14 @@
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "gimpwidgetstypes.h"
#undef GIMP_DISABLE_DEPRECATED
#include "gimpoldwidgets.h"
#include "gimppixmap.h"
#include "gimpunitmenu.h"
/**
......@@ -549,3 +553,95 @@ gimp_menu_item_update (GtkWidget *widget,
*item_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"gimp-item-data"));
}
/**
* gimp_pixmap_button_new:
* @xpm_data: The XPM data which will be passed to gimp_pixmap_new().
* @text: An optional text which will appear right of the pixmap.
*
* Convenience function that creates a #GtkButton with a #GimpPixmap
* and an optional #GtkLabel.
*
* Returns: The new #GtkButton.
**/
GtkWidget *
gimp_pixmap_button_new (gchar **xpm_data,
const gchar *text)
{
GtkWidget *button;
GtkWidget *pixmap;
button = gtk_button_new ();
pixmap = gimp_pixmap_new (xpm_data);
if (text)
{
GtkWidget *abox;
GtkWidget *hbox;
GtkWidget *label;
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (button), abox);
gtk_widget_show (abox);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (abox), hbox);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
gtk_widget_show (pixmap);
label = gtk_label_new_with_mnemonic (text);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
gtk_widget_show (label);
}
else
{
gtk_container_add (GTK_CONTAINER (button), pixmap);
gtk_widget_show (pixmap);
}
return button;
}
/**
* gimp_unit_menu_update:
* @widget: A #GimpUnitMenu.
* @data: A pointer to a #GimpUnit variable which will store the unit menu's
* value.
*
* This callback can set the number of decimal digits of an arbitrary number
* of #GtkSpinButton's. To use this functionality, attach the spinbuttons
* as list of data pointers attached with g_object_set_data() with the
* "set_digits" key.
*
* See gimp_toggle_button_sensitive_update() for a description of how
* to set up the list.
**/
void
gimp_unit_menu_update (GtkWidget *widget,
gpointer data)
{
GimpUnit *val = (GimpUnit *) data;
GtkWidget *spinbutton;
gint digits;
*val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
digits = ((*val == GIMP_UNIT_PIXEL) ? 0 :
((*val == GIMP_UNIT_PERCENT) ? 2 :
(MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
spinbutton = g_object_get_data (G_OBJECT (widget), "set_digits");
while (spinbutton)
{
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
spinbutton = g_object_get_data (G_OBJECT (spinbutton), "set_digits");
}
}
......@@ -55,8 +55,9 @@ GtkWidget * gimp_int_option_menu_new (gboolean menu_only,
void gimp_int_option_menu_set_history (GtkOptionMenu *option_menu,
gint item_data);
typedef gboolean (*GimpIntOptionMenuSensitivityCallback) (gint item_data,
gpointer callback_data);
typedef gboolean (* GimpIntOptionMenuSensitivityCallback) (gint item_data,
gpointer callback_data);
void gimp_int_option_menu_set_sensitive (GtkOptionMenu *option_menu,
GimpIntOptionMenuSensitivityCallback callback,
gpointer callback_data);
......@@ -89,15 +90,26 @@ void gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer item_data);
typedef gboolean (*GimpOptionMenuSensitivityCallback) (gpointer item_data,
gpointer callback_data);
typedef gboolean (* GimpOptionMenuSensitivityCallback) (gpointer item_data,
gpointer callback_data);
void gimp_option_menu_set_sensitive (GtkOptionMenu *option_menu,
GimpOptionMenuSensitivityCallback callback,
gpointer callback_data);
void gimp_menu_item_update (GtkWidget *widget,
void gimp_menu_item_update (GtkWidget *widget,
gpointer data);
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data,
const gchar *text);
/*
* Standard Callbacks
*/
void gimp_unit_menu_update (GtkWidget *widget,
gpointer data);
......
......@@ -19,6 +19,8 @@
#include <string.h>
/* FIXME: #undef GTK_DISABLE_DEPRECATED */
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
......@@ -29,6 +31,7 @@
#include "gimpwidgetstypes.h"
#undef GIMP_DISABLE_DEPRECATED
#include "gimpoldwidgets.h"
#include "gimppropwidgets.h"
#include "gimpunitmenu.h"
......
......@@ -23,6 +23,8 @@
#undef GSEAL_ENABLE
/* FIXME: #undef GTK_DISABLE_DEPRECATED */
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
......@@ -34,6 +36,7 @@
#include "gimpwidgets.h"
#undef GIMP_DISABLE_DEPRECATED
#include "gimpoldwidgets.h"
#include "gimpunitmenu.h"
#include "libgimp/libgimp-intl.h"
......
......@@ -27,15 +27,6 @@
#include "libgimpmath/gimpmath.h"
#include "libgimpbase/gimpbase.h"
#include "gimpwidgetstypes.h"
#include "gimpchainbutton.h"
#include "gimpsizeentry.h"
#include "gimpunitmenu.h"
#undef GIMP_DISABLE_DEPRECATED
#include "gimppixmap.h"
#include "gimpwidgets.h"
#include "libgimp/libgimp-intl.h"
......@@ -825,58 +816,6 @@ gimp_coordinates_new (GimpUnit unit,
}
/**
* gimp_pixmap_button_new:
* @xpm_data: The XPM data which will be passed to gimp_pixmap_new().
* @text: An optional text which will appear right of the pixmap.
*
* Convenience function that creates a #GtkButton with a #GimpPixmap
* and an optional #GtkLabel.
*
* Returns: The new #GtkButton.
**/
GtkWidget *
gimp_pixmap_button_new (gchar **xpm_data,
const gchar *text)
{
GtkWidget *button;
GtkWidget *pixmap;
button = gtk_button_new ();
pixmap = gimp_pixmap_new (xpm_data);
if (text)
{
GtkWidget *abox;
GtkWidget *hbox;
GtkWidget *label;
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (button), abox);
gtk_widget_show (abox);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (abox), hbox);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
gtk_widget_show (pixmap);
label = gtk_label_new_with_mnemonic (text);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
gtk_widget_show (label);
}
else
{
gtk_container_add (GTK_CONTAINER (button), pixmap);
gtk_widget_show (pixmap);
}
return button;
}
/*
* Standard Callbacks
*/
......@@ -1037,44 +976,6 @@ gimp_double_adjustment_update (GtkAdjustment *adjustment,
*val = gtk_adjustment_get_value (adjustment);
}
/**
* gimp_unit_menu_update:
* @widget: A #GimpUnitMenu.
* @data: A pointer to a #GimpUnit variable which will store the unit menu's
* value.
*
* This callback can set the number of decimal digits of an arbitrary number
* of #GtkSpinButton's. To use this functionality, attach the spinbuttons
* as list of data pointers attached with g_object_set_data() with the
* "set_digits" key.
*
* See gimp_toggle_button_sensitive_update() for a description of how
* to set up the list.
**/
void
gimp_unit_menu_update (GtkWidget *widget,
gpointer data)
{
GimpUnit *val = (GimpUnit *) data;
GtkWidget *spinbutton;
gint digits;
*val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
digits = ((*val == GIMP_UNIT_PIXEL) ? 0 :
((*val == GIMP_UNIT_PERCENT) ? 2 :
(MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
spinbutton = g_object_get_data (G_OBJECT (widget), "set_digits");
while (spinbutton)
{
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
spinbutton = g_object_get_data (G_OBJECT (spinbutton), "set_digits");
}
}
/*
* Helper Functions
......
......@@ -221,14 +221,6 @@ GtkWidget * gimp_coordinates_new (GimpUnit unit,
gdouble ysize_100 /* % */);
#ifndef GIMP_DISABLE_DEPRECATED
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data,
const gchar *text);
#endif
/*
* Standard Callbacks
*/
......@@ -253,9 +245,6 @@ void gimp_float_adjustment_update (GtkAdjustment *adjustment,
void gimp_double_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
void gimp_unit_menu_update (GtkWidget *widget,
gpointer data);
/*
* Helper Functions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment