[Change] Made the toolkit thingies more flexible in height.

This commit is contained in:
Allanis 2013-03-31 16:17:43 +01:00
parent a66a9ea264
commit b5bfb19911

View File

@ -1336,6 +1336,7 @@ void dialogue_alert(const char* fmt, ...) {
char msg[256];
va_list ap;
unsigned int wdw;
int h;
if(window_exists("Warning")) return;
@ -1347,9 +1348,12 @@ void dialogue_alert(const char* fmt, ...) {
va_end(ap);
}
wdw = window_create("Warning", -1, -1, 300, 140);
h = gl_printHeight(&gl_smallFont, 260, msg);
window_addText(wdw, 20, -30, 260, 70, 0, "txtAlert",
// Create window.
wdw = window_create("Warning", -1, -1, 300, 90+h);
window_addText(wdw, 20, -30, 260, h, 0, "txtAlert",
&gl_smallFont, &cBlack, msg);
window_addButton(wdw, 135, 20, 50, 30, "btnOK", "OK",
@ -1368,6 +1372,7 @@ static unsigned int yesno_wid = 0;
int dialogue_YesNo(char* caption, const char* fmt, ...) {
char msg[256];
va_list ap;
int h;
if(yesno_wid) return -1;
@ -1379,10 +1384,13 @@ int dialogue_YesNo(char* caption, const char* fmt, ...) {
va_end(ap);
}
// Get the text height.
h = gl_printHeight(&gl_smallFont, 260, msg);
// Create window.
yesno_wid = window_create(caption, -1, -1, 300, 140);
yesno_wid = window_create(caption, -1, -1, 300, h+90);
// Text.
window_addText(yesno_wid, 20, -30, 260, 70, 0, "txtYesNo",
window_addText(yesno_wid, 20, -30, 260, h, 0, "txtYesNo",
&gl_smallFont, &cBlack, msg);
// Buttons.
window_addButton(yesno_wid, 300/2-50-10, 20, 50, 30, "btnYes", "Yes",
@ -1415,6 +1423,7 @@ static unsigned int input_wid = 0;
char* dialogue_input(char* title, int min, int max, const char* fmt, ...) {
char msg[256], *input;
va_list ap;
int h;
if(input_wid) return NULL;
@ -1426,15 +1435,18 @@ char* dialogue_input(char* title, int min, int max, const char* fmt, ...) {
va_end(ap);
}
// Get text height.
h = gl_printHeight(&gl_smallFont, 200, msg);
// Create the window.
input_wid = window_create(title, -1, -1, 240, 160);
input_wid = window_create(title, -1, -1, 240, h+140);
window_setFptr(input_wid, dialogue_inputClose);
// Text.
window_addText(input_wid, 30, -30, 200, 40, 0, "txtInput",
window_addText(input_wid, 30, -30, 200, h, 0, "txtInput",
&gl_smallFont, &cDConsole, msg);
// Input.
window_addInput(input_wid, 20, -70, 200, 20, "inpInput", max, 1);
window_addInput(input_wid, 20, -50-h, 200, 20, "inpInput", max, 1);
//Button.
window_addButton(input_wid, -20, 20, 80, 30,