Merge branch 'master' into native-layout
Conflicts: gtk/gtkframe.c tests/testheightforwidth.c
This commit is contained in:
@@ -390,7 +390,6 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
"GtkObject::user_data", NULL,
|
||||
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
||||
"GtkWindow::title", title ? title : "testrgb",
|
||||
"GtkWindow::allow_shrink", TRUE,
|
||||
NULL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (quit_func), NULL);
|
||||
|
||||
@@ -129,6 +129,7 @@ gdk_display_beep
|
||||
gdk_display_sync
|
||||
gdk_display_flush
|
||||
gdk_display_close
|
||||
gdk_display_is_closed
|
||||
gdk_display_list_devices
|
||||
gdk_display_get_event
|
||||
gdk_display_peek_event
|
||||
|
||||
@@ -106,8 +106,7 @@ GtkWindow::default_width, GtkWindow::default_height:
|
||||
- default_height is -1 if unset, or >= 0 if
|
||||
a default height is set
|
||||
|
||||
GtkWindow::allow_grow, GtkWindow::resizable:
|
||||
- equivalent properties; changing one notifies on the other
|
||||
GtkWindow::resizable:
|
||||
- if FALSE, we set the min size to the max size in the geometry
|
||||
hints.
|
||||
- If the app programmer has called gtk_window_set_geometry_hints()
|
||||
|
||||
@@ -7599,7 +7599,6 @@ int main (int argc, char *argv[])
|
||||
dialog = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), "GTKToolbar Tutorial");
|
||||
gtk_widget_set_size_request (GTK_WIDGET (dialog), 600, 300);
|
||||
GTK_WINDOW (dialog)->allow_shrink = TRUE;
|
||||
|
||||
/* typically we quit if someone tries to close us */
|
||||
g_signal_connect (dialog, "delete-event",
|
||||
|
||||
@@ -415,6 +415,7 @@ gdk_input_set_extension_events
|
||||
#if IN_HEADER(__GDK_DISPLAY_H__)
|
||||
#if IN_FILE(__GDK_DISPLAY_C__)
|
||||
gdk_display_close
|
||||
gdk_display_is_closed
|
||||
gdk_display_get_event
|
||||
gdk_display_get_device_manager
|
||||
gdk_display_get_device_state
|
||||
|
||||
@@ -338,6 +338,22 @@ gdk_display_close (GdkDisplay *display)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_is_closed:
|
||||
* @display: a #GdkDisplay
|
||||
*
|
||||
* Returns %TRUE if the display is closed.
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_is_closed (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return display->closed;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_get_event:
|
||||
* @display: a #GdkDisplay
|
||||
|
||||
@@ -211,7 +211,8 @@ void gdk_display_beep (GdkDisplay *display);
|
||||
void gdk_display_sync (GdkDisplay *display);
|
||||
void gdk_display_flush (GdkDisplay *display);
|
||||
|
||||
void gdk_display_close (GdkDisplay *display);
|
||||
void gdk_display_close (GdkDisplay *display);
|
||||
gboolean gdk_display_is_closed (GdkDisplay *display);
|
||||
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
GList * gdk_display_list_devices (GdkDisplay *display);
|
||||
|
||||
@@ -1982,6 +1982,7 @@ gtk_false G_GNUC_CONST
|
||||
gtk_true G_GNUC_CONST
|
||||
gtk_events_pending
|
||||
gtk_disable_setlocale
|
||||
gtk_distribute_natural_allocation
|
||||
gtk_set_locale
|
||||
gtk_check_version
|
||||
gtk_get_default_language
|
||||
|
||||
688
gtk/gtkbox.c
688
gtk/gtkbox.c
@@ -407,224 +407,237 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
gint nvis_children;
|
||||
gint nexpand_children;
|
||||
|
||||
guint border_width;
|
||||
GtkTextDirection direction;
|
||||
GtkAllocation child_allocation;
|
||||
GtkRequestedSize *sizes;
|
||||
|
||||
GtkPackType packing;
|
||||
|
||||
gint size;
|
||||
gint extra;
|
||||
gint n_extra_widgets = 0; /* Number of widgets that receive 1 extra px */
|
||||
gint x = 0, y = 0, i;
|
||||
gint child_size;
|
||||
|
||||
|
||||
widget->allocation = *allocation;
|
||||
|
||||
count_expand_children (box, &nvis_children, &nexpand_children);
|
||||
|
||||
if (nvis_children > 0)
|
||||
/* If there is no visible child, simply return. */
|
||||
if (nvis_children <= 0)
|
||||
return;
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
sizes = g_newa (GtkRequestedSize, nvis_children);
|
||||
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
else
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
|
||||
/* Retrieve desired size for visible children. */
|
||||
for (i = 0, children = private->children; children; children = children->next)
|
||||
{
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
GtkTextDirection direction = gtk_widget_get_direction (widget);
|
||||
GtkAllocation child_allocation;
|
||||
GtkRequestedSize *sizes = g_newa (GtkRequestedSize, nvis_children);
|
||||
child = children->data;
|
||||
|
||||
GtkPackType packing;
|
||||
|
||||
gint size;
|
||||
gint extra;
|
||||
gint x = 0, y = 0, i;
|
||||
gint child_size;
|
||||
if (!gtk_widget_get_visible (child->widget))
|
||||
continue;
|
||||
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
|
||||
allocation->height,
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
else
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
|
||||
allocation->width,
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
|
||||
/* Retrieve desired size for visible children */
|
||||
i = 0;
|
||||
children = private->children;
|
||||
while (children)
|
||||
|
||||
/* Assert the api is working properly */
|
||||
if (sizes[i].minimum_size < 0)
|
||||
g_error ("GtkBox child %s minimum %s: %d < 0 for %s %d",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].minimum_size,
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
|
||||
|
||||
if (sizes[i].natural_size < sizes[i].minimum_size)
|
||||
g_error ("GtkBox child %s natural %s: %d < minimum %d for %s %d",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].natural_size,
|
||||
sizes[i].minimum_size,
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
|
||||
|
||||
size -= sizes[i].minimum_size;
|
||||
size -= child->padding * 2;
|
||||
|
||||
sizes[i].data = child;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (private->homogeneous)
|
||||
{
|
||||
/* If were homogenous we still need to run the above loop to get the
|
||||
* minimum sizes for children that are not going to fill
|
||||
*/
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
else
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
|
||||
extra = size / nvis_children;
|
||||
n_extra_widgets = size % nvis_children;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bring children up to size first */
|
||||
size = gtk_distribute_natural_allocation (size, nvis_children, sizes);
|
||||
|
||||
/* Calculate space which hasn't distributed yet,
|
||||
* and is available for expanding children.
|
||||
*/
|
||||
if (nexpand_children > 0)
|
||||
{
|
||||
child = children->data;
|
||||
children = children->next;
|
||||
extra = size / nexpand_children;
|
||||
n_extra_widgets = size % nexpand_children;
|
||||
}
|
||||
else
|
||||
extra = 0;
|
||||
}
|
||||
|
||||
if (gtk_widget_get_visible (child->widget))
|
||||
{
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
|
||||
allocation->height,
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
else
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
|
||||
allocation->width,
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
|
||||
|
||||
/* Assert the api is working properly */
|
||||
if (sizes[i].minimum_size < 0)
|
||||
g_error ("GtkBox child %s minimum %s: %d < 0 for %s %d",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].minimum_size,
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
|
||||
|
||||
if (sizes[i].natural_size < sizes[i].minimum_size)
|
||||
g_error ("GtkBox child %s natural %s: %d < minimum %d for %s %d",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].natural_size,
|
||||
sizes[i].minimum_size,
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
|
||||
|
||||
size -= sizes[i].minimum_size;
|
||||
size -= child->padding * 2;
|
||||
|
||||
sizes[i].data = child;
|
||||
|
||||
i += 1;
|
||||
}
|
||||
/* Allocate child positions. */
|
||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||
{
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
child_allocation.y = allocation->y + border_width;
|
||||
child_allocation.height = MAX (1, allocation->height - border_width * 2);
|
||||
if (packing == GTK_PACK_START)
|
||||
x = allocation->x + border_width;
|
||||
else
|
||||
x = allocation->x + allocation->width - border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.x = allocation->x + border_width;
|
||||
child_allocation.width = MAX (1, allocation->width - border_width * 2);
|
||||
if (packing == GTK_PACK_START)
|
||||
y = allocation->y + border_width;
|
||||
else
|
||||
y = allocation->y + allocation->height - border_width;
|
||||
}
|
||||
|
||||
if (private->homogeneous)
|
||||
for (i = 0, children = private->children;
|
||||
children;
|
||||
children = children->next)
|
||||
{
|
||||
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
||||
* for children that are not going to fill
|
||||
child = children->data;
|
||||
|
||||
/* If widget is not visible, skip it. */
|
||||
if (!gtk_widget_get_visible (child->widget))
|
||||
continue;
|
||||
|
||||
/* If widget is packed differently skip it, but still increment i,
|
||||
* since widget is visible and will be handled in next loop iteration.
|
||||
*/
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
else
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
|
||||
extra = size / nvis_children;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bring children up to size first */
|
||||
size = gtk_distribute_natural_allocation (size, nvis_children, sizes);
|
||||
|
||||
/* Calculate space which hasn't distributed yet,
|
||||
* and is available for expanding children.
|
||||
*/
|
||||
if (nexpand_children > 0)
|
||||
extra = size / nexpand_children;
|
||||
else
|
||||
extra = 0;
|
||||
}
|
||||
|
||||
/* Allocate child positions. */
|
||||
|
||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||
{
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
child_allocation.y = allocation->y + border_width;
|
||||
child_allocation.height = MAX (1, allocation->height - border_width * 2);
|
||||
if (packing == GTK_PACK_START)
|
||||
x = allocation->x + border_width;
|
||||
else
|
||||
x = allocation->x + allocation->width - border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.x = allocation->x + border_width;
|
||||
child_allocation.width = MAX (1, allocation->width - border_width * 2);
|
||||
if (packing == GTK_PACK_START)
|
||||
y = allocation->y + border_width;
|
||||
else
|
||||
y = allocation->y + allocation->height - border_width;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
children = private->children;
|
||||
while (children)
|
||||
if (child->pack != packing)
|
||||
{
|
||||
child = children->data;
|
||||
children = children->next;
|
||||
|
||||
if (gtk_widget_get_visible (child->widget))
|
||||
{
|
||||
if (child->pack == packing)
|
||||
{
|
||||
/* Assign the child's size. */
|
||||
if (private->homogeneous)
|
||||
{
|
||||
if (nvis_children == 1)
|
||||
child_size = size;
|
||||
else
|
||||
child_size = extra;
|
||||
|
||||
nvis_children -= 1;
|
||||
size -= extra;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_size = sizes[i].minimum_size + child->padding * 2;
|
||||
|
||||
if (child->expand)
|
||||
{
|
||||
if (nexpand_children == 1)
|
||||
child_size += size;
|
||||
else
|
||||
child_size += extra;
|
||||
|
||||
nexpand_children -= 1;
|
||||
size -= extra;
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign the child's position. */
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
if (child->fill)
|
||||
{
|
||||
child_allocation.width = MAX (1, child_size - child->padding * 2);
|
||||
child_allocation.x = x + child->padding;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.width = sizes[i].minimum_size;
|
||||
child_allocation.x = x + (child_size - child_allocation.width) / 2;
|
||||
}
|
||||
|
||||
if (packing == GTK_PACK_START)
|
||||
{
|
||||
x += child_size + private->spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= child_size + private->spacing;
|
||||
|
||||
child_allocation.x -= child_size;
|
||||
}
|
||||
|
||||
if (direction == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
|
||||
|
||||
}
|
||||
else /* (private->orientation == GTK_ORIENTATION_VERTICAL) */
|
||||
{
|
||||
if (child->fill)
|
||||
{
|
||||
child_allocation.height = MAX (1, child_size - child->padding * 2);
|
||||
child_allocation.y = y + child->padding;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.height = sizes[i].minimum_size;
|
||||
child_allocation.y = y + (child_size - child_allocation.height) / 2;
|
||||
}
|
||||
|
||||
if (packing == GTK_PACK_START)
|
||||
{
|
||||
y += child_size + private->spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= child_size + private->spacing;
|
||||
|
||||
child_allocation.y -= child_size;
|
||||
}
|
||||
}
|
||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
||||
}
|
||||
|
||||
i += 1;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Assign the child's size. */
|
||||
if (private->homogeneous)
|
||||
{
|
||||
child_size = extra;
|
||||
|
||||
if (n_extra_widgets > 0)
|
||||
{
|
||||
child_size++;
|
||||
n_extra_widgets--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
child_size = sizes[i].minimum_size + child->padding * 2;
|
||||
|
||||
if (child->expand)
|
||||
{
|
||||
child_size += extra;
|
||||
|
||||
if (n_extra_widgets > 0)
|
||||
{
|
||||
child_size++;
|
||||
n_extra_widgets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign the child's position. */
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
if (child->fill)
|
||||
{
|
||||
child_allocation.width = MAX (1, child_size - child->padding * 2);
|
||||
child_allocation.x = x + child->padding;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.width = sizes[i].minimum_size;
|
||||
child_allocation.x = x + (child_size - child_allocation.width) / 2;
|
||||
}
|
||||
|
||||
if (packing == GTK_PACK_START)
|
||||
{
|
||||
x += child_size + private->spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= child_size + private->spacing;
|
||||
|
||||
child_allocation.x -= child_size;
|
||||
}
|
||||
|
||||
if (direction == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
|
||||
|
||||
}
|
||||
else /* (private->orientation == GTK_ORIENTATION_VERTICAL) */
|
||||
{
|
||||
if (child->fill)
|
||||
{
|
||||
child_allocation.height = MAX (1, child_size - child->padding * 2);
|
||||
child_allocation.y = y + child->padding;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.height = sizes[i].minimum_size;
|
||||
child_allocation.y = y + (child_size - child_allocation.height) / 2;
|
||||
}
|
||||
|
||||
if (packing == GTK_PACK_START)
|
||||
{
|
||||
y += child_size + private->spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= child_size + private->spacing;
|
||||
|
||||
child_allocation.y -= child_size;
|
||||
}
|
||||
}
|
||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -919,149 +932,166 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkBoxPriv *private = box->priv;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
gint nvis_children;
|
||||
gint nexpand_children;
|
||||
gint computed_minimum = 0, computed_natural = 0;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
GtkBoxPriv *private = box->priv;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
gint nvis_children;
|
||||
gint nexpand_children;
|
||||
gint computed_minimum = 0, computed_natural = 0;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
GtkRequestedSize *sizes;
|
||||
GtkPackType packing;
|
||||
gint size, extra, i;
|
||||
gint child_size, child_minimum, child_natural;
|
||||
gint n_extra_widgets = 0;
|
||||
|
||||
count_expand_children (box, &nvis_children, &nexpand_children);
|
||||
|
||||
if (nvis_children > 0)
|
||||
if (nvis_children <= 0)
|
||||
return;
|
||||
|
||||
sizes = g_newa (GtkRequestedSize, nvis_children);
|
||||
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
|
||||
/* Retrieve desired size for visible children */
|
||||
for (i = 0, children = private->children; children; children = children->next)
|
||||
{
|
||||
GtkRequestedSize *sizes = g_newa (GtkRequestedSize, nvis_children);
|
||||
GtkPackType packing;
|
||||
gint size, extra, i;
|
||||
gint child_size, child_minimum, child_natural;
|
||||
child = children->data;
|
||||
|
||||
if (gtk_widget_get_visible (child->widget))
|
||||
{
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
else
|
||||
gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
|
||||
/* Assert the api is working properly */
|
||||
if (sizes[i].minimum_size < 0)
|
||||
g_error ("GtkBox child %s minimum %s: %d < 0",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].minimum_size);
|
||||
|
||||
if (sizes[i].natural_size < sizes[i].minimum_size)
|
||||
g_error ("GtkBox child %s natural %s: %d < minimum %d",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].natural_size,
|
||||
sizes[i].minimum_size);
|
||||
|
||||
size -= sizes[i].minimum_size;
|
||||
size -= child->padding * 2;
|
||||
|
||||
sizes[i].data = child;
|
||||
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (private->homogeneous)
|
||||
{
|
||||
/* If were homogenous we still need to run the above loop to get the
|
||||
* minimum sizes for children that are not going to fill
|
||||
*/
|
||||
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
extra = size / nvis_children;
|
||||
n_extra_widgets = size % nvis_children;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bring children up to size first */
|
||||
size = gtk_distribute_natural_allocation (size, nvis_children, sizes);
|
||||
|
||||
/* Retrieve desired size for visible children */
|
||||
for (i = 0, children = private->children; children; children = children->next)
|
||||
/* Calculate space which hasn't distributed yet,
|
||||
* and is available for expanding children.
|
||||
*/
|
||||
if (nexpand_children > 0)
|
||||
{
|
||||
extra = size / nexpand_children;
|
||||
n_extra_widgets = size % nexpand_children;
|
||||
}
|
||||
else
|
||||
extra = 0;
|
||||
}
|
||||
|
||||
/* Allocate child positions. */
|
||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||
{
|
||||
for (i = 0, children = private->children;
|
||||
children;
|
||||
children = children->next)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
if (gtk_widget_get_visible (child->widget))
|
||||
{
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
else
|
||||
gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
|
||||
&sizes[i].minimum_size,
|
||||
&sizes[i].natural_size);
|
||||
|
||||
/* Assert the api is working properly */
|
||||
if (sizes[i].minimum_size < 0)
|
||||
g_error ("GtkBox child %s minimum %s: %d < 0",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].minimum_size);
|
||||
|
||||
if (sizes[i].natural_size < sizes[i].minimum_size)
|
||||
g_error ("GtkBox child %s natural %s: %d < minimum %d",
|
||||
gtk_widget_get_name (GTK_WIDGET (child->widget)),
|
||||
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
|
||||
sizes[i].natural_size,
|
||||
sizes[i].minimum_size);
|
||||
/* If widget is not visible, skip it. */
|
||||
if (!gtk_widget_get_visible (child->widget))
|
||||
continue;
|
||||
|
||||
size -= sizes[i].minimum_size;
|
||||
size -= child->padding * 2;
|
||||
|
||||
sizes[i].data = child;
|
||||
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (private->homogeneous)
|
||||
{
|
||||
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
||||
* for children that are not going to fill
|
||||
/* If widget is packed differently skip it, but still increment i,
|
||||
* since widget is visible and will be handled in next loop iteration.
|
||||
*/
|
||||
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
extra = size / nvis_children;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bring children up to size first */
|
||||
size = gtk_distribute_natural_allocation (size, nvis_children, sizes);
|
||||
|
||||
/* Calculate space which hasn't distributed yet,
|
||||
* and is available for expanding children.
|
||||
*/
|
||||
if (nexpand_children > 0)
|
||||
extra = size / nexpand_children;
|
||||
else
|
||||
extra = 0;
|
||||
}
|
||||
|
||||
/* Allocate child positions. */
|
||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||
{
|
||||
for (i = 0, children = private->children; children; children = children->next)
|
||||
if (child->pack != packing)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
if (gtk_widget_get_visible (child->widget))
|
||||
{
|
||||
if (child->pack == packing)
|
||||
{
|
||||
/* Assign the child's size. */
|
||||
if (private->homogeneous)
|
||||
{
|
||||
if (nvis_children == 1)
|
||||
child_size = size;
|
||||
else
|
||||
child_size = extra;
|
||||
|
||||
nvis_children -= 1;
|
||||
size -= extra;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_size = sizes[i].minimum_size + child->padding * 2;
|
||||
|
||||
if (child->expand)
|
||||
{
|
||||
if (nexpand_children == 1)
|
||||
child_size += size;
|
||||
else
|
||||
child_size += extra;
|
||||
|
||||
nexpand_children -= 1;
|
||||
size -= extra;
|
||||
}
|
||||
}
|
||||
|
||||
if (child->fill)
|
||||
{
|
||||
child_size = MAX (1, child_size - child->padding * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
child_size = sizes[i].minimum_size;
|
||||
}
|
||||
|
||||
|
||||
/* Assign the child's position. */
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
|
||||
child_size, &child_minimum, &child_natural);
|
||||
else /* (private->orientation == GTK_ORIENTATION_VERTICAL) */
|
||||
gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
|
||||
child_size, &child_minimum, &child_natural);
|
||||
|
||||
|
||||
computed_minimum = MAX (computed_minimum, child_minimum);
|
||||
computed_natural = MAX (computed_natural, child_natural);
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child->pack == packing)
|
||||
{
|
||||
/* Assign the child's size. */
|
||||
if (private->homogeneous)
|
||||
{
|
||||
child_size = extra;
|
||||
|
||||
if (n_extra_widgets > 0)
|
||||
{
|
||||
child_size++;
|
||||
n_extra_widgets--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
child_size = sizes[i].minimum_size + child->padding * 2;
|
||||
|
||||
if (child->expand)
|
||||
{
|
||||
child_size += extra;
|
||||
|
||||
if (n_extra_widgets > 0)
|
||||
{
|
||||
child_size++;
|
||||
n_extra_widgets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (child->fill)
|
||||
{
|
||||
child_size = MAX (1, child_size - child->padding * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
child_size = sizes[i].minimum_size;
|
||||
}
|
||||
|
||||
|
||||
/* Assign the child's position. */
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
|
||||
child_size, &child_minimum, &child_natural);
|
||||
else /* (private->orientation == GTK_ORIENTATION_VERTICAL) */
|
||||
gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
|
||||
child_size, &child_minimum, &child_natural);
|
||||
|
||||
|
||||
computed_minimum = MAX (computed_minimum, child_minimum);
|
||||
computed_natural = MAX (computed_natural, child_natural);
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1476,31 +1476,34 @@ gtk_button_size_allocate (GtkWidget *widget,
|
||||
child_allocation.x = widget->allocation.x + border_width + inner_border.left + xthickness;
|
||||
child_allocation.y = widget->allocation.y + border_width + inner_border.top + ythickness;
|
||||
|
||||
child_allocation.width = MAX (1, widget->allocation.width -
|
||||
xthickness * 2 -
|
||||
inner_border.left -
|
||||
inner_border.right -
|
||||
border_width * 2);
|
||||
child_allocation.height = MAX (1, widget->allocation.height -
|
||||
ythickness * 2 -
|
||||
inner_border.top -
|
||||
inner_border.bottom -
|
||||
border_width * 2);
|
||||
child_allocation.width =
|
||||
widget->allocation.width -
|
||||
xthickness * 2 -
|
||||
inner_border.left -
|
||||
inner_border.right -
|
||||
border_width * 2;
|
||||
|
||||
child_allocation.height =
|
||||
widget->allocation.height -
|
||||
ythickness * 2 -
|
||||
inner_border.top -
|
||||
inner_border.bottom -
|
||||
border_width * 2;
|
||||
|
||||
if (gtk_widget_get_can_default (GTK_WIDGET (button)))
|
||||
{
|
||||
child_allocation.x += default_border.left;
|
||||
child_allocation.y += default_border.top;
|
||||
child_allocation.width = MAX (1, child_allocation.width - default_border.left - default_border.right);
|
||||
child_allocation.height = MAX (1, child_allocation.height - default_border.top - default_border.bottom);
|
||||
child_allocation.width = child_allocation.width - default_border.left - default_border.right;
|
||||
child_allocation.height = child_allocation.height - default_border.top - default_border.bottom;
|
||||
}
|
||||
|
||||
if (gtk_widget_get_can_focus (GTK_WIDGET (button)))
|
||||
{
|
||||
child_allocation.x += focus_width + focus_pad;
|
||||
child_allocation.y += focus_width + focus_pad;
|
||||
child_allocation.width = MAX (1, child_allocation.width - (focus_width + focus_pad) * 2);
|
||||
child_allocation.height = MAX (1, child_allocation.height - (focus_width + focus_pad) * 2);
|
||||
child_allocation.width = child_allocation.width - (focus_width + focus_pad) * 2;
|
||||
child_allocation.height = child_allocation.height - (focus_width + focus_pad) * 2;
|
||||
}
|
||||
|
||||
if (button->depressed)
|
||||
@@ -1516,6 +1519,9 @@ gtk_button_size_allocate (GtkWidget *widget,
|
||||
child_allocation.y += child_displacement_y;
|
||||
}
|
||||
|
||||
child_allocation.width = MAX (1, child_allocation.width);
|
||||
child_allocation.height = MAX (1, child_allocation.height);
|
||||
|
||||
gtk_widget_size_allocate (child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -905,7 +905,7 @@ gtk_frame_get_height_for_width (GtkSizeRequest *request,
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget),
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
|
||||
width, &child_min, &child_nat);
|
||||
minimum += child_min;
|
||||
natural += child_nat;
|
||||
|
||||
@@ -84,6 +84,8 @@ struct _GtkLabelPriv
|
||||
gint wrap_width;
|
||||
gint width_chars;
|
||||
gint max_width_chars;
|
||||
|
||||
gdouble angle;
|
||||
};
|
||||
|
||||
/* Notes about the handling of links:
|
||||
@@ -345,8 +347,6 @@ static void gtk_label_get_height_for_width (GtkSizeRequest *
|
||||
gint *minimum_height,
|
||||
gint *natural_height);
|
||||
|
||||
static GQuark quark_angle = 0;
|
||||
|
||||
static GtkBuildableIface *buildable_parent_iface = NULL;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkLabel, gtk_label, GTK_TYPE_MISC,
|
||||
@@ -386,8 +386,6 @@ gtk_label_class_init (GtkLabelClass *class)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GtkBindingSet *binding_set;
|
||||
|
||||
quark_angle = g_quark_from_static_string ("angle");
|
||||
|
||||
gobject_class->set_property = gtk_label_set_property;
|
||||
gobject_class->get_property = gtk_label_get_property;
|
||||
gobject_class->finalize = gtk_label_finalize;
|
||||
@@ -3252,7 +3250,8 @@ gtk_label_ensure_layout (GtkLabel *label, gboolean guess_wrap_width)
|
||||
else if (guess_wrap_width == FALSE &&
|
||||
widget->allocation.width > 1 && widget->allocation.height > 1)
|
||||
{
|
||||
gint xpad, ypad;
|
||||
PangoRectangle rect;
|
||||
gint xpad, ypad, natural_width;
|
||||
gtk_misc_get_padding (GTK_MISC (label), &xpad, &ypad);
|
||||
|
||||
if (angle == 90 || angle == 270)
|
||||
@@ -3260,6 +3259,12 @@ gtk_label_ensure_layout (GtkLabel *label, gboolean guess_wrap_width)
|
||||
else
|
||||
width = widget->allocation.width - xpad * 2;
|
||||
|
||||
/* dont set a wrap width wider than the label's natural width
|
||||
* incase we're allocated more space than needed */
|
||||
pango_layout_get_extents (priv->layout, NULL, &rect);
|
||||
natural_width = PANGO_PIXELS (rect.width);
|
||||
width = MIN (natural_width, width);
|
||||
|
||||
pango_layout_set_wrap (priv->layout, priv->wrap_mode);
|
||||
pango_layout_set_width (priv->layout, MAX (width, 1) * PANGO_SCALE);
|
||||
}
|
||||
@@ -3419,7 +3424,6 @@ gtk_label_get_size (GtkSizeRequest *widget,
|
||||
GtkLabelPriv *priv = label->priv;
|
||||
PangoRectangle required_rect;
|
||||
PangoRectangle natural_rect;
|
||||
gdouble angle;
|
||||
gint xpad, ypad;
|
||||
|
||||
/* "width-chars" Hard-coded minimum width:
|
||||
@@ -3438,8 +3442,6 @@ gtk_label_get_size (GtkSizeRequest *widget,
|
||||
gtk_label_clear_layout (label);
|
||||
gtk_label_ensure_layout (label, TRUE);
|
||||
|
||||
angle = gtk_label_get_angle (label);
|
||||
|
||||
/* Start off with the pixel extents of the rendered layout */
|
||||
pango_layout_get_extents (priv->layout, NULL, &required_rect);
|
||||
required_rect.x = required_rect.y = 0;
|
||||
@@ -3473,7 +3475,8 @@ gtk_label_get_size (GtkSizeRequest *widget,
|
||||
* layout to not ellipsize when we know we have been allocated our
|
||||
* full natural size, or it may be that pango needs a fix here).
|
||||
*/
|
||||
if (priv->ellipsize && angle != 0 && angle != 90 && angle != 180 && angle != 270 && angle != 360)
|
||||
if (priv->ellipsize && priv->angle != 0 && priv->angle != 90 &&
|
||||
priv->angle != 180 && priv->angle != 270 && priv->angle != 360)
|
||||
{
|
||||
/* For some reason we only need this at about 110 degrees, and only
|
||||
* when gaining in height
|
||||
@@ -3497,7 +3500,7 @@ gtk_label_get_size (GtkSizeRequest *widget,
|
||||
* ellipsized labels.
|
||||
*/
|
||||
if (!(priv->ellipsize && priv->have_transform) &&
|
||||
(angle == 90 || angle == 270))
|
||||
(priv->angle == 90 || priv->angle == 270))
|
||||
{
|
||||
/* Doing a h4w request on a rotated label here, return the
|
||||
* required width for the minimum height.
|
||||
@@ -3524,7 +3527,7 @@ gtk_label_get_size (GtkSizeRequest *widget,
|
||||
* ellipsized labels.
|
||||
*/
|
||||
if (!(priv->ellipsize && priv->have_transform) &&
|
||||
(angle == 0 || angle == 180))
|
||||
(priv->angle == 0 || priv->angle == 180 || priv->angle == 360))
|
||||
{
|
||||
/* Doing a w4h request on a label here, return the required
|
||||
* height for the minimum width.
|
||||
@@ -3583,9 +3586,8 @@ gtk_label_get_width_for_height (GtkSizeRequest *widget,
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
GtkLabelPriv *priv = label->priv;
|
||||
gdouble angle = gtk_label_get_angle (label);
|
||||
|
||||
if (priv->wrap && (angle == 90 || angle == 270))
|
||||
if (priv->wrap && (priv->angle == 90 || priv->angle == 270))
|
||||
{
|
||||
gint xpad, ypad;
|
||||
|
||||
@@ -3616,9 +3618,8 @@ gtk_label_get_height_for_width (GtkSizeRequest *widget,
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
GtkLabelPriv *priv = label->priv;
|
||||
gdouble angle = gtk_label_get_angle (label);
|
||||
|
||||
if (priv->wrap && (angle == 0 || angle == 180 || angle == 360))
|
||||
if (priv->wrap && (priv->angle == 0 || priv->angle == 180 || priv->angle == 360))
|
||||
{
|
||||
gint xpad, ypad;
|
||||
|
||||
@@ -3836,12 +3837,10 @@ get_layout_location (GtkLabel *label,
|
||||
gint xpad, ypad;
|
||||
gfloat xalign, yalign;
|
||||
PangoRectangle logical;
|
||||
gdouble angle;
|
||||
|
||||
misc = GTK_MISC (label);
|
||||
widget = GTK_WIDGET (label);
|
||||
priv = label->priv;
|
||||
angle = gtk_label_get_angle (label);
|
||||
|
||||
gtk_misc_get_alignment (misc, &xalign, &yalign);
|
||||
gtk_misc_get_padding (misc, &xpad, &ypad);
|
||||
@@ -3851,18 +3850,6 @@ get_layout_location (GtkLabel *label,
|
||||
|
||||
pango_layout_get_extents (priv->layout, NULL, &logical);
|
||||
|
||||
/* Do the wrap width delimiting before the transform
|
||||
*/
|
||||
if (priv->wrap || priv->ellipsize || priv->width_chars > 0)
|
||||
{
|
||||
int width;
|
||||
|
||||
width = pango_layout_get_width (priv->layout);
|
||||
|
||||
if (width != -1)
|
||||
logical.width = MIN (width, logical.width);
|
||||
}
|
||||
|
||||
if (priv->have_transform)
|
||||
{
|
||||
PangoContext *context = gtk_widget_get_pango_context (widget);
|
||||
@@ -3887,8 +3874,6 @@ get_layout_location (GtkLabel *label,
|
||||
x = MIN (x, widget->allocation.x + widget->allocation.width - xpad);
|
||||
|
||||
|
||||
|
||||
|
||||
/* bgo#315462 - For single-line labels, *do* align the requisition with
|
||||
* respect to the allocation, even if we are under-allocated. For multi-line
|
||||
* labels, always show the top of the text when they are under-allocated. The
|
||||
@@ -5204,12 +5189,6 @@ gtk_label_get_selectable (GtkLabel *label)
|
||||
return priv->select_info && priv->select_info->selectable;
|
||||
}
|
||||
|
||||
static void
|
||||
free_angle (gpointer angle)
|
||||
{
|
||||
g_slice_free (gdouble, angle);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_label_set_angle:
|
||||
* @label: a #GtkLabel
|
||||
@@ -5227,20 +5206,12 @@ void
|
||||
gtk_label_set_angle (GtkLabel *label,
|
||||
gdouble angle)
|
||||
{
|
||||
gdouble *label_angle;
|
||||
GtkLabelPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_LABEL (label));
|
||||
|
||||
label_angle = (gdouble *)g_object_get_qdata (G_OBJECT (label), quark_angle);
|
||||
priv = label->priv;
|
||||
|
||||
if (!label_angle)
|
||||
{
|
||||
label_angle = g_slice_new (gdouble);
|
||||
*label_angle = 0.0;
|
||||
g_object_set_qdata_full (G_OBJECT (label), quark_angle,
|
||||
label_angle, free_angle);
|
||||
}
|
||||
|
||||
/* Canonicalize to [0,360]. We don't canonicalize 360 to 0, because
|
||||
* double property ranges are inclusive, and changing 360 to 0 would
|
||||
* make a property editor behave strangely.
|
||||
@@ -5248,9 +5219,9 @@ gtk_label_set_angle (GtkLabel *label,
|
||||
if (angle < 0 || angle > 360.0)
|
||||
angle = angle - 360. * floor (angle / 360.);
|
||||
|
||||
if (*label_angle != angle)
|
||||
if (priv->angle != angle)
|
||||
{
|
||||
*label_angle = angle;
|
||||
priv->angle = angle;
|
||||
|
||||
gtk_label_clear_layout (label);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (label));
|
||||
@@ -5273,16 +5244,9 @@ gtk_label_set_angle (GtkLabel *label,
|
||||
gdouble
|
||||
gtk_label_get_angle (GtkLabel *label)
|
||||
{
|
||||
gdouble *angle;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_LABEL (label), 0.0);
|
||||
|
||||
angle = (gdouble *)g_object_get_qdata (G_OBJECT (label), quark_angle);
|
||||
|
||||
if (angle)
|
||||
return *angle;
|
||||
else
|
||||
return 0.0;
|
||||
return label->priv->angle;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -717,7 +717,7 @@ gtk_decorated_window_recalculate_regions (GtkWindow *window)
|
||||
n_regions += 2; /* close, Title */
|
||||
if (deco->maximizable)
|
||||
n_regions += 1;
|
||||
if (window->allow_shrink || window->allow_grow)
|
||||
if (gtk_window_get_resizable (window))
|
||||
n_regions += 2;
|
||||
|
||||
if (deco->n_regions != n_regions)
|
||||
@@ -759,7 +759,7 @@ gtk_decorated_window_recalculate_regions (GtkWindow *window)
|
||||
region->type = GTK_WINDOW_REGION_TITLE;
|
||||
region++;
|
||||
|
||||
if (window->allow_shrink || window->allow_grow)
|
||||
if (gtk_window_get_resizable (window))
|
||||
{
|
||||
region->rect.x = width - (DECORATION_BORDER_RIGHT + 10);
|
||||
region->rect.y = height - DECORATION_BORDER_BOTTOM;
|
||||
|
||||
@@ -7331,10 +7331,6 @@ gtk_window_get_resizable (GtkWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
|
||||
|
||||
/* allow_grow is most likely to indicate the semantic concept we
|
||||
* mean by "resizable" (and will be a reliable indicator if
|
||||
* set_policy() hasn't been called)
|
||||
*/
|
||||
return window->resizable;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@ main (int argc, char *argv[])
|
||||
"user_data", NULL,
|
||||
"type", GTK_WINDOW_TOPLEVEL,
|
||||
"title", "hello world",
|
||||
"allow_grow", FALSE,
|
||||
"allow_shrink", FALSE,
|
||||
"resizable", FALSE,
|
||||
"border_width", 10,
|
||||
NULL),
|
||||
"signal::destroy", gtk_main_quit, NULL,
|
||||
|
||||
@@ -3375,8 +3375,7 @@ create_tooltips (GtkWidget *widget)
|
||||
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
||||
"GtkContainer::border_width", 0,
|
||||
"GtkWindow::title", "Tooltips",
|
||||
"GtkWindow::allow_shrink", TRUE,
|
||||
"GtkWindow::allow_grow", FALSE,
|
||||
"GtkWindow::resizable", FALSE,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
@@ -3495,8 +3494,8 @@ create_image (GtkWidget *widget)
|
||||
/* this is bogus for testing drawing when allocation < request,
|
||||
* don't copy into real code
|
||||
*/
|
||||
g_object_set (window, "allow_shrink", TRUE, "allow_grow", TRUE, NULL);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
@@ -6573,7 +6572,7 @@ create_rulers (GtkWidget *widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (widget));
|
||||
|
||||
g_object_set (window, "allow_shrink", TRUE, "allow_grow", TRUE, NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
@@ -8331,22 +8330,11 @@ set_geometry_callback (GtkWidget *entry,
|
||||
}
|
||||
|
||||
static void
|
||||
allow_shrink_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
g_object_set (g_object_get_data (data, "target"),
|
||||
"allow_shrink",
|
||||
GTK_TOGGLE_BUTTON (widget)->active,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
allow_grow_callback (GtkWidget *widget,
|
||||
resizable_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
g_object_set (g_object_get_data (data, "target"),
|
||||
"allow_grow",
|
||||
GTK_TOGGLE_BUTTON (widget)->active,
|
||||
"resizable", GTK_TOGGLE_BUTTON (widget)->active,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -8719,20 +8707,12 @@ window_controls (GtkWidget *window)
|
||||
G_CALLBACK (move_to_position_callback),
|
||||
control_window);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_check_button_new_with_label ("Allow shrink");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
g_signal_connect (button,
|
||||
"toggled",
|
||||
G_CALLBACK (allow_shrink_callback),
|
||||
control_window);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_check_button_new_with_label ("Allow grow");
|
||||
button = gtk_check_button_new_with_label ("Allow resize");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
g_signal_connect (button,
|
||||
"toggled",
|
||||
G_CALLBACK (allow_grow_callback),
|
||||
G_CALLBACK (resizable_callback),
|
||||
control_window);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
@@ -116,8 +116,7 @@ main (int argc, char *argv[])
|
||||
"user_data", NULL,
|
||||
"type", GTK_WINDOW_TOPLEVEL,
|
||||
"title", label,
|
||||
"allow_grow", FALSE,
|
||||
"allow_shrink", FALSE,
|
||||
"resizable", FALSE,
|
||||
"border_width", 10, NULL,
|
||||
NULL);
|
||||
g_signal_connect (window[i], "destroy",
|
||||
|
||||
@@ -286,7 +286,6 @@ new_testrgb_window (void)
|
||||
"GtkObject::user_data", NULL,
|
||||
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
||||
"GtkWindow::title", "testrgb",
|
||||
"GtkWindow::allow_shrink", FALSE,
|
||||
NULL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (quit_func), NULL);
|
||||
|
||||
Reference in New Issue
Block a user