kolibrios/programs/emulator/e80/trunk/system/msgbox.c
CleverMouse 09548370da e80: multi-language build
git-svn-id: svn://kolibrios.org@1854 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-02-08 14:43:48 +00:00

164 lines
2.4 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

///=============================
#define MB_OK 0
#define MB_OKCANCEL 1
#define MB_ABORTRETRYIGNORE 2
#define MB_YESNOCANCEL 3
#define MB_YESNO 4
#define MB_RETRYCANCEL 5
#define IDOK 1
#define IDCANCEL 2
#define IDABORT 3
#define IDRETRY 4
#define IDIGNORE 5
#define IDYES 6
#define IDNO 7
///=============================
#if LANG_RUS
char BTN_OK[]={"OK"};
char BTN_CANCEL[]={"Žâ¬¥­ "};
char BTN_ABORT[]={"<EFBFBD>४à â¨âì"};
char BTN_RETRY[]={"<EFBFBD>®¢â®à¨âì"};
char BTN_INGNORE[]={"ˆ£­®à¨à®¢ âì"};
char BTN_NO[]={"<EFBFBD>¥â"};
#else
char BTN_OK[]={"OK"};
char BTN_CANCEL[]={"Cancel"};
char BTN_ABORT[]={"Abort"};
char BTN_RETRY[]={"Retry"};
char BTN_INGNORE[]={"Ignore"};
char BTN_NO[]={"No"};
#endif
///=============================
kol_struct_import *MSG_BOX_IMPORT = NULL;
int (* _stdcall mb_create)(char *m, char* t);
char msg[1024];
char thread[1024];
///=============================
char MessageBox(char *text, char *caption, int type)
{
int i, j;
if (MSG_BOX_IMPORT == NULL)
{
MSG_BOX_IMPORT = kol_cofflib_load("/sys/lib/Msgbox.obj");
if (MSG_BOX_IMPORT == NULL)
kol_exit();
mb_create = kol_cofflib_procload (MSG_BOX_IMPORT, "mb_create");
if (mb_create == NULL)
kol_exit();
}
msg[0] = 255;
msg[1] = 0;
for (i = 2, j = 0; ;i++, j++)
{
msg[i] = caption[j];
if (0 == msg[i])
break;
}
i++;
msg[i] = 0;
for (j = 0; ;i++, j++)
{
msg[i] = text[j];
if (0 == msg[i])
break;
}
i++;
msg[i] = 0;
switch (type)
{
case MB_OK:
for (j = 0; ;i++, j++)
{
msg[i] = BTN_OK[j];
if (0 == msg[i])
break;
}
break;
case MB_OKCANCEL:
for (j = 0; ;i++, j++)
{
msg[i] = BTN_OK[j];
if (0 == msg[i])
break;
}
i++;
msg[i] = 0;
for (j = 0; ;i++, j++)
{
msg[i] = BTN_CANCEL[j];
if (0 == msg[i])
break;
}
break;
default:
break;
}
i++;
msg[i] = 0;
mb_create(msg, thread+1024);
for (;;)
{
if ( (unsigned char) msg[0] != 255 )
switch (type)
{
case MB_OK:
if (msg[0] == 1)
return IDOK;
else
return 0;
break;
case MB_OKCANCEL:
switch(msg[0])
{
case 1:
return IDOK;
case 2:
return IDCANCEL;
default:
return 0;
};
break;
default:
return 0;
};
kol_sleep(10);
}
}
///=============================