Commit ec0a60a2 authored by Matthias Clasen's avatar Matthias Clasen

Deprecate GtkMisc

This has been dangling ever since 3.0.
parent 7840bad5
......@@ -259,7 +259,6 @@
<xi:include href="xml/gtkcontainer.xml" />
<xi:include href="xml/gtkbin.xml" />
<xi:include href="xml/gtkmenushell.xml" />
<xi:include href="xml/gtkmisc.xml" />
<xi:include href="xml/gtkrange.xml" />
<xi:include href="xml/gtkimcontext.xml" />
</chapter>
......@@ -321,6 +320,7 @@
<xi:include href="xml/gtkrecentaction.xml" />
<xi:include href="xml/gtkactivatable.xml" />
<xi:include href="xml/gtkimagemenuitem.xml" />
<xi:include href="xml/gtkmisc.xml" />
<xi:include href="xml/gtkstock.xml" />
<xi:include href="xml/gtkiconfactory.xml" />
<xi:include href="xml/gtknumerableicon.xml" />
......
......@@ -171,6 +171,7 @@ deprecated_h_sources = \
deprecated/gtkhsv.h \
deprecated/gtkiconfactory.h \
deprecated/gtkimagemenuitem.h \
deprecated/gtkmisc.h \
deprecated/gtknumerableicon.h \
deprecated/gtkradioaction.h \
deprecated/gtkrc.h \
......@@ -303,7 +304,6 @@ gtk_public_h_sources = \
gtkmenushell.h \
gtkmenutoolbutton.h \
gtkmessagedialog.h \
gtkmisc.h \
gtkmodules.h \
gtkmountoperation.h \
gtknotebook.h \
......@@ -596,6 +596,7 @@ deprecated_c_sources = \
deprecated/gtkhsv.c \
deprecated/gtkiconfactory.c \
deprecated/gtkimagemenuitem.c \
deprecated/gtkmisc.c \
deprecated/gtknumerableicon.c \
deprecated/gtkradioaction.c \
deprecated/gtkrc.c \
......@@ -799,7 +800,6 @@ gtk_base_c_sources = \
gtkmenutrackeritem.c \
gtkmenutoolbutton.c \
gtkmessagedialog.c \
gtkmisc.c \
gtkmnemonichash.c \
gtkmodelmenuitem.c \
gtkmodelbutton.c \
......
......@@ -29,6 +29,8 @@
#include "gtkprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* SECTION:gtkmisc
* @Short_description: Base class for widgets with alignments and padding
......@@ -47,10 +49,10 @@
*
* Note that the desired effect can in most cases be achieved by using the
* #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
* on the child widget, so GtkMisc should not be used in new code.
* on the child widget, so GtkMisc should not be used in new code. To reflect
* this fact, all #GtkMisc API has been deprecated.
*/
struct _GtkMiscPrivate
{
gfloat xalign;
......@@ -103,7 +105,7 @@ gtk_misc_class_init (GtkMiscClass *class)
0.0,
1.0,
0.5,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
g_object_class_install_property (gobject_class,
PROP_YALIGN,
......@@ -113,7 +115,7 @@ gtk_misc_class_init (GtkMiscClass *class)
0.0,
1.0,
0.5,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
g_object_class_install_property (gobject_class,
PROP_XPAD,
......@@ -123,7 +125,7 @@ gtk_misc_class_init (GtkMiscClass *class)
0,
G_MAXINT,
0,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
g_object_class_install_property (gobject_class,
PROP_YPAD,
......@@ -133,7 +135,7 @@ gtk_misc_class_init (GtkMiscClass *class)
0,
G_MAXINT,
0,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
}
static void
......@@ -215,6 +217,8 @@ gtk_misc_get_property (GObject *object,
* @yalign: the vertical alignment, from 0 (top) to 1 (bottom).
*
* Sets the alignment of the widget.
*
* Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
*/
void
gtk_misc_set_alignment (GtkMisc *misc,
......@@ -268,6 +272,8 @@ gtk_misc_set_alignment (GtkMisc *misc,
*
* Gets the X and Y alignment of the widget within its allocation.
* See gtk_misc_set_alignment().
*
* Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
**/
void
gtk_misc_get_alignment (GtkMisc *misc,
......@@ -295,6 +301,8 @@ gtk_misc_get_alignment (GtkMisc *misc,
* in pixels.
*
* Sets the amount of space to add around the widget.
*
* Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
*/
void
gtk_misc_set_padding (GtkMisc *misc,
......@@ -341,6 +349,8 @@ gtk_misc_set_padding (GtkMisc *misc,
*
* Gets the padding in the X and Y directions of the widget.
* See gtk_misc_set_padding().
*
* Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
**/
void
gtk_misc_get_padding (GtkMisc *misc,
......
......@@ -66,21 +66,21 @@ struct _GtkMiscClass
void (*_gtk_reserved4) (void);
};
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
GType gtk_misc_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
void gtk_misc_set_alignment (GtkMisc *misc,
gfloat xalign,
gfloat yalign);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
void gtk_misc_get_alignment (GtkMisc *misc,
gfloat *xalign,
gfloat *yalign);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
void gtk_misc_set_padding (GtkMisc *misc,
gint xpad,
gint ypad);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
void gtk_misc_get_padding (GtkMisc *misc,
gint *xpad,
gint *ypad);
......
......@@ -132,7 +132,6 @@
#include <gtk/gtkmenushell.h>
#include <gtk/gtkmenutoolbutton.h>
#include <gtk/gtkmessagedialog.h>
#include <gtk/gtkmisc.h>
#include <gtk/gtkmodules.h>
#include <gtk/gtkmountoperation.h>
#include <gtk/gtknotebook.h>
......@@ -241,6 +240,7 @@
#include <gtk/deprecated/gtkhseparator.h>
#include <gtk/deprecated/gtkiconfactory.h>
#include <gtk/deprecated/gtkimagemenuitem.h>
#include <gtk/deprecated/gtkmisc.h>
#include <gtk/deprecated/gtknumerableicon.h>
#include <gtk/deprecated/gtkradioaction.h>
#include <gtk/deprecated/gtkrc.h>
......
......@@ -428,7 +428,9 @@ gtk_accel_label_draw (GtkWidget *widget,
cairo_restore (cr);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_get_padding (misc, &xpad, NULL);
G_GNUC_END_IGNORE_DEPRECATIONS
if (direction == GTK_TEXT_DIR_RTL)
x = xpad;
......
......@@ -85,7 +85,9 @@ static void gtk_arrow_get_preferred_height (GtkWidget *widg
gint *minimum_size,
gint *natural_size);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_TYPE_WITH_PRIVATE (GtkArrow, gtk_arrow, GTK_TYPE_MISC)
G_GNUC_END_IGNORE_DEPRECATIONS
static void
gtk_arrow_class_init (GtkArrowClass *class)
......@@ -199,7 +201,9 @@ gtk_arrow_get_preferred_width (GtkWidget *widget,
{
GtkBorder border;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (widget), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
*minimum_size = MIN_ARROW_SIZE + border.left + border.right;
*natural_size = MIN_ARROW_SIZE + border.left + border.right;
......@@ -212,7 +216,9 @@ gtk_arrow_get_preferred_height (GtkWidget *widget,
{
GtkBorder border;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (widget), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
*minimum_size = MIN_ARROW_SIZE + border.top + border.bottom;
*natural_size = MIN_ARROW_SIZE + border.top + border.bottom;
......@@ -311,8 +317,10 @@ gtk_arrow_draw (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (widget), &border);
gtk_misc_get_alignment (GTK_MISC (widget), &xalign, &yalign);
G_GNUC_END_IGNORE_DEPRECATIONS
width = gtk_widget_get_allocated_width (widget) - border.left - border.right;
height = gtk_widget_get_allocated_height (widget) - border.top - border.bottom;
......
......@@ -30,7 +30,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkmisc.h>
#include <gtk/deprecated/gtkmisc.h>
G_BEGIN_DECLS
......
......@@ -1756,15 +1756,17 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
page_info->current_title = gtk_label_new (NULL);
gtk_widget_set_no_show_all (page_info->current_title, TRUE);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* Note: we need to use misc alignment here as long as GtkLabel
* pays attention to it. GtkWiget::halign is ineffective, since
* all the labels are getting the same size anyway, due to the
* size group.
*/
gtk_misc_set_alignment (GTK_MISC (page_info->regular_title), 0, 0.5);
gtk_widget_show (page_info->regular_title);
gtk_misc_set_alignment (GTK_MISC (page_info->current_title), 0, 0.5);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_show (page_info->regular_title);
gtk_widget_hide (page_info->current_title);
context = gtk_widget_get_style_context (page_info->current_title);
......
......@@ -684,10 +684,11 @@ maybe_set_alignment (GtkButton *button,
{
GtkButtonPrivate *priv = button->priv;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GTK_IS_MISC (widget))
{
GtkMisc *misc = GTK_MISC (widget);
if (priv->align_set)
gtk_misc_set_alignment (misc, priv->xalign, priv->yalign);
}
......@@ -706,6 +707,7 @@ maybe_set_alignment (GtkButton *button,
priv->xalign, priv->yalign,
xscale, yscale);
}
G_GNUC_END_IGNORE_DEPRECATIONS
}
static void
......@@ -1291,8 +1293,10 @@ gtk_button_construct_child (GtkButton *button)
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (priv->align_set)
gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (button), label);
......
......@@ -197,7 +197,9 @@ enum
PROP_USE_FALLBACK
};
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_TYPE_WITH_PRIVATE (GtkImage, gtk_image, GTK_TYPE_MISC)
G_GNUC_END_IGNORE_DEPRECATIONS
static void
gtk_image_class_init (GtkImageClass *class)
......@@ -1523,7 +1525,9 @@ gtk_image_get_preferred_size (GtkImage *image,
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &width, &height);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (image), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
width += border.left + border.right;
height += border.top + border.bottom;
......@@ -1562,7 +1566,6 @@ gtk_image_draw (GtkWidget *widget,
{
GtkImage *image;
GtkImagePrivate *priv;
GtkMisc *misc;
GtkStyleContext *context;
gint x, y, width, height, baseline;
gfloat xalign, yalign;
......@@ -1571,7 +1574,6 @@ gtk_image_draw (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_IMAGE (widget), FALSE);
image = GTK_IMAGE (widget);
misc = GTK_MISC (image);
priv = image->priv;
context = gtk_widget_get_style_context (widget);
......@@ -1583,9 +1585,11 @@ gtk_image_draw (GtkWidget *widget,
0, 0,
gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget));
gtk_misc_get_alignment (misc, &xalign, &yalign);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_get_alignment (GTK_MISC (image), &xalign, &yalign);
_gtk_misc_get_padding_and_border (GTK_MISC (image), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_image_get_preferred_size (image, &width, &height);
_gtk_misc_get_padding_and_border (misc, &border);
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
xalign = 1.0 - xalign;
......
......@@ -31,7 +31,7 @@
#endif
#include <gio/gio.h>
#include <gtk/gtkmisc.h>
#include <gtk/deprecated/gtkmisc.h>
G_BEGIN_DECLS
......
......@@ -506,10 +506,12 @@ static void gtk_label_get_preferred_height_and_baseline_for_width (GtkWidget
static GtkBuildableIface *buildable_parent_iface = NULL;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_TYPE_WITH_CODE (GtkLabel, gtk_label, GTK_TYPE_MISC,
G_ADD_PRIVATE (GtkLabel)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_label_buildable_interface_init))
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_label_buildable_interface_init))
G_GNUC_END_IGNORE_DEPRECATIONS
static void
add_move_binding (GtkBindingSet *binding_set,
......@@ -3226,7 +3228,9 @@ gtk_label_update_layout_width (GtkLabel *label)
PangoRectangle logical;
gint width, height;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
width = gtk_widget_get_allocated_width (GTK_WIDGET (label)) - border.left - border.right;
height = gtk_widget_get_allocated_height (GTK_WIDGET (label)) - border.top - border.bottom;
......@@ -3643,7 +3647,9 @@ gtk_label_get_preferred_size (GtkWidget *widget,
smallest_rect.width = PANGO_PIXELS_CEIL (smallest_rect.width);
smallest_rect.height = PANGO_PIXELS_CEIL (smallest_rect.height);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
......@@ -3747,7 +3753,9 @@ gtk_label_get_preferred_width_for_height (GtkWidget *widget,
{
GtkBorder border;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
if (priv->wrap)
gtk_label_clear_layout (label);
......@@ -3782,7 +3790,9 @@ gtk_label_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
{
GtkBorder border;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
if (priv->wrap)
gtk_label_clear_layout (label);
......@@ -3914,7 +3924,6 @@ get_layout_location (GtkLabel *label,
gint *yp)
{
GtkAllocation allocation;
GtkMisc *misc;
GtkWidget *widget;
GtkLabelPrivate *priv;
GtkBorder border;
......@@ -3924,12 +3933,13 @@ get_layout_location (GtkLabel *label,
PangoRectangle logical;
gint baseline, layout_baseline, baseline_offset;
misc = GTK_MISC (label);
widget = GTK_WIDGET (label);
priv = label->priv;
gtk_misc_get_alignment (misc, &xalign, &yalign);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_get_alignment (GTK_MISC (label), &xalign, &yalign);
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
G_GNUC_END_IGNORE_DEPRECATIONS
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
xalign = 1.0 - xalign;
......
......@@ -30,7 +30,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkmisc.h>
#include <gtk/deprecated/gtkmisc.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkmenu.h>
......
......@@ -489,9 +489,11 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
if (text_orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_label_set_angle (GTK_LABEL (label), 0);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_set_alignment (GTK_MISC (label),
gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
0.5);
G_GNUC_END_IGNORE_DEPRECATIONS
}
else
{
......@@ -500,9 +502,11 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gtk_label_set_angle (GTK_LABEL (label), -90);
else
gtk_label_set_angle (GTK_LABEL (label), 90);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_set_alignment (GTK_MISC (label),
0.5,
1 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)));
G_GNUC_END_IGNORE_DEPRECATIONS
}
}
}
......@@ -543,6 +547,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gtk_widget_show (icon);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GTK_IS_MISC (icon) && text_orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_misc_set_alignment (GTK_MISC (icon),
1.0 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
......@@ -551,6 +556,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gtk_misc_set_alignment (GTK_MISC (icon),
0.5,
gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)));
G_GNUC_END_IGNORE_DEPRECATIONS
if (icon)
{
......
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