mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
introduced ::xspacing and ::yspacing style properties which make all
Fri Jul 14 16:13:37 2006 Tim Janik <timj@gtk.org> * gtk/gtkprogressbar.c: introduced ::xspacing and ::yspacing style properties which make all hardcoded padding and spacing values configurable. properly swap ::text-xalign treatment for RTL widgets. * gtk/gtkprogress.c: fixed style property blurbs. made alignment proeprty more consistent with GtkMisc alignment blurbs. mention RTL treatment for text-xalign.
This commit is contained in:
parent
219dc5bdee
commit
7726d989b3
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Fri Jul 14 16:13:37 2006 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkprogressbar.c: introduced ::xspacing and ::yspacing style
|
||||||
|
properties which make all hardcoded padding and spacing values
|
||||||
|
configurable. properly swap ::text-xalign treatment for RTL widgets.
|
||||||
|
|
||||||
|
* gtk/gtkprogress.c: fixed style property blurbs. made alignment
|
||||||
|
proeprty more consistent with GtkMisc alignment blurbs. mention
|
||||||
|
RTL treatment for text-xalign.
|
||||||
|
|
||||||
Tue Aug 29 11:57:40 2006 Tim Janik <timj@imendio.com>
|
Tue Aug 29 11:57:40 2006 Tim Janik <timj@imendio.com>
|
||||||
|
|
||||||
* tests/testgtk.c: allow (most) windows to be resizable.
|
* tests/testgtk.c: allow (most) windows to be resizable.
|
||||||
|
@ -93,40 +93,36 @@ gtk_progress_class_init (GtkProgressClass *class)
|
|||||||
class->paint = NULL;
|
class->paint = NULL;
|
||||||
class->update = NULL;
|
class->update = NULL;
|
||||||
class->act_mode_enter = NULL;
|
class->act_mode_enter = NULL;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_ACTIVITY_MODE,
|
PROP_ACTIVITY_MODE,
|
||||||
g_param_spec_boolean ("activity-mode",
|
g_param_spec_boolean ("activity-mode",
|
||||||
P_("Activity mode"),
|
P_("Activity mode"),
|
||||||
P_("If TRUE, the GtkProgress is in activity mode, meaning that it signals something is happening, but not how much of the activity is finished. This is used when you're doing something that you don't know how long it will take"),
|
P_("If TRUE, the GtkProgress is in activity mode, meaning that it signals "
|
||||||
|
"something is happening, but not how much of the activity is finished. "
|
||||||
|
"This is used when you're doing something but don't know how long it will take."),
|
||||||
FALSE,
|
FALSE,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_SHOW_TEXT,
|
PROP_SHOW_TEXT,
|
||||||
g_param_spec_boolean ("show-text",
|
g_param_spec_boolean ("show-text",
|
||||||
P_("Show text"),
|
P_("Show text"),
|
||||||
P_("Whether the progress is shown as text"),
|
P_("Whether the progress is shown as text."),
|
||||||
FALSE,
|
FALSE,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_TEXT_XALIGN,
|
PROP_TEXT_XALIGN,
|
||||||
g_param_spec_float ("text-xalign",
|
g_param_spec_float ("text-xalign",
|
||||||
P_("Text x alignment"),
|
P_("Text x alignment"),
|
||||||
P_("A number between 0.0 and 1.0 specifying the horizontal alignment of the text in the progress widget"),
|
P_("The horizontal text alignment, from 0 (left) to 1 (right). Reversed for RTL layouts."),
|
||||||
0.0,
|
0.0, 1.0, 0.5,
|
||||||
1.0,
|
|
||||||
0.5,
|
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_TEXT_YALIGN,
|
PROP_TEXT_YALIGN,
|
||||||
g_param_spec_float ("text-yalign",
|
g_param_spec_float ("text-yalign",
|
||||||
P_("Text y alignment"),
|
P_("Text y alignment"),
|
||||||
P_("A number between 0.0 and 1.0 specifying the vertical alignment of the text in the progress widget"),
|
P_("The vertical text alignment, from 0 (top) to 1 (bottom)."),
|
||||||
0.0,
|
0.0, 1.0, 0.5,
|
||||||
1.0,
|
|
||||||
0.5,
|
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#define MIN_VERTICAL_BAR_WIDTH 22
|
#define MIN_VERTICAL_BAR_WIDTH 22
|
||||||
#define MIN_VERTICAL_BAR_HEIGHT 80
|
#define MIN_VERTICAL_BAR_HEIGHT 80
|
||||||
#define MAX_TEXT_LENGTH 80
|
#define MAX_TEXT_LENGTH 80
|
||||||
#define TEXT_SPACING 2
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
@ -145,9 +144,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
|||||||
g_param_spec_uint ("activity-step",
|
g_param_spec_uint ("activity-step",
|
||||||
P_("Activity Step"),
|
P_("Activity Step"),
|
||||||
P_("The increment used for each iteration in activity mode (Deprecated)"),
|
P_("The increment used for each iteration in activity mode (Deprecated)"),
|
||||||
0,
|
0, G_MAXUINT, 3,
|
||||||
G_MAXUINT,
|
|
||||||
3,
|
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
@ -155,9 +152,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
|||||||
g_param_spec_uint ("activity-blocks",
|
g_param_spec_uint ("activity-blocks",
|
||||||
P_("Activity Blocks"),
|
P_("Activity Blocks"),
|
||||||
P_("The number of blocks which can fit in the progress bar area in activity mode (Deprecated)"),
|
P_("The number of blocks which can fit in the progress bar area in activity mode (Deprecated)"),
|
||||||
2,
|
2, G_MAXUINT, 5,
|
||||||
G_MAXUINT,
|
|
||||||
5,
|
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
@ -165,9 +160,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
|||||||
g_param_spec_uint ("discrete-blocks",
|
g_param_spec_uint ("discrete-blocks",
|
||||||
P_("Discrete Blocks"),
|
P_("Discrete Blocks"),
|
||||||
P_("The number of discrete blocks in a progress bar (when shown in the discrete style)"),
|
P_("The number of discrete blocks in a progress bar (when shown in the discrete style)"),
|
||||||
2,
|
2, G_MAXUINT, 10,
|
||||||
G_MAXUINT,
|
|
||||||
10,
|
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
@ -175,9 +168,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
|||||||
g_param_spec_double ("fraction",
|
g_param_spec_double ("fraction",
|
||||||
P_("Fraction"),
|
P_("Fraction"),
|
||||||
P_("The fraction of total work that has been completed"),
|
P_("The fraction of total work that has been completed"),
|
||||||
0.0,
|
0.0, 1.0, 0.0,
|
||||||
1.0,
|
|
||||||
0.0,
|
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
@ -185,9 +176,7 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
|||||||
g_param_spec_double ("pulse-step",
|
g_param_spec_double ("pulse-step",
|
||||||
P_("Pulse Step"),
|
P_("Pulse Step"),
|
||||||
P_("The fraction of total progress to move the bouncing block when pulsed"),
|
P_("The fraction of total progress to move the bouncing block when pulsed"),
|
||||||
0.0,
|
0.0, 1.0, 0.1,
|
||||||
1.0,
|
|
||||||
0.1,
|
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
@ -216,11 +205,23 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
|||||||
PROP_ELLIPSIZE,
|
PROP_ELLIPSIZE,
|
||||||
g_param_spec_enum ("ellipsize",
|
g_param_spec_enum ("ellipsize",
|
||||||
P_("Ellipsize"),
|
P_("Ellipsize"),
|
||||||
P_("The preferred place to ellipsize the string, if the progressbar does not have enough room to display the entire string, if at all"),
|
P_("The preferred place to ellipsize the string, if the progress bar "
|
||||||
|
"does not have enough room to display the entire string, if at all."),
|
||||||
PANGO_TYPE_ELLIPSIZE_MODE,
|
PANGO_TYPE_ELLIPSIZE_MODE,
|
||||||
PANGO_ELLIPSIZE_NONE,
|
PANGO_ELLIPSIZE_NONE,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
|
g_param_spec_int ("xspacing",
|
||||||
|
P_("XSpacing"),
|
||||||
|
P_("Extra spacing applied to the width of a progress bar."),
|
||||||
|
0, G_MAXINT, 7,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
|
g_param_spec_int ("yspacing",
|
||||||
|
"YSpacing",
|
||||||
|
"Extra spacing applied to the height of a progress bar.",
|
||||||
|
0, G_MAXINT, 7,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -486,15 +487,21 @@ gtk_progress_bar_size_request (GtkWidget *widget,
|
|||||||
PangoRectangle logical_rect;
|
PangoRectangle logical_rect;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
gint xspacing, yspacing;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_PROGRESS_BAR (widget));
|
g_return_if_fail (GTK_IS_PROGRESS_BAR (widget));
|
||||||
g_return_if_fail (requisition != NULL);
|
g_return_if_fail (requisition != NULL);
|
||||||
|
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"xspacing", &xspacing,
|
||||||
|
"yspacing", &yspacing,
|
||||||
|
NULL);
|
||||||
|
|
||||||
progress = GTK_PROGRESS (widget);
|
progress = GTK_PROGRESS (widget);
|
||||||
pbar = GTK_PROGRESS_BAR (widget);
|
pbar = GTK_PROGRESS_BAR (widget);
|
||||||
|
|
||||||
width = 2 * widget->style->xthickness + 3 + 2 * TEXT_SPACING;
|
width = 2 * widget->style->xthickness + xspacing;
|
||||||
height = 2 * widget->style->ythickness + 3 + 2 * TEXT_SPACING;
|
height = 2 * widget->style->ythickness + yspacing;
|
||||||
|
|
||||||
if (progress->show_text && pbar->bar_style != GTK_PROGRESS_DISCRETE)
|
if (progress->show_text && pbar->bar_style != GTK_PROGRESS_DISCRETE)
|
||||||
{
|
{
|
||||||
@ -766,7 +773,6 @@ gtk_progress_bar_paint_text (GtkProgressBar *pbar,
|
|||||||
{
|
{
|
||||||
GtkProgress *progress = GTK_PROGRESS (pbar);
|
GtkProgress *progress = GTK_PROGRESS (pbar);
|
||||||
GtkWidget *widget = GTK_WIDGET (pbar);
|
GtkWidget *widget = GTK_WIDGET (pbar);
|
||||||
|
|
||||||
gint x;
|
gint x;
|
||||||
gint y;
|
gint y;
|
||||||
gchar *buf;
|
gchar *buf;
|
||||||
@ -774,7 +780,12 @@ gtk_progress_bar_paint_text (GtkProgressBar *pbar,
|
|||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
PangoRectangle logical_rect;
|
PangoRectangle logical_rect;
|
||||||
GdkRectangle prelight_clip, normal_clip;
|
GdkRectangle prelight_clip, normal_clip;
|
||||||
|
gfloat text_xalign = progress->x_align;
|
||||||
|
gfloat text_yalign = progress->y_align;
|
||||||
|
|
||||||
|
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||||
|
text_xalign = 1.0 - text_xalign;
|
||||||
|
|
||||||
buf = gtk_progress_get_current_text (progress);
|
buf = gtk_progress_get_current_text (progress);
|
||||||
|
|
||||||
layout = gtk_widget_create_pango_layout (widget, buf);
|
layout = gtk_widget_create_pango_layout (widget, buf);
|
||||||
@ -784,15 +795,13 @@ gtk_progress_bar_paint_text (GtkProgressBar *pbar,
|
|||||||
|
|
||||||
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
||||||
|
|
||||||
x = widget->style->xthickness + 1 +
|
x = widget->style->xthickness + 1 + text_xalign *
|
||||||
(widget->allocation.width - 2 * widget->style->xthickness -
|
(widget->allocation.width - 2 * widget->style->xthickness -
|
||||||
2 - logical_rect.width)
|
2 - logical_rect.width);
|
||||||
* progress->x_align;
|
|
||||||
|
|
||||||
y = widget->style->ythickness + 1 +
|
y = widget->style->ythickness + 1 + text_yalign *
|
||||||
(widget->allocation.height - 2 * widget->style->ythickness -
|
(widget->allocation.height - 2 * widget->style->ythickness -
|
||||||
2 - logical_rect.height)
|
2 - logical_rect.height);
|
||||||
* progress->y_align;
|
|
||||||
|
|
||||||
rect.x = widget->style->xthickness;
|
rect.x = widget->style->xthickness;
|
||||||
rect.y = widget->style->ythickness;
|
rect.y = widget->style->ythickness;
|
||||||
|
Loading…
Reference in New Issue
Block a user