Subversion Repositories Kolibri OS

Rev

Rev 1814 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1814 Rev 1854
1
///=============================
1
///=============================
2
 
2
 
3
#define MB_OK 0
3
#define MB_OK 0
4
#define MB_OKCANCEL 1
4
#define MB_OKCANCEL 1
5
#define MB_ABORTRETRYIGNORE 2 
5
#define MB_ABORTRETRYIGNORE 2 
6
#define MB_YESNOCANCEL 3
6
#define MB_YESNOCANCEL 3
7
#define MB_YESNO 4
7
#define MB_YESNO 4
8
#define MB_RETRYCANCEL 5
8
#define MB_RETRYCANCEL 5
9
 
9
 
10
#define IDOK 1
10
#define IDOK 1
11
#define IDCANCEL 2
11
#define IDCANCEL 2
12
#define IDABORT 3
12
#define IDABORT 3
13
#define IDRETRY 4
13
#define IDRETRY 4
14
#define IDIGNORE 5
14
#define IDIGNORE 5
15
#define IDYES 6
15
#define IDYES 6
16
#define IDNO 7
16
#define IDNO 7
17
 
17
 
18
///=============================
18
///=============================
19
 
19
 
20
#define LANG_EN
-
 
21
 
-
 
22
#ifdef LANG_RU
20
#if LANG_RUS
23
char BTN_OK[]={"OK"};
21
char BTN_OK[]={"OK"};
24
char BTN_CANCEL[]={"Žâ¬¥­ "};
22
char BTN_CANCEL[]={"Žâ¬¥­ "};
25
char BTN_ABORT[]={"à¥ªà â¨âì"};
23
char BTN_ABORT[]={"à¥ªà â¨âì"};
26
char BTN_RETRY[]={"®¢â®à¨âì"};
24
char BTN_RETRY[]={"®¢â®à¨âì"};
27
char BTN_INGNORE[]={"ˆ£­®à¨à®¢ âì"};
25
char BTN_INGNORE[]={"ˆ£­®à¨à®¢ âì"};
28
char BTN_NO[]={"¥â"};
26
char BTN_NO[]={"¥â"};
29
#endif
27
#else
30
 
28
char BTN_OK[]={"OK"};
31
#ifdef LANG_EN
-
 
32
char BTN_OK[]={"OK"};
-
 
33
char BTN_CANCEL[]={"Cancel"};
29
char BTN_CANCEL[]={"Cancel"};
34
char BTN_ABORT[]={"Abort"};
30
char BTN_ABORT[]={"Abort"};
35
char BTN_RETRY[]={"Retry"};
31
char BTN_RETRY[]={"Retry"};
36
char BTN_INGNORE[]={"Ignore"};
32
char BTN_INGNORE[]={"Ignore"};
37
char BTN_NO[]={"No"};
33
char BTN_NO[]={"No"};
38
#endif
34
#endif
39
 
35
 
40
///=============================
36
///=============================
41
 
37
 
42
kol_struct_import *MSG_BOX_IMPORT = NULL;
38
kol_struct_import *MSG_BOX_IMPORT = NULL;
43
int (* _stdcall mb_create)(char *m, char* t);
39
int (* _stdcall mb_create)(char *m, char* t);
44
 
40
 
45
char msg[1024];
41
char msg[1024];
46
char thread[1024];
42
char thread[1024];
47
 
43
 
48
 
44
 
49
///=============================
45
///=============================
50
 
46
 
51
char MessageBox(char *text, char *caption, int type)
47
char MessageBox(char *text, char *caption, int type)
52
{
48
{
53
 
49
 
54
int i, j;
50
int i, j;
55
 
51
 
56
if (MSG_BOX_IMPORT == NULL)
52
if (MSG_BOX_IMPORT == NULL)
57
	{
53
	{
58
	MSG_BOX_IMPORT = kol_cofflib_load("/sys/lib/Msgbox.obj");
54
	MSG_BOX_IMPORT = kol_cofflib_load("/sys/lib/Msgbox.obj");
59
	if (MSG_BOX_IMPORT == NULL)
55
	if (MSG_BOX_IMPORT == NULL)
60
		kol_exit();
56
		kol_exit();
61
 
57
 
62
	mb_create = kol_cofflib_procload (MSG_BOX_IMPORT, "mb_create");
58
	mb_create = kol_cofflib_procload (MSG_BOX_IMPORT, "mb_create");
63
		if (mb_create == NULL)
59
		if (mb_create == NULL)
64
			kol_exit();
60
			kol_exit();
65
 
61
 
66
	}
62
	}
67
 
63
 
68
msg[0] = 255;
64
msg[0] = 255;
69
msg[1] = 0;
65
msg[1] = 0;
70
 
66
 
71
for (i = 2, j = 0; ;i++, j++)
67
for (i = 2, j = 0; ;i++, j++)
72
	{
68
	{
73
	msg[i] = caption[j];
69
	msg[i] = caption[j];
74
	if (0 == msg[i])
70
	if (0 == msg[i])
75
		break;
71
		break;
76
	}
72
	}
77
 
73
 
78
i++;
74
i++;
79
msg[i] = 0;
75
msg[i] = 0;
80
 
76
 
81
for (j = 0; ;i++, j++)
77
for (j = 0; ;i++, j++)
82
	{
78
	{
83
	msg[i] = text[j];
79
	msg[i] = text[j];
84
	if (0 == msg[i])
80
	if (0 == msg[i])
85
		break;
81
		break;
86
	}
82
	}
87
 
83
 
88
i++;
84
i++;
89
msg[i] = 0;
85
msg[i] = 0;
90
 
86
 
91
switch (type)
87
switch (type)
92
	{
88
	{
93
	case MB_OK:
89
	case MB_OK:
94
		for (j = 0; ;i++, j++)
90
		for (j = 0; ;i++, j++)
95
			{
91
			{
96
			msg[i] = BTN_OK[j];
92
			msg[i] = BTN_OK[j];
97
			if (0 == msg[i])
93
			if (0 == msg[i])
98
				break;
94
				break;
99
			}
95
			}
100
		break;
96
		break;
101
 
97
 
102
	case MB_OKCANCEL:
98
	case MB_OKCANCEL:
103
		for (j = 0; ;i++, j++)
99
		for (j = 0; ;i++, j++)
104
			{
100
			{
105
			msg[i] = BTN_OK[j];
101
			msg[i] = BTN_OK[j];
106
			if (0 == msg[i])
102
			if (0 == msg[i])
107
				break;
103
				break;
108
			}
104
			}
109
 
105
 
110
		i++;
106
		i++;
111
		msg[i] = 0;
107
		msg[i] = 0;
112
 
108
 
113
		for (j = 0; ;i++, j++)
109
		for (j = 0; ;i++, j++)
114
			{
110
			{
115
			msg[i] = BTN_CANCEL[j];
111
			msg[i] = BTN_CANCEL[j];
116
			if (0 == msg[i])
112
			if (0 == msg[i])
117
				break;
113
				break;
118
			}
114
			}
119
		break;
115
		break;
120
 
116
 
121
	default:
117
	default:
122
		break;
118
		break;
123
 
119
 
124
	}
120
	}
125
i++;
121
i++;
126
msg[i] = 0;
122
msg[i] = 0;
127
 
123
 
128
mb_create(msg, thread+1024);
124
mb_create(msg, thread+1024);
129
 
125
 
130
for (;;)
126
for (;;)
131
	{
127
	{
132
	if ( (unsigned char) msg[0] != 255 )
128
	if ( (unsigned char) msg[0] != 255 )
133
		switch (type)
129
		switch (type)
134
			{
130
			{
135
			case MB_OK:
131
			case MB_OK:
136
				if (msg[0] == 1)
132
				if (msg[0] == 1)
137
					return IDOK;
133
					return IDOK;
138
				else
134
				else
139
					return 0;
135
					return 0;
140
				break;
136
				break;
141
 
137
 
142
			case MB_OKCANCEL:
138
			case MB_OKCANCEL:
143
				switch(msg[0])
139
				switch(msg[0])
144
					{
140
					{
145
					case 1:
141
					case 1:
146
						return IDOK;
142
						return IDOK;
147
					case 2:
143
					case 2:
148
						return IDCANCEL;
144
						return IDCANCEL;
149
					default:
145
					default:
150
						return 0;
146
						return 0;
151
					};
147
					};
152
				break;
148
				break;
153
 
149
 
154
			default:
150
			default:
155
				return 0;
151
				return 0;
156
 
152
 
157
			};
153
			};
158
 
154
 
159
	kol_sleep(10);
155
	kol_sleep(10);
160
	}
156
	}
161
 
157
 
162
 
158
 
163
}
159
}
164
 
160
 
165
///=============================
161
///=============================