blob: 08f52c1f9aeaf7da44017d6ae2535964a8c0fb38 [file] [log] [blame]
PulkoMandyc53d0f62014-07-01 22:35:10 +02001/*
2 * Copyright (c) 2002, Adam Dunkels.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials provided
13 * with the distribution.
14 * 3. The name of the author may not be used to endorse or promote
15 * products derived from this software without specific prior
16 * written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * This file is part of the "ctk" console GUI toolkit for cc65
31 *
32 * $Id: ctk-conio-service.c,v 1.12 2006/05/28 20:38:19 oliverschmidt Exp $
33 *
34 */
35
36#include <conio.h>
37
38#include "ctk.h"
39#include "ctk-draw.h"
40
41#include "ctk-draw-service.h"
42
43#include "ctk-conio-conf.h"
44#include <string.h>
45
46#ifndef NULL
47#define NULL (void *)0
48#endif /* NULL */
49
50static unsigned char sizex, sizey;
51
52/*unsigned char ctk_draw_windowborder_height = 1;
53unsigned char ctk_draw_windowborder_width = 1;
54unsigned char ctk_draw_windowtitle_height = 1;*/
55
56// The revers function does nothing in our conio driver anyway.
57#define revers(x)
58
PulkoMandyc0f22c72023-05-04 23:02:20 +020059#if 0
60static void revers(bool invert)
61{
62 static bool isInverted;
63 if (isInverted == invert)
64 return;
65
66 __asm
67 call 0xBB9C
68 __endasm
69}
70#endif
71
PulkoMandyc53d0f62014-07-01 22:35:10 +020072/*-----------------------------------------------------------------------------------*/
73static void
PulkoMandyc53d0f62014-07-01 22:35:10 +020074s_ctk_draw_init(void)
75{
76 (void)bgcolor(SCREENCOLOR);
77 (void)bordercolor(BORDERCOLOR);
PulkoMandy25ff0502014-07-03 09:55:24 +020078 clrscr();
PulkoMandyc53d0f62014-07-01 22:35:10 +020079 screensize(&sizex, &sizey);
PulkoMandyc53d0f62014-07-01 22:35:10 +020080}
81/*-----------------------------------------------------------------------------------*/
PulkoMandydf52c592014-07-03 15:36:50 +020082
83
PulkoMandy3783e422023-05-02 17:40:17 +020084static void customchr(const unsigned char* data) __naked __preserves_regs(c, d, e)
PulkoMandydf52c592014-07-03 15:36:50 +020085{
86 __asm
Adrien Destugues69a6e722017-06-03 10:17:17 +020087 ; Cant use SCR SET MATRIX because some of our icons are in RAM under 0x4000.
PulkoMandy0627a362014-07-03 18:55:34 +020088 ; SCR SET MATRIX then gets data from the firmware ROM...
89 ld a,#0x19
90 call 0xBB5a
PulkoMandydf52c592014-07-03 15:36:50 +020091 ld a,#0xff
PulkoMandy0627a362014-07-03 18:55:34 +020092 call 0xBB5a
93 ld b,#8
9400001$:
95 ld a,(hl)
96 call 0xbb5a
97 inc hl
98 djnz 00001$
99 ret
PulkoMandydf52c592014-07-03 15:36:50 +0200100 __endasm;
101}
102
103
PulkoMandyc53d0f62014-07-01 22:35:10 +0200104static void
105draw_widget(struct ctk_widget *w,
106 unsigned char x, unsigned char y,
107 unsigned char clipx,
108 unsigned char clipy,
109 unsigned char clipy1, unsigned char clipy2,
110 unsigned char focus)
111{
112 unsigned char xpos, ypos, xscroll;
113 unsigned char i, j;
Adrien Destugues69a6e722017-06-03 10:17:17 +0200114 char c;
115 const char* text;
PulkoMandyc53d0f62014-07-01 22:35:10 +0200116 unsigned char len, wfocus;
117
118 wfocus = 0;
119 if(focus & CTK_FOCUS_WINDOW) {
120 (void)textcolor(WIDGETCOLOR_FWIN);
121 if(focus & CTK_FOCUS_WIDGET) {
122 (void)textcolor(WIDGETCOLOR_FOCUS);
123 wfocus = 1;
124 }
125 } else if(focus & CTK_FOCUS_DIALOG) {
126 (void)textcolor(WIDGETCOLOR_DIALOG);
127 if(focus & CTK_FOCUS_WIDGET) {
128 (void)textcolor(WIDGETCOLOR_FOCUS);
129 wfocus = 1;
130 }
131 } else {
132 (void)textcolor(WIDGETCOLOR);
133 }
134
135 xpos = x + w->x;
136 ypos = y + w->y;
137
138 switch(w->type) {
139 case CTK_WIDGET_SEPARATOR:
140 if(ypos >= clipy1 && ypos < clipy2) {
141 chlinexy(xpos, ypos, w->w);
142 }
143 break;
144 case CTK_WIDGET_LABEL:
145 text = w->widget.label.text;
146 for(i = 0; i < w->h; ++i) {
147 if(ypos >= clipy1 && ypos < clipy2) {
148 gotoxy(xpos, ypos);
149 cputsn(text, w->w);
150 if(w->w - (wherex() - xpos) > 0) {
151 cclear(w->w - (wherex() - xpos));
152 }
153 }
154 ++ypos;
155 text += w->w;
156 }
157 break;
158 case CTK_WIDGET_BUTTON:
159 if(ypos >= clipy1 && ypos < clipy2) {
160 revers(wfocus != 0);
161 cputcxy(xpos, ypos, '[');
162 cputsn(w->widget.button.text, w->w);
163 cputc(']');
164 revers(0);
165 }
166 break;
167 case CTK_WIDGET_HYPERLINK:
168 if(ypos >= clipy1 && ypos < clipy2) {
169 (void)textcolor(WIDGETCOLOR_HLINK);
170 revers(wfocus == 0);
171 gotoxy(xpos, ypos);
172 cputsn(w->widget.button.text, w->w);
173 revers(0);
174 }
175 break;
176 case CTK_WIDGET_TEXTENTRY:
177 text = w->widget.textentry.text;
178 xscroll = 0;
179 if(w->widget.textentry.xpos >= w->w - 1) {
180 xscroll = w->widget.textentry.xpos - w->w + 1;
181 }
182 for(j = 0; j < w->h; ++j) {
183 if(ypos >= clipy1 && ypos < clipy2) {
184 if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT &&
185 w->widget.textentry.ypos == j) {
186 revers(0);
187 cputcxy(xpos, ypos, '>');
188 c = 1;
189 for(i = 0; i < w->w; ++i) {
190 if(c != 0) {
191 c = text[i + xscroll];
192 }
193 revers(i == w->widget.textentry.xpos - xscroll);
194 if(c == 0) {
195 cputc(' ');
196 } else {
197 cputc(c);
198 }
199 }
200 revers(0);
201 cputc('<');
202 } else {
203 revers(wfocus != 0 && j == w->widget.textentry.ypos);
204 cvlinexy(xpos, ypos, 1);
PulkoMandyc0f22c72023-05-04 23:02:20 +0200205 gotoxy(xpos + 1, ypos);
PulkoMandyc53d0f62014-07-01 22:35:10 +0200206 cputsn(text, w->w);
207 i = wherex();
208 if(i - xpos - 1 < w->w) {
209 cclear(w->w - (i - xpos) + 1);
210 }
211 cvline(1);
212 }
213 }
214 ++ypos;
215 text += w->widget.textentry.len + 1;
216 }
217 revers(0);
218 break;
219 case CTK_WIDGET_ICON:
PulkoMandydf52c592014-07-03 15:36:50 +0200220
PulkoMandyc53d0f62014-07-01 22:35:10 +0200221 if(ypos >= clipy1 && ypos < clipy2) {
222 revers(wfocus != 0);
PulkoMandydf52c592014-07-03 15:36:50 +0200223#if CTK_CONF_ICON_BITMAPS
224 gotoxy(xpos, ypos);
225 if(w->widget.icon.bitmap != NULL) {
Adrien Destugues69a6e722017-06-03 10:17:17 +0200226 const unsigned char* ptr = w->widget.icon.bitmap;
PulkoMandydf52c592014-07-03 15:36:50 +0200227 for(i = 0; i < 3; ++i) {
228 gotoxy(xpos, ypos);
PulkoMandy3783e422023-05-02 17:40:17 +0200229 //gotox(xpos); gotoy(ypos);
PulkoMandydf52c592014-07-03 15:36:50 +0200230 if(ypos >= clipy1 && ypos < clipy2) {
231 customchr(ptr);
232 cputc(0xff);
233 ptr += 8;
234 customchr(ptr);
235 cputc(0xff);
236 ptr += 8;
237 customchr(ptr);
238 cputc(0xff);
239 ptr += 8;
240 }
241 ++ypos;
242 }
243 }
244#elif CTK_CONF_ICON_TEXTMAPS
PulkoMandyc53d0f62014-07-01 22:35:10 +0200245 gotoxy(xpos, ypos);
246 if(w->widget.icon.textmap != NULL) {
247 for(i = 0; i < 3; ++i) {
248 gotoxy(xpos, ypos);
249 if(ypos >= clipy1 && ypos < clipy2) {
250 cputc(w->widget.icon.textmap[0 + 3 * i]);
251 cputc(w->widget.icon.textmap[1 + 3 * i]);
252 cputc(w->widget.icon.textmap[2 + 3 * i]);
253 }
254 ++ypos;
255 }
256 }
PulkoMandydf52c592014-07-03 15:36:50 +0200257#endif
PulkoMandyc53d0f62014-07-01 22:35:10 +0200258 x = xpos;
259
260 len = strlen(w->widget.icon.title);
261 if(x + len >= sizex) {
262 x = sizex - len;
263 }
264
265 gotoxy(x, ypos);
266 if(ypos >= clipy1 && ypos < clipy2) {
267 cputs(w->widget.icon.title);
268 }
269 revers(0);
270 }
271 break;
272
273 default:
274 break;
275 }
276}
277/*-----------------------------------------------------------------------------------*/
278static void
279s_ctk_draw_widget(struct ctk_widget *w,
280 unsigned char focus,
281 unsigned char clipy1,
282 unsigned char clipy2)
283{
284 struct ctk_window *win = w->window;
285 unsigned char posx, posy;
286
287 posx = win->x + 1;
288 posy = win->y + 2;
289
290 if(w == win->focused) {
291 focus |= CTK_FOCUS_WIDGET;
292 }
293
294 draw_widget(w, posx, posy,
295 posx + win->w,
296 posy + win->h,
297 clipy1, clipy2,
298 focus);
299
300#ifdef CTK_CONIO_CONF_UPDATE
301 CTK_CONIO_CONF_UPDATE();
302#endif /* CTK_CONIO_CONF_UPDATE */
303}
304/*-----------------------------------------------------------------------------------*/
305
Adrien Destugues9333c982016-01-23 18:38:47 +0100306static void clearrect(unsigned char y2, unsigned char x2,
PulkoMandy3783e422023-05-02 17:40:17 +0200307 unsigned char y1, unsigned char x1) __naked __z88dk_callee
PulkoMandyc53d0f62014-07-01 22:35:10 +0200308{
PulkoMandy3783e422023-05-02 17:40:17 +0200309 // Y2 is in A
310 // X2 is in L
311 // Stack has:
312 // - Return value
313 // - Y1
314 // - X1
PulkoMandyc53d0f62014-07-01 22:35:10 +0200315 __asm
PulkoMandyc0f22c72023-05-04 23:02:20 +0200316 LD d,l
317 LD e,A
318
Adrien Destugues9333c982016-01-23 18:38:47 +0100319 pop bc ; RV
Adrien Destugues9333c982016-01-23 18:38:47 +0100320 pop hl ; x1 y1
Adrien Destugues9333c982016-01-23 18:38:47 +0100321 push bc
PulkoMandyc53d0f62014-07-01 22:35:10 +0200322
323 call 0xBB99 ; TXT GET PAPER
PulkoMandy3783e422023-05-02 17:40:17 +0200324
325 ; A contains PAPER number
326
PulkoMandyc53d0f62014-07-01 22:35:10 +0200327 call 0xBC2C ; SCR INK ENCODE
328
PulkoMandy3783e422023-05-02 17:40:17 +0200329 ; A contains encoded PEN
330
331 ; Here we need:
332 ; H = X1
333 ; L = Y1
334 ; D = X2
335 ; E = Y2
336 ; A = encoded pen
337
PulkoMandyc53d0f62014-07-01 22:35:10 +0200338 jp 0xBC44 ; SCR FILL BOX
339 __endasm;
340}
341
342static void
343s_ctk_draw_clear_window(struct ctk_window *window,
344 unsigned char focus,
345 unsigned char clipy1,
346 unsigned char clipy2)
347{
348 unsigned char i;
349 unsigned char h;
350
351 /*
352 if(focus & CTK_FOCUS_WINDOW) {
353 (void)textcolor(WINDOWCOLOR_FOCUS);
354 } else {
355 (void)textcolor(WINDOWCOLOR);
356 }
357 */
358
PulkoMandy25ff0502014-07-03 09:55:24 +0200359 i = window->y + 2; // +1 for the border, +1 for ctk > cpc conversion
360 h = i + window->h;
PulkoMandyc53d0f62014-07-01 22:35:10 +0200361
PulkoMandy0627a362014-07-03 18:55:34 +0200362 if (i >= clipy2 || h < clipy1)
363 return;
364
PulkoMandy25ff0502014-07-03 09:55:24 +0200365 if (i < clipy1) i = clipy1;
Adrien Destugues9333c982016-01-23 18:38:47 +0100366 if (h >= clipy2) h = clipy2 - 1;
PulkoMandy25ff0502014-07-03 09:55:24 +0200367
Adrien Destugues9333c982016-01-23 18:38:47 +0100368 clearrect(h, window->x + window->w, i, window->x + 1);
PulkoMandyc53d0f62014-07-01 22:35:10 +0200369}
370/*-----------------------------------------------------------------------------------*/
371static void
372draw_window_contents(struct ctk_window *window, unsigned char focus,
373 unsigned char clipy1, unsigned char clipy2,
374 unsigned char x1, unsigned char x2,
375 unsigned char y1, unsigned char y2)
376{
377 struct ctk_widget *w;
378 unsigned char wfocus;
379
380 /* Draw inactive widgets. */
381 for(w = window->inactive; w != NULL; w = w->next) {
382 draw_widget(w, x1, y1, x2, y2,
383 clipy1, clipy2,
384 focus);
385 }
386
387 /* Draw active widgets. */
388 for(w = window->active; w != NULL; w = w->next) {
389 wfocus = focus;
390 if(w == window->focused) {
391 wfocus |= CTK_FOCUS_WIDGET;
392 }
393
394 draw_widget(w, x1, y1, x2, y2,
395 clipy1, clipy2,
396 wfocus);
397 }
398
399#ifdef CTK_CONIO_CONF_UPDATE
400 CTK_CONIO_CONF_UPDATE();
401#endif /* CTK_CONIO_CONF_UPDATE */
402}
403/*-----------------------------------------------------------------------------------*/
404static void
405s_ctk_draw_window(struct ctk_window *window, unsigned char focus,
406 unsigned char clipy1, unsigned char clipy2,
407 unsigned char draw_borders)
408{
409 unsigned char x, y;
410 unsigned char h;
411 unsigned char x1, y1, x2, y2;
412
413 if(window->y + 1 >= clipy2) {
414 return;
415 }
416
417 x = window->x;
418 y = window->y + 1;
419 x1 = x + 1;
420 y1 = y + 1;
421 x2 = x1 + window->w;
422 y2 = y1 + window->h;
423
424 if(draw_borders) {
425
426 /* Draw window frame. */
427 if(focus & CTK_FOCUS_WINDOW) {
428 (void)textcolor(WINDOWCOLOR_FOCUS);
429 } else {
430 (void)textcolor(WINDOWCOLOR);
431 }
432
433 if(y >= clipy1) {
434 cputcxy(x, y, CH_ULCORNER);
435 gotoxy(wherex() + window->titlelen + CTK_CONF_WINDOWMOVE * 2, wherey());
436 chline(window->w - (wherex() - x) - 2);
437 cputcxy(x2, y, CH_URCORNER);
438 }
439
440 h = window->h;
441
442 if(clipy1 > y1) {
443 if(clipy1 - y1 < h) {
444 h = clipy1 - y1;
445 y1 = clipy1;
446 } else {
447 h = 0;
448 }
449 }
450
451 if(clipy2 < y1 + h) {
452 if(y1 >= clipy2) {
453 h = 0;
454 } else {
455 h = clipy2 - y1;
456 }
457 }
458
459 cvlinexy(x, y1, h);
460 cvlinexy(x2, y1, h);
461
462 if(y + window->h >= clipy1 &&
463 y + window->h < clipy2) {
464 cputcxy(x, y2, CH_LLCORNER);
465 chlinexy(x1, y2, window->w);
466 cputcxy(x2, y2, CH_LRCORNER);
467 }
468 }
469
470 draw_window_contents(window, focus, clipy1, clipy2,
471 x1, x2, y + 1, y2);
472}
473/*-----------------------------------------------------------------------------------*/
474static void
475s_ctk_draw_dialog(struct ctk_window *dialog)
476{
477 unsigned char x, y;
PulkoMandyc53d0f62014-07-01 22:35:10 +0200478 unsigned char x1, y1, x2, y2;
479
480 (void)textcolor(DIALOGCOLOR);
481
482 x = dialog->x;
483 y = dialog->y + 1;
484
485 x1 = x + 1;
486 y1 = y + 1;
487 x2 = x1 + dialog->w;
488 y2 = y1 + dialog->h;
489
490 /* Draw dialog frame. */
491 cvlinexy(x, y1,
492 dialog->h);
493 cvlinexy(x2, y1,
494 dialog->h);
495
496 chlinexy(x1, y,
497 dialog->w);
498 chlinexy(x1, y2,
499 dialog->w);
500
501 cputcxy(x, y, CH_ULCORNER);
502 cputcxy(x, y2, CH_LLCORNER);
503 cputcxy(x2, y, CH_URCORNER);
504 cputcxy(x2, y2, CH_LRCORNER);
505
506 /* Clear dialog contents. */
Adrien Destugues715554f2016-01-23 19:48:57 +0100507 clearrect(y2 - 1, x1 + dialog->w - 1, y1, x1);
PulkoMandyc53d0f62014-07-01 22:35:10 +0200508
509 draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, sizey,
510 x1, x2, y1, y2);
511}
512/*-----------------------------------------------------------------------------------*/
513static void
514s_ctk_draw_clear(unsigned char y1, unsigned char y2) __naked
515{
516 __asm
Adrien Destugues715554f2016-01-23 19:48:57 +0100517 pop de
518 pop hl
519 push hl
520 push de
PulkoMandyc53d0f62014-07-01 22:35:10 +0200521
522 push af
523
Adrien Destugues715554f2016-01-23 19:48:57 +0100524 ld e,h
PulkoMandyc53d0f62014-07-01 22:35:10 +0200525 ld h,#1
PulkoMandyc53d0f62014-07-01 22:35:10 +0200526 ld d,#40
527
PulkoMandy0627a362014-07-03 18:55:34 +0200528 dec e
PulkoMandyc53d0f62014-07-01 22:35:10 +0200529
530 call 0xBB99 ; TXT GET PAPER
531 call 0xBC2C ; SCR INK ENCODE
532
533 call 0xBC44 ; SCR FILL BOX
534
535 pop af
536 ret
537 __endasm;
538}
539/*-----------------------------------------------------------------------------------*/
540static void
541draw_menu(struct ctk_menu *m, unsigned char open)
542{
543 unsigned char x, x2, y;
544
545 if(open) {
546 x = x2 = wherex();
547 if(x2 + CTK_CONF_MENUWIDTH > sizex) {
548 x2 = sizex - CTK_CONF_MENUWIDTH;
549 }
550
551 for(y = 0; y < m->nitems; ++y) {
552 if(y == m->active) {
553 (void)textcolor(ACTIVEMENUITEMCOLOR);
554 } else {
555 (void)textcolor(SCREENCOLOR);
556 }
557 gotoxy(x2, y + 1);
558 if(m->items[y].title[0] == '-') {
559 chline(CTK_CONF_MENUWIDTH);
560 } else {
561 cputs(m->items[y].title);
562 }
563 if(x2 + CTK_CONF_MENUWIDTH > wherex()) {
564 cclear(x2 + CTK_CONF_MENUWIDTH - wherex());
565 }
566 }
567
568 gotoxy(x, 0);
569 (void)textcolor(OPENMENUCOLOR);
570 }
571
572 cputs(m->title);
573 cputc(' ');
574}
575/*-----------------------------------------------------------------------------------*/
576static void
577s_ctk_draw_menus(struct ctk_menus *menus)
578{
579 struct ctk_menu *m;
580
581 /* Draw menus */
582 (void)bgcolor(MENUCOLOR);
583 (void)textcolor(SCREENCOLOR);
584 gotoxy(0, 0);
585 cputc(' ');
586 for(m = menus->menus->next; m != NULL; m = m->next) {
587 draw_menu(m, m == menus->open);
588 }
589
590 /* Draw desktopmenu */
591 if(wherex() + strlen(menus->desktopmenu->title) + 1 >= sizex) {
592 gotoxy(sizex - strlen(menus->desktopmenu->title) - 1, 0);
593 } else {
594 cclear(sizex - wherex() -
595 strlen(menus->desktopmenu->title) - 1);
596 }
597 draw_menu(menus->desktopmenu, menus->desktopmenu == menus->open);
598
599 (void)bgcolor(SCREENCOLOR);
600}
601/*-----------------------------------------------------------------------------------*/
602static unsigned char
603s_ctk_draw_height(void)
604{
605 return sizey;
606}
607/*-----------------------------------------------------------------------------------*/
608static unsigned char
609s_ctk_draw_width(void)
610{
611 return sizex;
612}
613/*-----------------------------------------------------------------------------------*/
614static unsigned short
615s_ctk_mouse_xtoc(unsigned short x)
616{
617 return x / 8;
618}
619/*-----------------------------------------------------------------------------------*/
620static unsigned short
621s_ctk_mouse_ytoc(unsigned short y)
622{
623 return y / 8;
624}
625/*-----------------------------------------------------------------------------------*/
626static const struct ctk_draw_service_interface interface =
627 {CTK_DRAW_SERVICE_VERSION,
628 1,
629 1,
630 1,
631 s_ctk_draw_init,
632 s_ctk_draw_clear,
633 s_ctk_draw_clear_window,
634 s_ctk_draw_window,
635 s_ctk_draw_dialog,
636 s_ctk_draw_widget,
637 s_ctk_draw_menus,
638 s_ctk_draw_width,
639 s_ctk_draw_height,
640 s_ctk_mouse_xtoc,
641 s_ctk_mouse_ytoc,
642 };
643
644EK_EVENTHANDLER(eventhandler, ev, data);
645EK_PROCESS(proc, CTK_DRAW_SERVICE_NAME ": text", EK_PRIO_NORMAL,
646 eventhandler, NULL, (void *)&interface);
647
648/*--------------------------------------------------------------------------*/
649LOADER_INIT_FUNC(ctk_conio_service_init, arg)
650{
651 s_ctk_draw_init();
652 ek_service_start(CTK_DRAW_SERVICE_NAME, &proc);
653}
654/*--------------------------------------------------------------------------*/
655EK_EVENTHANDLER(eventhandler, ev, data)
656{
657 EK_EVENTHANDLER_ARGS(ev, data);
658
659 switch(ev) {
660 case EK_EVENT_INIT:
661 case EK_EVENT_REPLACE:
662 s_ctk_draw_init();
663 ctk_restore();
664 break;
665 case EK_EVENT_REQUEST_REPLACE:
666 ek_replace((struct ek_proc *)data, NULL);
667 LOADER_UNLOAD();
668 break;
669 }
670}
671/*--------------------------------------------------------------------------*/