Rev 8283 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8283 | IgorA | 1 | #include |
2 | #include |
||
3 | #include |
||
4 | #include |
||
5 | #include |
||
6 | |||
7 | using namespace Kolibri; |
||
8 | |||
9 | const char header[] = "Color Dialog"; |
||
10 | char library_path[2048]; |
||
11 | long color1,color2,color3; |
||
12 | |||
13 | ColorDialog_data cold; |
||
14 | unsigned char procinfo[1024]; |
||
15 | |||
16 | namespace Kolibri{ |
||
17 | char CurrentDirectoryPath[2048]; |
||
18 | } |
||
19 | |||
20 | void KolibriOnPaint(void); |
||
21 | |||
22 | void __stdcall DrawWindow() |
||
23 | { |
||
24 | asm{ |
||
25 | push ebx |
||
26 | mcall SF_REDRAW,SSF_BEGIN_DRAW |
||
27 | } |
||
28 | KolibriOnPaint(); |
||
29 | asm{ |
||
30 | mcall SF_REDRAW,SSF_END_DRAW |
||
31 | pop ebx |
||
32 | } |
||
33 | } |
||
34 | |||
35 | bool KolibriOnStart(TStartData &kos_start, TThreadData /*th*/) |
||
36 | { |
||
37 | kos_start.Left = 10; |
||
38 | kos_start.Top = 40; |
||
39 | kos_start.Width = 420; |
||
40 | kos_start.Height = 320; |
||
41 | kos_start.WinData.WindowColor = 0xFFFFFF; |
||
42 | kos_start.WinData.WindowType = 0x33; // 0x34 - fixed, 0x33 - not fixed |
||
43 | kos_start.WinData.Title = header; |
||
44 | if(LoadLibrary("proc_lib.obj", library_path, "/sys/lib/proc_lib.obj", &import_proc_lib)) |
||
45 | { |
||
46 | cold.type = 0; |
||
47 | cold.procinfo = procinfo; |
||
48 | cold.com_area_name = "FFFFFFFF_color_dialog"; |
||
49 | cold.com_area = 0; |
||
9585 | vitalkrilo | 50 | cold.start_path = "/sys/colrdial"; |
8283 | IgorA | 51 | cold.draw_window = DrawWindow; |
52 | cold.status = 0; |
||
53 | cold.x_size = 420; |
||
54 | cold.x_start = 10; |
||
55 | cold.y_size = 320; |
||
56 | cold.y_start = 10; |
||
57 | ColorDialog_Init(&cold); |
||
58 | } else return false; |
||
59 | color1=color2=color3=0xffffff; |
||
60 | return true; |
||
61 | } |
||
62 | |||
63 | void KolibriOnPaint(void) |
||
64 | { |
||
65 | // If button have ID 1, this is close button |
||
66 | DrawButton(2,0xf0f0f0, 10,10,60,20); |
||
67 | DrawText(20,16,0,"Color 1"); |
||
68 | DrawButton(3,0xf0f0f0, 80,10,60,20); |
||
69 | DrawText(90,16,0,"Color 2"); |
||
70 | DrawButton(4,0xf0f0f0, 150,10,60,20); |
||
71 | DrawText(160,16,0,"Color 3"); |
||
72 | |||
73 | DrawRect( 10,40,61,100,color1); |
||
74 | DrawRect( 80,40,61,100,color2); |
||
75 | DrawRect(150,40,61,100,color3); |
||
76 | } |
||
77 | |||
78 | void KolibriOnButton(long id, TThreadData /*th*/) |
||
79 | { |
||
80 | switch(id){ |
||
81 | case 2: |
||
82 | ColorDialog_Start(&cold); |
||
83 | if(cold.status==1){ color1 = cold.color; } |
||
84 | break; |
||
85 | case 3: |
||
86 | ColorDialog_Start(&cold); |
||
87 | if(cold.status==1){ color2 = cold.color; } |
||
88 | break; |
||
89 | case 4: |
||
90 | ColorDialog_Start(&cold); |
||
91 | if(cold.status==1){ color3 = cold.color; } |
||
92 | //break; |
||
93 | }; |
||
94 | } |