Prevent modal dialog from being dismissed immediately.
This commit is contained in:
parent
95cb35d5a1
commit
d2acbefc6d
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "modalDialog.h"
|
||||
|
||||
static int enableTimer;
|
||||
static Widget *ok;
|
||||
static Widget *okCancelOK;
|
||||
static Widget *okCancelCancel;
|
||||
|
@ -38,6 +39,8 @@ void initModalDialog(void)
|
|||
okCancelCancel = getWidget("cancel", "okCancel");
|
||||
okCancelCancel->action = NULL;
|
||||
okCancelCancel->isModal = 1;
|
||||
|
||||
enableTimer = 0;
|
||||
}
|
||||
|
||||
void showOKDialog(void (*callback)(void), const char *format, ...)
|
||||
|
@ -55,6 +58,9 @@ void showOKDialog(void (*callback)(void), const char *format, ...)
|
|||
app.modalDialog.type = MD_OK;
|
||||
|
||||
ok->action = callback;
|
||||
|
||||
enableTimer = FPS;
|
||||
ok->enabled = okCancelOK = okCancelCancel = 0;
|
||||
}
|
||||
|
||||
void showOKCancelDialog(void (*okCallback)(void), void (*cancelCallback)(void), const char *format, ...)
|
||||
|
@ -73,6 +79,9 @@ void showOKCancelDialog(void (*okCallback)(void), void (*cancelCallback)(void),
|
|||
|
||||
okCancelOK->action = okCallback;
|
||||
okCancelCancel->action = cancelCallback;
|
||||
|
||||
enableTimer = FPS;
|
||||
ok->enabled = okCancelOK = okCancelCancel = 0;
|
||||
}
|
||||
|
||||
void doModalDialog(void)
|
||||
|
@ -80,6 +89,12 @@ void doModalDialog(void)
|
|||
doWidgets();
|
||||
|
||||
clearInput();
|
||||
|
||||
enableTimer = MAX(enableTimer - 1, 0);
|
||||
if (!enableTimer)
|
||||
{
|
||||
ok->enabled = okCancelOK = okCancelCancel = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void drawModalDialog(void)
|
||||
|
|
Loading…
Reference in New Issue