mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-30 15:31:34 +00:00
Fix gtk_grid_attach_next_to
The function did not behave as intended when @sibling is NULL. Also add an example to the docs to clarify the intended behaviour.
This commit is contained in:
parent
7f80ee3a38
commit
362ff7bedf
@ -1470,6 +1470,9 @@ gtk_grid_attach (GtkGrid *grid,
|
|||||||
* @side. When @sibling is %NULL, the widget is placed in row (for
|
* @side. When @sibling is %NULL, the widget is placed in row (for
|
||||||
* left or right placement) or column 0 (for top or bottom placement),
|
* left or right placement) or column 0 (for top or bottom placement),
|
||||||
* at the end indicated by @side.
|
* at the end indicated by @side.
|
||||||
|
*
|
||||||
|
* Attaching widgets labeled [1], [2], [3] with @sibling == %NULL and
|
||||||
|
* @side == %GTK_POS_LEFT yields a layout of [3][2][1].
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_grid_attach_next_to (GtkGrid *grid,
|
gtk_grid_attach_next_to (GtkGrid *grid,
|
||||||
@ -1520,20 +1523,22 @@ gtk_grid_attach_next_to (GtkGrid *grid,
|
|||||||
switch (side)
|
switch (side)
|
||||||
{
|
{
|
||||||
case GTK_POS_LEFT:
|
case GTK_POS_LEFT:
|
||||||
left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, TRUE);
|
left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, FALSE);
|
||||||
|
left -= width;
|
||||||
top = 0;
|
top = 0;
|
||||||
break;
|
break;
|
||||||
case GTK_POS_RIGHT:
|
case GTK_POS_RIGHT:
|
||||||
left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, FALSE);
|
left = find_attach_position (grid, GTK_ORIENTATION_HORIZONTAL, 0, height, TRUE);
|
||||||
top = 0;
|
top = 0;
|
||||||
break;
|
break;
|
||||||
case GTK_POS_TOP:
|
case GTK_POS_TOP:
|
||||||
left = 0;
|
left = 0;
|
||||||
top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, TRUE);
|
top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, FALSE);
|
||||||
|
top -= height;
|
||||||
break;
|
break;
|
||||||
case GTK_POS_BOTTOM:
|
case GTK_POS_BOTTOM:
|
||||||
left = 0;
|
left = 0;
|
||||||
top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, FALSE);
|
top = find_attach_position (grid, GTK_ORIENTATION_VERTICAL, 0, width, TRUE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
Loading…
Reference in New Issue
Block a user