Subversion Repositories Kolibri OS

Rev

Rev 5674 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5738 leency 1
#ifndef AUTOBUILD
2
#include "lang.h--"
3
#endif
3363 leency 4
 
5738 leency 5
#define MEMSIZE 4096*4
6
#include "../lib/gui.h"
7
#include "../lib/file_system.h"
8
 
9
#ifdef LANG_RUS
10
#define TEXT_TITLE "Завершение работы"
11
#define TEXT_RDSAVE1 "Нажмите Ctrl+S для сохранения изменений"
12
#define TEXT_RDSAVE2 "сделанных в процессе работы в системе."
13
#define TEXT_REBOOT "Перезагрузка"
14
#define TEXT_OFF "Выключение"
15
#define TEXT_CANCEL "Отмена"
3363 leency 16
#else
5738 leency 17
#define TEXT_TITLE "Shutdown computer"
18
#define TEXT_RDSAVE1 "Press Ctrl+S to save all changes"
19
#define TEXT_RDSAVE2 "that were done during system work."
20
#define TEXT_REBOOT "Reboot"
21
#define TEXT_OFF "Power off"
22
#define TEXT_CANCEL "Close"
3363 leency 23
#endif
24
 
5738 leency 25
#define WIN_W 440
26
#define WIN_H 200
27
#define BOT_PANEL_H 70
3363 leency 28
 
5738 leency 29
void main()
3363 leency 30
{
31
	int key;
5738 leency 32
	int WIN_X = GetScreenWidth() - WIN_W / 2;
33
	int WIN_Y = GetScreenHeight() - WIN_H / 2;
3363 leency 34
 
35
	loop()
5738 leency 36
	{
37
	  switch(WaitEvent())
38
	  {
39
		 case evButton:
3363 leency 40
			key=GetButtonID();
41
			if (key==1) ExitProcess();
42
			GOTO _BUTTON_MARK;
5738 leency 43
 
3363 leency 44
		case evKey:
45
			key = GetKey();
46
			_BUTTON_MARK:
5738 leency 47
			if (key==ASCII_KEY_ENTER) ExitSystem(REBOOT);
48
			if (key==ASCII_KEY_END) ExitSystem(TURN_OFF);
49
			if (key==ASCII_KEY_ESC) ExitProcess();
50
			if (key==19) RunProgram("rdsave",0);
3363 leency 51
			break;
5738 leency 52
 
53
		 case evReDraw:
54
			DefineAndDrawWindow(WIN_X, WIN_Y, WIN_W-1, WIN_H-1, 0x41, 0, 0, 0);
55
			DrawWideRectangle(0, 0, WIN_W, WIN_H, 2, 0xA3A7AA);
56
			DrawBar(2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020);
57
			DrawBar(2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B);
58
			WriteText(30, 27, 10110001b, 0xFFFfff, TEXT_TITLE);
59
			WriteText(30, 70, 10110000b, 0xFFFfff, TEXT_RDSAVE1);
60
			WriteText(30, 85, 10110000b, 0xFFFfff, TEXT_RDSAVE2);
61
			EndButton( 20, 0x4E91C5, ASCII_KEY_ESC, TEXT_CANCEL, "Esc");
62
			EndButton(160, 0x55C891, ASCII_KEY_ENTER, TEXT_REBOOT, "Enter");
63
			EndButton(300, 0xC75C54, ASCII_KEY_END, TEXT_OFF, "End");
3363 leency 64
			break;
5738 leency 65
	  }
3363 leency 66
   }
67
}
68
 
5738 leency 69
void EndButton(dword x, bgcol, id, but_text, hotkey_text)
3363 leency 70
{
5738 leency 71
	word buty=WIN_H-60;
72
	word butw=116;
73
	word buth=43;
74
	DrawWideRectangle(x-3, buty-3, butw+6, buth+6, 3, 0x202020);
75
	DefineButton(x, buty, butw-1, buth-1, id, bgcol);
76
	WriteTextB(-utf8_strlen(but_text)*8 + butw / 2 + x, buty+8, 10110000b, 0xFFFfff, but_text);
77
	WriteTextCenter(x, buty+26, butw, 0xFFFfff, hotkey_text);
78
}