summaryrefslogtreecommitdiff
path: root/textscreen/txt_window.c
diff options
context:
space:
mode:
authorSimon Howard2006-05-20 20:49:50 +0000
committerSimon Howard2006-05-20 20:49:50 +0000
commit8741ed033996e3cfed28cfc97753ef0cd2c40b17 (patch)
tree868b9b22c1fc783a1eb8c5295b18fcb3b62d08b4 /textscreen/txt_window.c
parent6ecffa76f732fdc20873c1611723843464ac485a (diff)
downloadchocolate-doom-8741ed033996e3cfed28cfc97753ef0cd2c40b17.tar.gz
chocolate-doom-8741ed033996e3cfed28cfc97753ef0cd2c40b17.tar.bz2
chocolate-doom-8741ed033996e3cfed28cfc97753ef0cd2c40b17.zip
Add table class. Allow widgets with heights of more than one line.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 492
Diffstat (limited to 'textscreen/txt_window.c')
-rw-r--r--textscreen/txt_window.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c
index 85c6c5d1..fb08162e 100644
--- a/textscreen/txt_window.c
+++ b/textscreen/txt_window.c
@@ -79,21 +79,21 @@ static void CalcWindowSize(txt_window_t *window, int *w, int *h)
int max_width;
int height;
int i;
- int ww;
+ int ww, wh;
max_width = 10;
height = 0;
for (i=0; i<window->num_widgets; ++i)
{
- ww = TXT_WidgetWidth(window->widgets[i]);
+ TXT_CalcWidgetSize(window->widgets[i], &ww, &wh);
if (ww > max_width)
max_width = ww;
if (window->widgets[i]->visible)
{
- height += 1;
+ height += wh;
}
}
@@ -139,6 +139,7 @@ void TXT_DrawWindow(txt_window_t *window)
int x, y;
int window_x, window_y;
int i;
+ int ww, wh;
CalcWindowSize(window, &widgets_w, &widgets_h);
@@ -163,12 +164,14 @@ void TXT_DrawWindow(txt_window_t *window)
for (i=0; i<window->num_widgets; ++i)
{
- TXT_GotoXY(x, y);
- TXT_DrawWidget(window->widgets[i], widgets_w, i == window->selected);
-
if (window->widgets[i]->visible)
{
- y += 1;
+ TXT_GotoXY(x, y);
+ TXT_DrawWidget(window->widgets[i],
+ widgets_w,
+ i == window->selected);
+ TXT_CalcWidgetSize(window->widgets[i], &ww, &wh);
+ y += wh;
}
}