[gtk+/wip/baseline2] GtkGrid: Modify requested baseline as per baseline_pos
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baseline2] GtkGrid: Modify requested baseline as per baseline_pos
- Date: Mon, 25 Mar 2013 16:57:28 +0000 (UTC)
commit 8b8d6e188d9730e90450f5f91ccb063a846fa969
Author: Alexander Larsson <alexl redhat com>
Date: Mon Mar 25 17:58:29 2013 +0100
GtkGrid: Modify requested baseline as per baseline_pos
If non-baseline-aligned items in the row make the height higher,
use baseline_pos to figure out where to request the baseline.
gtk/gtkgrid.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index 1eb7cfd..1b466c8 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -718,6 +718,7 @@ gtk_grid_request_non_spanning (GtkGridRequest *request,
GtkGridLine *line;
GList *list;
gint i;
+ GtkBaselinePosition baseline_pos;
gint minimum, minimum_baseline;
gint natural, natural_baseline;
@@ -760,6 +761,30 @@ gtk_grid_request_non_spanning (GtkGridRequest *request,
{
line->minimum = MAX (line->minimum, line->minimum_above + line->minimum_below);
line->natural = MAX (line->natural, line->natural_above + line->natural_below);
+
+ baseline_pos = gtk_grid_get_row_baseline_position (request->grid, i + lines->min);
+
+ switch (baseline_pos)
+ {
+ case GTK_BASELINE_POSITION_TOP:
+ line->minimum_above += 0;
+ line->minimum_below += line->minimum - (line->minimum_above + line->minimum_below);
+ line->natural_above += 0;
+ line->natural_below += line->natural - (line->natural_above + line->natural_below);
+ break;
+ case GTK_BASELINE_POSITION_CENTER:
+ line->minimum_above += (line->minimum - (line->minimum_above + line->minimum_below))/2;
+ line->minimum_below += (line->minimum - (line->minimum_above + line->minimum_below))/2;
+ line->natural_above += (line->natural - (line->natural_above + line->natural_below))/2;
+ line->natural_below += (line->natural - (line->natural_above + line->natural_below))/2;
+ break;
+ case GTK_BASELINE_POSITION_BOTTOM:
+ line->minimum_above += line->minimum - (line->minimum_above + line->minimum_below);
+ line->minimum_below += 0;
+ line->natural_above += line->natural - (line->natural_above + line->natural_below);
+ line->natural_below += 0;
+ break;
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]