[Change] Made the toolkit thingies more flexible in height.
This commit is contained in:
parent
a66a9ea264
commit
b5bfb19911
@ -1336,6 +1336,7 @@ void dialogue_alert(const char* fmt, ...) {
|
|||||||
char msg[256];
|
char msg[256];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
unsigned int wdw;
|
unsigned int wdw;
|
||||||
|
int h;
|
||||||
|
|
||||||
if(window_exists("Warning")) return;
|
if(window_exists("Warning")) return;
|
||||||
|
|
||||||
@ -1347,9 +1348,12 @@ void dialogue_alert(const char* fmt, ...) {
|
|||||||
va_end(ap);
|
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);
|
&gl_smallFont, &cBlack, msg);
|
||||||
|
|
||||||
window_addButton(wdw, 135, 20, 50, 30, "btnOK", "OK",
|
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, ...) {
|
int dialogue_YesNo(char* caption, const char* fmt, ...) {
|
||||||
char msg[256];
|
char msg[256];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
int h;
|
||||||
|
|
||||||
if(yesno_wid) return -1;
|
if(yesno_wid) return -1;
|
||||||
|
|
||||||
@ -1379,10 +1384,13 @@ int dialogue_YesNo(char* caption, const char* fmt, ...) {
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the text height.
|
||||||
|
h = gl_printHeight(&gl_smallFont, 260, msg);
|
||||||
|
|
||||||
// Create window.
|
// Create window.
|
||||||
yesno_wid = window_create(caption, -1, -1, 300, 140);
|
yesno_wid = window_create(caption, -1, -1, 300, h+90);
|
||||||
// Text.
|
// 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);
|
&gl_smallFont, &cBlack, msg);
|
||||||
// Buttons.
|
// Buttons.
|
||||||
window_addButton(yesno_wid, 300/2-50-10, 20, 50, 30, "btnYes", "Yes",
|
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* dialogue_input(char* title, int min, int max, const char* fmt, ...) {
|
||||||
char msg[256], *input;
|
char msg[256], *input;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
int h;
|
||||||
|
|
||||||
if(input_wid) return NULL;
|
if(input_wid) return NULL;
|
||||||
|
|
||||||
@ -1426,15 +1435,18 @@ char* dialogue_input(char* title, int min, int max, const char* fmt, ...) {
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get text height.
|
||||||
|
h = gl_printHeight(&gl_smallFont, 200, msg);
|
||||||
|
|
||||||
// Create the window.
|
// 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);
|
window_setFptr(input_wid, dialogue_inputClose);
|
||||||
// Text.
|
// 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);
|
&gl_smallFont, &cDConsole, msg);
|
||||||
|
|
||||||
// Input.
|
// 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.
|
//Button.
|
||||||
window_addButton(input_wid, -20, 20, 80, 30,
|
window_addButton(input_wid, -20, 20, 80, 30,
|
||||||
|
Loading…
Reference in New Issue
Block a user