summaryrefslogtreecommitdiff
path: root/textscreen
diff options
context:
space:
mode:
authorSimon Howard2006-05-29 19:54:11 +0000
committerSimon Howard2006-05-29 19:54:11 +0000
commit1531993b0570f1a0af92a0238f4b871d233fa46f (patch)
treeaa111c9b1ab53612a67fefc2ef7d488c667bd841 /textscreen
parent936e7e116d8860f858ce9d8b39b1bac39d7e66bf (diff)
downloadchocolate-doom-1531993b0570f1a0af92a0238f4b871d233fa46f.tar.gz
chocolate-doom-1531993b0570f1a0af92a0238f4b871d233fa46f.tar.bz2
chocolate-doom-1531993b0570f1a0af92a0238f4b871d233fa46f.zip
Allow struts to force height as well as width. Hide "start game" button
for players which are not the game controller. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 541
Diffstat (limited to 'textscreen')
-rw-r--r--textscreen/examples/guitest.c3
-rw-r--r--textscreen/txt_strut.c5
-rw-r--r--textscreen/txt_strut.h5
-rw-r--r--textscreen/txt_table.c2
4 files changed, 9 insertions, 6 deletions
diff --git a/textscreen/examples/guitest.c b/textscreen/examples/guitest.c
index 23df5282..73334b47 100644
--- a/textscreen/examples/guitest.c
+++ b/textscreen/examples/guitest.c
@@ -13,6 +13,7 @@
#include "txt_label.h"
#include "txt_radiobutton.h"
#include "txt_separator.h"
+#include "txt_strut.h"
#include "txt_table.h"
#include "txt_window.h"
@@ -104,7 +105,7 @@ void SetupWindow(void)
TXT_AddWidget(table, TXT_NewButton(buf));
}
- TXT_AddWidget(window, TXT_NewLabel(""));
+ TXT_AddWidget(window, TXT_NewStrut(0, 1));
value_label = TXT_NewLabel("");
TXT_AddWidget(window, value_label);
diff --git a/textscreen/txt_strut.c b/textscreen/txt_strut.c
index 47e80130..0d827b5a 100644
--- a/textscreen/txt_strut.c
+++ b/textscreen/txt_strut.c
@@ -16,7 +16,7 @@ static void TXT_StrutSizeCalc(TXT_UNCAST_ARG(strut), int *w, int *h)
// Minimum width is the string length + two spaces for padding
*w = strut->width;
- *h = 0;
+ *h = strut->height;
}
static void TXT_StrutDrawer(TXT_UNCAST_ARG(strut), int w, int selected)
@@ -40,7 +40,7 @@ txt_widget_class_t txt_strut_class =
TXT_StrutDestructor,
};
-txt_strut_t *TXT_NewStrut(int width)
+txt_strut_t *TXT_NewStrut(int width, int height)
{
txt_strut_t *strut;
@@ -49,6 +49,7 @@ txt_strut_t *TXT_NewStrut(int width)
TXT_InitWidget(strut, &txt_strut_class);
strut->widget.selectable = 0;
strut->width = width;
+ strut->height = height;
return strut;
}
diff --git a/textscreen/txt_strut.h b/textscreen/txt_strut.h
index 5bf7b7e7..3f45b8db 100644
--- a/textscreen/txt_strut.h
+++ b/textscreen/txt_strut.h
@@ -30,7 +30,7 @@ typedef struct txt_strut_s txt_strut_t;
#include "txt_widget.h"
//
-// A strut is used to force a table to a minimum width. It is not
+// A strut is used to force a table to a minimum width/height. It is not
// visible but it takes up space.
//
@@ -38,9 +38,10 @@ struct txt_strut_s
{
txt_widget_t widget;
int width;
+ int height;
};
-txt_strut_t *TXT_NewStrut(int width);
+txt_strut_t *TXT_NewStrut(int width, int height);
#endif /* #ifndef TXT_STRUT_H */
diff --git a/textscreen/txt_table.c b/textscreen/txt_table.c
index b2055825..20c74b53 100644
--- a/textscreen/txt_table.c
+++ b/textscreen/txt_table.c
@@ -92,7 +92,7 @@ static void CalcRowColSizes(txt_table_t *table,
// Empty spacer if widget is NULL
ww = 0;
- wh = 1;
+ wh = 0;
}
if (wh > row_heights[y])