diff console/libgnt/gntbox.c @ 13853:bbf0470cb348

[gaim-migrate @ 16312] Improvement/fixing of GntTree. Do the scrolling and stuff without 'reliably'. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 23 Jun 2006 00:45:45 +0000
parents 0e1e59770cb0
children a4c30c1d9de8
line wrap: on
line diff
--- a/console/libgnt/gntbox.c	Thu Jun 22 23:08:05 2006 +0000
+++ b/console/libgnt/gntbox.c	Fri Jun 23 00:45:45 2006 +0000
@@ -31,8 +31,8 @@
 		}
 		else
 		{
+			/* XXX: Position of the title might be configurable */
 			pos = (widget->priv.width - pos - 2) / 2;
-			/*pos = 2;*/
 		}
 		wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE));
 		mvwprintw(widget->window, 0, pos, title);
@@ -52,17 +52,15 @@
 	gboolean has_border = FALSE;
 	int x, y;
 
-	x = widget->priv.x;
-	y = widget->priv.y;
 	w = h = 0;
 	max = -1;
-	curx = widget->priv.x;
-	cury = widget->priv.y;
+	curx = widget->priv.x + 1;
+	cury = widget->priv.y + 1;
 	if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER))
 	{
 		has_border = TRUE;
-		curx += 1;
-		cury += 1;
+		curx += box->pad;
+		cury += box->pad;
 		if (!box->vertical)
 			curx++;
 	}
@@ -73,13 +71,13 @@
 		gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h);
 		if (box->vertical)
 		{
-			cury += h + 1;
+			cury += h + box->pad;
 			if (max < w)
 				max = w;
 		}
 		else
 		{
-			curx += w + 2;
+			curx += w + box->pad;
 			if (max < h)
 				max = h;
 		}
@@ -303,6 +301,7 @@
 
 	box->homogeneous = homo;
 	box->vertical = vert;
+	box->pad = 1;
 	gnt_widget_set_take_focus(widget, TRUE);
 	GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
 
@@ -321,3 +320,9 @@
 	b->title = g_strdup(title);
 }
 
+void gnt_box_set_pad(GntBox *box, int pad)
+{
+	box->pad = pad;
+	/* XXX: Perhaps redraw if already showing? */
+}
+