forked from KolibriOS/kolibrios
Add C_Layer for TinyC
- Boxlib wrapper git-svn-id: svn://kolibrios.org@8104 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
20c622fb38
commit
d887c0ddfb
231
programs/develop/ktcc/trunk/bin/lib/clayer/src/loadboxlib.asm
Normal file
231
programs/develop/ktcc/trunk/bin/lib/clayer/src/loadboxlib.asm
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
; writed by maxñodehack
|
||||||
|
; adaptation of clayer for ktcc
|
||||||
|
format elf
|
||||||
|
use32 ; Tell compiler to use 32 bit instructions
|
||||||
|
; ELF section
|
||||||
|
section '.text' executable
|
||||||
|
|
||||||
|
|
||||||
|
include 'proc32.inc'
|
||||||
|
include 'macros.inc'
|
||||||
|
purge section,mov,add,sub
|
||||||
|
|
||||||
|
include 'dll.inc'
|
||||||
|
|
||||||
|
|
||||||
|
public init_boxlib as 'kolibri_boxlib_init'
|
||||||
|
|
||||||
|
|
||||||
|
proc init_boxlib
|
||||||
|
local retval dd ?
|
||||||
|
mov [retval], eax
|
||||||
|
pusha
|
||||||
|
mcall 68, 11
|
||||||
|
test eax, eax
|
||||||
|
jnz @f
|
||||||
|
mov [retval], -1
|
||||||
|
jmp exit_init_boxlib
|
||||||
|
@@:
|
||||||
|
stdcall dll.Load, @IMPORT
|
||||||
|
test eax, eax
|
||||||
|
jz exit_init_boxlib
|
||||||
|
mov [retval], -1
|
||||||
|
exit_init_boxlib:
|
||||||
|
popa
|
||||||
|
mov eax, [retval]
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
;; Wrapper to handle edit_box_key function for editboxes.
|
||||||
|
;; Call this baby from C (refer kolibri_editbox.h for details)
|
||||||
|
;public editbox_key_thunk as '_editbox_key@4' ; renamed due to ambiguity
|
||||||
|
;public press_key as '_press_key'
|
||||||
|
;; replaced by siemargl as inline ASM in C wrapper
|
||||||
|
;editbox_key_thunk:
|
||||||
|
; mov [oldebp], ebp ;Save ebp because GCC is crazy for it otherwise.
|
||||||
|
; pop ebp ;Save return address in ebp. Stack top is param now.
|
||||||
|
; mov eax, dword [press_key]
|
||||||
|
; call [edit_box_key] ; The pointer we passed should be on the stack already.
|
||||||
|
; push ebp ;push the return address back to stack
|
||||||
|
; mov ebp, [oldebp]
|
||||||
|
; ret
|
||||||
|
;oldebp dd ?
|
||||||
|
;press_key dd ?
|
||||||
|
|
||||||
|
|
||||||
|
section '.data' writeable
|
||||||
|
@IMPORT:
|
||||||
|
library lib_boxlib, 'box_lib.obj'
|
||||||
|
|
||||||
|
import lib_boxlib, \
|
||||||
|
edit_box_draw, 'edit_box' , \
|
||||||
|
edit_box_key, 'edit_box_key' , \
|
||||||
|
edit_box_mouse, 'edit_box_mouse', \
|
||||||
|
edit_box_set_text, 'edit_box_set_text' , \
|
||||||
|
init_checkbox2, 'init_checkbox2' , \
|
||||||
|
check_box_draw2, 'check_box_draw2' , \
|
||||||
|
check_box_mouse2, 'check_box_mouse2' , \
|
||||||
|
option_box_draw, 'option_box_draw' , \
|
||||||
|
option_box_mouse, 'option_box_mouse' , \
|
||||||
|
scrollbar_v_draw, 'scrollbar_v_draw' , \
|
||||||
|
scrollbar_v_mouse, 'scrollbar_v_mouse' , \
|
||||||
|
scrollbar_h_draw, 'scrollbar_h_draw' , \
|
||||||
|
scrollbar_h_mouse, 'scrollbar_h_mouse' , \
|
||||||
|
dynamic_button_draw, 'dbutton_draw' , \
|
||||||
|
dynamic_button_mouse, 'dbutton_mouse' , \
|
||||||
|
menu_bar_draw, 'menu_bar_draw' , \
|
||||||
|
menu_bar_mouse, 'menu_bar_mouse' , \
|
||||||
|
menu_bar_activate, 'menu_bar_activate' , \
|
||||||
|
fb_draw_panel, 'FileBrowser_draw' , \
|
||||||
|
fb_mouse, 'FileBrowser_mouse' , \
|
||||||
|
fb_key, 'FileBrowser_key' , \
|
||||||
|
tl_data_init, 'tl_data_init' , \
|
||||||
|
tl_data_clear, 'tl_data_clear' , \
|
||||||
|
tl_info_clear, 'tl_info_clear' , \
|
||||||
|
tl_key, 'tl_key' , \
|
||||||
|
tl_mouse, 'tl_mouse' , \
|
||||||
|
tl_draw, 'tl_draw' , \
|
||||||
|
tl_info_undo, 'tl_info_undo' , \
|
||||||
|
tl_info_redo, 'tl_info_redo' , \
|
||||||
|
tl_node_add, 'tl_node_add' , \
|
||||||
|
tl_node_set_data, 'tl_node_set_data' , \
|
||||||
|
tl_node_get_data, 'tl_node_get_data' , \
|
||||||
|
tl_node_delete, 'tl_node_delete' , \
|
||||||
|
tl_cur_beg, 'tl_cur_beg' , \
|
||||||
|
tl_cur_next, 'tl_cur_next' , \
|
||||||
|
tl_cur_perv, 'tl_cur_perv' , \
|
||||||
|
tl_node_close_open, 'tl_node_close_open' , \
|
||||||
|
tl_node_lev_inc, 'tl_node_lev_inc' , \
|
||||||
|
tl_node_lev_dec, 'tl_node_lev_dec' , \
|
||||||
|
tl_node_move_up, 'tl_node_move_up' , \
|
||||||
|
tl_node_move_down, 'tl_node_move_down' , \
|
||||||
|
tl_node_poi_get_info, 'tl_node_poi_get_info' , \
|
||||||
|
tl_node_poi_get_next_info, 'tl_node_poi_get_next_info' , \
|
||||||
|
tl_node_poi_get_data, 'tl_node_poi_get_data' , \
|
||||||
|
tl_save_mem, 'tl_save_mem' , \
|
||||||
|
tl_load_mem, 'tl_load_mem' , \
|
||||||
|
tl_get_mem_size, 'tl_get_mem_size' , \
|
||||||
|
path_show_prepare, 'PathShow_prepare' , \
|
||||||
|
path_show_draw, 'PathShow_draw' , \
|
||||||
|
ted_but_sumb_upper, 'ted_but_sumb_upper' , \
|
||||||
|
ted_but_sumb_lover, 'ted_but_sumb_lover' , \
|
||||||
|
ted_but_convert_by_table, 'ted_but_convert_by_table' , \
|
||||||
|
ted_can_save, 'ted_can_save' , \
|
||||||
|
ted_clear, 'ted_clear' , \
|
||||||
|
ted_delete, 'ted_delete' , \
|
||||||
|
ted_draw, 'ted_draw' , \
|
||||||
|
ted_init, 'ted_init' , \
|
||||||
|
ted_init_scroll_bars, 'ted_init_scroll_bars' , \
|
||||||
|
ted_init_syntax_file, 'ted_init_syntax_file' , \
|
||||||
|
ted_is_select, 'ted_is_select' , \
|
||||||
|
ted_key, 'ted_key' , \
|
||||||
|
ted_mouse, 'ted_mouse' , \
|
||||||
|
ted_open_file, 'ted_open_file' , \
|
||||||
|
ted_save_file, 'ted_save_file' , \
|
||||||
|
ted_text_add, 'ted_text_add' , \
|
||||||
|
ted_but_select_word, 'ted_but_select_word' , \
|
||||||
|
ted_but_cut, 'ted_but_cut' , \
|
||||||
|
ted_but_copy, 'ted_but_copy' , \
|
||||||
|
ted_but_paste, 'ted_but_paste' , \
|
||||||
|
ted_but_undo, 'ted_but_undo' , \
|
||||||
|
ted_but_redo, 'ted_but_redo' , \
|
||||||
|
ted_but_reverse, 'ted_but_reverse' , \
|
||||||
|
ted_but_find, 'ted_but_find' , \
|
||||||
|
ted_but_replace, 'ted_but_replace' , \
|
||||||
|
ted_text_colored, 'ted_text_colored' , \
|
||||||
|
ted_go_to_position, 'ted_go_to_position' , \
|
||||||
|
frame_draw, 'frame_draw' , \
|
||||||
|
progressbar_draw,'progressbar_draw' , \
|
||||||
|
progressbar_progress, 'progressbar_progress'
|
||||||
|
|
||||||
|
|
||||||
|
public edit_box_draw as 'edit_box_draw'
|
||||||
|
public edit_box_key as 'edit_box_key'
|
||||||
|
public edit_box_mouse as 'edit_box_mouse'
|
||||||
|
public edit_box_set_text as 'edit_box_set_text'
|
||||||
|
|
||||||
|
public check_box_draw2 as 'check_box_draw2'
|
||||||
|
public check_box_mouse2 as 'check_box_mouse2'
|
||||||
|
public init_checkbox2 as 'init_checkbox2'
|
||||||
|
|
||||||
|
public progressbar_draw as 'progressbar_draw'
|
||||||
|
public progressbar_progress as 'progressbar_progress'
|
||||||
|
|
||||||
|
public frame_draw as 'frame_draw'
|
||||||
|
|
||||||
|
public scrollbar_v_draw as 'scrollbar_v_draw'
|
||||||
|
public scrollbar_v_mouse as 'scrollbar_v_mouse'
|
||||||
|
public scrollbar_h_draw as 'scrollbar_h_draw'
|
||||||
|
public scrollbar_h_mouse as 'scrollbar_h_mouse'
|
||||||
|
|
||||||
|
public option_box_draw as 'option_box_draw'
|
||||||
|
public option_box_mouse as 'option_box_mouse'
|
||||||
|
|
||||||
|
public menu_bar_draw as 'menu_bar_draw'
|
||||||
|
public menu_bar_mouse as 'menu_bar_mouse'
|
||||||
|
public menu_bar_activate as 'menu_bar_activate'
|
||||||
|
|
||||||
|
public dynamic_button_draw as 'dynamic_button_draw'
|
||||||
|
public dynamic_button_mouse as 'dynamic_button_mouse'
|
||||||
|
|
||||||
|
public path_show_prepare as 'path_show_prepare'
|
||||||
|
public path_show_draw as 'path_show_draw'
|
||||||
|
|
||||||
|
public fb_draw_panel as 'filebrowse_draw'
|
||||||
|
public fb_mouse as 'filebrowse_mouse'
|
||||||
|
public fb_key as 'filebrowse_key'
|
||||||
|
|
||||||
|
public ted_but_sumb_upper as 'ted_but_sumb_upper'
|
||||||
|
public ted_but_sumb_lover as 'ted_but_sumb_lover'
|
||||||
|
public ted_but_convert_by_table as 'ted_but_convert_by_table'
|
||||||
|
public ted_can_save as 'ted_can_save'
|
||||||
|
public ted_clear as 'ted_clear'
|
||||||
|
public ted_delete as 'ted_delete'
|
||||||
|
public ted_draw as 'ted_draw'
|
||||||
|
public ted_init as 'ted_init'
|
||||||
|
public ted_init_scroll_bars as 'ted_init_scroll_bars'
|
||||||
|
public ted_init_syntax_file as 'ted_init_syntax_file'
|
||||||
|
public ted_is_select as 'ted_is_select'
|
||||||
|
public ted_key as 'ted_key_asm'
|
||||||
|
public ted_mouse as 'ted_mouse'
|
||||||
|
public ted_open_file as 'ted_open_file_asm'
|
||||||
|
public ted_save_file as 'ted_save_file_asm'
|
||||||
|
public ted_text_add as '_ted_text_add'
|
||||||
|
public ted_but_select_word as 'ted_but_select_word'
|
||||||
|
public ted_but_cut as 'ted_but_cut'
|
||||||
|
public ted_but_copy as 'ted_but_copy'
|
||||||
|
public ted_but_paste as 'ted_but_paste'
|
||||||
|
public ted_but_undo as 'ted_but_undo'
|
||||||
|
public ted_but_redo as 'ted_but_redo'
|
||||||
|
public ted_but_reverse as 'ted_but_reverse'
|
||||||
|
public ted_but_find as 'ted_but_find'
|
||||||
|
public ted_but_replace as 'ted_but_replace'
|
||||||
|
public ted_text_colored as 'ted_text_colored_asm'
|
||||||
|
public ted_go_to_position as 'ted_go_to_position'
|
||||||
|
|
||||||
|
public tl_data_init as 'tl_data_init'
|
||||||
|
public tl_data_clear as 'tl_data_clear'
|
||||||
|
public tl_info_clear as 'tl_info_clear'
|
||||||
|
public tl_key as 'tl_key_asm'
|
||||||
|
public tl_mouse as 'tl_mouse'
|
||||||
|
public tl_draw as 'tl_draw'
|
||||||
|
public tl_info_undo as 'tl_info_undo'
|
||||||
|
public tl_info_redo as 'tl_info_redo'
|
||||||
|
public tl_node_add as 'tl_node_add'
|
||||||
|
public tl_node_set_data as 'tl_node_set_data'
|
||||||
|
public tl_node_get_data as 'tl_node_get_data'
|
||||||
|
public tl_node_delete as 'tl_node_delete'
|
||||||
|
public tl_cur_beg as 'tl_cur_beg'
|
||||||
|
public tl_cur_next as 'tl_cur_next'
|
||||||
|
public tl_cur_perv as 'tl_cur_perv'
|
||||||
|
public tl_node_close_open as 'tl_node_close_open'
|
||||||
|
public tl_node_lev_inc as 'tl_node_lev_inc'
|
||||||
|
public tl_node_lev_dec as 'tl_node_lev_dec'
|
||||||
|
public tl_node_move_up as 'tl_node_move_up'
|
||||||
|
public tl_node_move_down as 'tl_node_move_down'
|
||||||
|
public tl_node_poi_get_info as 'tl_node_poi_get_info'
|
||||||
|
public tl_node_poi_get_next_info as 'tl_node_poi_get_next_info'
|
||||||
|
public tl_node_poi_get_data as 'tl_node_poi_get_data'
|
||||||
|
public tl_save_mem as 'tl_save_mem_asm'
|
||||||
|
public tl_load_mem as 'tl_load_mem_asm'
|
||||||
|
public tl_get_mem_size as 'tl_get_mem_size_asm'
|
234
programs/develop/ktcc/trunk/libc/include/clayer/boxlib.h
Normal file
234
programs/develop/ktcc/trunk/libc/include/clayer/boxlib.h
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
// writed by maxcodehack
|
||||||
|
// adaptation of clayer for ktcc
|
||||||
|
#ifndef KOLIBRI_BOXLIB_H
|
||||||
|
#define KOLIBRI_BOXLIB_H
|
||||||
|
|
||||||
|
extern int kolibri_boxlib_init(void);
|
||||||
|
|
||||||
|
// SCROLLBAR
|
||||||
|
typedef struct {
|
||||||
|
uint16_t xsize;
|
||||||
|
uint16_t xpos;
|
||||||
|
uint16_t ysize;
|
||||||
|
uint16_t ypos;
|
||||||
|
uint32_t btn_height;
|
||||||
|
uint32_t type; // type 1 - stylish frame, type 2 - ?, type 0 - ?
|
||||||
|
uint32_t max_area;
|
||||||
|
uint32_t cur_area;
|
||||||
|
uint32_t position;
|
||||||
|
uint32_t back_color;
|
||||||
|
uint32_t front_color;
|
||||||
|
uint32_t line_color;
|
||||||
|
uint32_t redraw;
|
||||||
|
uint16_t delta;
|
||||||
|
uint16_t delta2;
|
||||||
|
uint16_t r_size_x;
|
||||||
|
uint16_t r_start_x;
|
||||||
|
uint16_t r_size_y;
|
||||||
|
uint16_t r_start_y;
|
||||||
|
uint32_t m_pos;
|
||||||
|
uint32_t m_pos2;
|
||||||
|
uint32_t m_keys;
|
||||||
|
uint32_t run_size;
|
||||||
|
uint32_t position2;
|
||||||
|
uint32_t work_size;
|
||||||
|
uint32_t all_redraw; // need to be set =1 before each redraw
|
||||||
|
uint32_t ar_offset;
|
||||||
|
} __attribute__ ((__packed__)) scrollbar;
|
||||||
|
|
||||||
|
extern void (*scrollbar_h_draw)(scrollbar*) __attribute__((__stdcall__));
|
||||||
|
extern void (*scrollbar_h_mouse)(scrollbar*) __attribute__((__stdcall__));
|
||||||
|
extern void (*scrollbar_v_draw)(scrollbar*) __attribute__((__stdcall__));
|
||||||
|
extern void (*scrollbar_v_mouse)(scrollbar*) __attribute__((__stdcall__));
|
||||||
|
|
||||||
|
// CHECKBOX
|
||||||
|
typedef struct {
|
||||||
|
unsigned int left_s;
|
||||||
|
unsigned int top_s;
|
||||||
|
unsigned int ch_text_margin;
|
||||||
|
unsigned int color;
|
||||||
|
unsigned int border_color;
|
||||||
|
unsigned int text_color;
|
||||||
|
char *text;
|
||||||
|
unsigned int flags;
|
||||||
|
|
||||||
|
/* Users can use members above this */
|
||||||
|
unsigned int size_of_str;
|
||||||
|
}check_box;
|
||||||
|
|
||||||
|
extern void (*check_box_draw2)(check_box *) __attribute__((__stdcall__));
|
||||||
|
extern void (*check_box_mouse2)(check_box *)__attribute__((__stdcall__));
|
||||||
|
extern void (*init_checkbox2)(check_box *)__attribute__((__stdcall__));
|
||||||
|
|
||||||
|
// DBUTTON
|
||||||
|
typedef struct {
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t x_w;
|
||||||
|
uint32_t y_h;
|
||||||
|
uint32_t mouse_pos;
|
||||||
|
uint32_t mouse_keys;
|
||||||
|
uint32_t mouse_keys_old;
|
||||||
|
void* active_raw; //active bitmap
|
||||||
|
void* passive_raw; //passive bitmap
|
||||||
|
void* click_raw; //pressed bitmap
|
||||||
|
uint32_t resolution_raw; // bpp, as esi fn65
|
||||||
|
void* palette_raw; // palette, as edi fn65
|
||||||
|
uint32_t offset_raw; // width as ebp fn65
|
||||||
|
uint32_t select; // internal state: 0 - passive, 2 - pressed, 1 - clicked
|
||||||
|
uint32_t click; // clicked - 1, zero it after tested
|
||||||
|
} pict_button;
|
||||||
|
|
||||||
|
extern void (*dynamic_button_draw)(pict_button *) __attribute__((__stdcall__));
|
||||||
|
extern void (*dynamic_button_mouse)(pict_button *) __attribute__((__stdcall__));
|
||||||
|
|
||||||
|
// EDITBOX
|
||||||
|
|
||||||
|
typedef struct edit_box_t {
|
||||||
|
unsigned int width;
|
||||||
|
unsigned int left;
|
||||||
|
unsigned int top;
|
||||||
|
unsigned int color;
|
||||||
|
unsigned int shift_color; // selected text color
|
||||||
|
unsigned int focus_border_color;
|
||||||
|
unsigned int blur_border_color;
|
||||||
|
unsigned int text_color;
|
||||||
|
unsigned int max;
|
||||||
|
char *text;
|
||||||
|
void *mouse_variable; // must be pointer edit_box** to save focused editbox
|
||||||
|
unsigned int flags;
|
||||||
|
|
||||||
|
unsigned int size; // used symbols in buffer without trailing zero
|
||||||
|
unsigned int pos; // cursor position
|
||||||
|
/* The following struct members are not used by the users of API */
|
||||||
|
unsigned int offset;
|
||||||
|
unsigned int cl_curs_x;
|
||||||
|
unsigned int cl_curs_y;
|
||||||
|
unsigned int shift;
|
||||||
|
unsigned int shift_old;
|
||||||
|
unsigned int height;
|
||||||
|
unsigned int char_width;
|
||||||
|
}edit_box;
|
||||||
|
|
||||||
|
extern void (*edit_box_draw)(edit_box *) __attribute__((__stdcall__));
|
||||||
|
extern void (*edit_box_key)(edit_box *) __attribute__((__stdcall__));
|
||||||
|
extern void (*edit_box_mouse)(edit_box *) __attribute__((__stdcall__));
|
||||||
|
extern void (*edit_box_set_text)(edit_box *, char *) __attribute__((__stdcall__));
|
||||||
|
extern volatile unsigned press_key;
|
||||||
|
|
||||||
|
// FRAME
|
||||||
|
typedef struct {
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t x_w;
|
||||||
|
uint32_t y_h;
|
||||||
|
color_t ext_col;
|
||||||
|
color_t int_col;
|
||||||
|
uint32_t flags;
|
||||||
|
char *text_pointer;
|
||||||
|
uint32_t text_position;
|
||||||
|
uint32_t font_number;
|
||||||
|
uint32_t font_size_y;
|
||||||
|
color_t font_color;
|
||||||
|
color_t font_bg_color;
|
||||||
|
}frame;
|
||||||
|
|
||||||
|
extern void (*frame_draw)(frame *) __attribute__((__stdcall__));
|
||||||
|
|
||||||
|
// MENUBAR
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t type; // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò
|
||||||
|
|
||||||
|
uint32_t x_w; // âåðõíèé ïóíêò
|
||||||
|
uint32_t y_h;
|
||||||
|
|
||||||
|
char* text_pointer;
|
||||||
|
char* pos_pointer;
|
||||||
|
char* text_end;
|
||||||
|
uint32_t mouse_pos;
|
||||||
|
uint32_t mouse_keys;
|
||||||
|
|
||||||
|
uint32_t x_w1; // ïîäìåíþ
|
||||||
|
uint32_t y_h1;
|
||||||
|
|
||||||
|
color_t bckg_col; // ôîí âåðõíåãî ïóêòà
|
||||||
|
color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà
|
||||||
|
color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû)
|
||||||
|
uint32_t select;
|
||||||
|
uint32_t out_select;
|
||||||
|
char* buf_adress;
|
||||||
|
char* procinfo;
|
||||||
|
uint32_t click;
|
||||||
|
uint32_t cursor;
|
||||||
|
uint32_t cursor_old;
|
||||||
|
uint32_t interval;
|
||||||
|
uint32_t cursor_max;
|
||||||
|
uint32_t extended_key;
|
||||||
|
color_t menu_sel_col; // öâåò ôîíà âûáðàííîãî ïîäïóíêòà
|
||||||
|
color_t bckg_text_col; // öâåò øðèôòà íåâûáðàííîãî ïóíêòà
|
||||||
|
color_t frnt_text_col; // öâåò øðèôòà âûáðàííîãî ïóíêòà
|
||||||
|
uint32_t mouse_keys_old;
|
||||||
|
uint32_t font_height;
|
||||||
|
uint32_t cursor_out;
|
||||||
|
uint32_t get_mouse_flag;
|
||||||
|
} menubar;
|
||||||
|
|
||||||
|
extern void (*menu_bar_draw)(menubar *) __attribute__((__stdcall__));
|
||||||
|
extern void (*menu_bar_mouse)(menubar *) __attribute__((__stdcall__));
|
||||||
|
extern void (*menu_bar_activate)(menubar *) __attribute__((__stdcall__));
|
||||||
|
|
||||||
|
// OPTIONBOX
|
||||||
|
typedef struct __attribute__ ((__packed__)) option_box_t {
|
||||||
|
struct option_box_t **selected;
|
||||||
|
uint16_t posx;
|
||||||
|
uint16_t posy;
|
||||||
|
uint32_t text_margin; // = 4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè
|
||||||
|
uint32_t size; // 12 ðàçìåð êâàäðàòà ÷åê áîêñà
|
||||||
|
color_t color;
|
||||||
|
color_t border_color; // individual border
|
||||||
|
color_t text_color;
|
||||||
|
char *text;
|
||||||
|
uint32_t text_len;
|
||||||
|
uint32_t flags;
|
||||||
|
}option_box;
|
||||||
|
|
||||||
|
extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__));
|
||||||
|
extern void (*option_box_mouse)(option_box **)__attribute__((__stdcall__));
|
||||||
|
|
||||||
|
// PATHSHOW
|
||||||
|
typedef struct {
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t x_y;
|
||||||
|
uint16_t font_size_x; // 6 - for font 0, 8 - for font 1
|
||||||
|
uint16_t area_size_x;
|
||||||
|
uint32_t font_number; // 0 - monospace, 1 - variable, as fn4 (2bit only 0-3)
|
||||||
|
uint32_t background_flag; // as fn4, if 0, bk_color unneeded
|
||||||
|
color_t font_color; // as fn4
|
||||||
|
color_t background_color; // as fn4
|
||||||
|
char* text_pointer; // 4096 ?
|
||||||
|
char* work_area_pointer; // 4096 ?
|
||||||
|
uint32_t temp_text_length;
|
||||||
|
} __attribute__ ((__packed__)) pathview;
|
||||||
|
|
||||||
|
extern void (*path_show_prepare)(pathview *) __attribute__((__stdcall__));
|
||||||
|
extern void (*path_show_draw)(pathview *) __attribute__((__stdcall__));
|
||||||
|
|
||||||
|
// PROGRESSBAR
|
||||||
|
typedef struct {
|
||||||
|
unsigned int value;
|
||||||
|
unsigned int left;
|
||||||
|
unsigned int top;
|
||||||
|
unsigned int width;
|
||||||
|
unsigned int height;
|
||||||
|
unsigned int style;
|
||||||
|
unsigned int min;
|
||||||
|
unsigned int max;
|
||||||
|
unsigned int back_color;
|
||||||
|
unsigned int progress_color;
|
||||||
|
unsigned int frame_color;
|
||||||
|
} progressbar;
|
||||||
|
|
||||||
|
extern void (*progressbar_draw)(progressbar *) __attribute__((__stdcall__));
|
||||||
|
extern void (*progressbar_progress)(progressbar *) __attribute__((__stdcall__));
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* KOLIBRI_BOXLIB_H */
|
29
programs/develop/ktcc/trunk/libc/include/clayer/readme.txt
Normal file
29
programs/develop/ktcc/trunk/libc/include/clayer/readme.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Adaption of C_Layer wrappers for TCC
|
||||||
|
|
||||||
|
_____________
|
||||||
|
TODO
|
||||||
|
_____________
|
||||||
|
|
||||||
|
- Add wrappers in boxlib.h for:
|
||||||
|
- statictext
|
||||||
|
- filebrowse
|
||||||
|
- editor
|
||||||
|
- treelist
|
||||||
|
|
||||||
|
- Port other wrappers from C_Layer
|
||||||
|
|
||||||
|
|
||||||
|
_____________
|
||||||
|
How to use?
|
||||||
|
_____________
|
||||||
|
|
||||||
|
1. Include header to your program:
|
||||||
|
|
||||||
|
#include <clayer/boxlib.h>
|
||||||
|
|
||||||
|
2. Write some program
|
||||||
|
3. Compile with link to program .o file:
|
||||||
|
|
||||||
|
kos32-tcc sample.c loadboxlib.o -lck -o sample.kex
|
||||||
|
|
||||||
|
(.o files in ktcc/trunk/bin/lib/clayer)
|
76
programs/develop/ktcc/trunk/samples/clayer/boxlib.c
Normal file
76
programs/develop/ktcc/trunk/samples/clayer/boxlib.c
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// WRITED BY MAXCODEHACK
|
||||||
|
// Need to other sample, this sample is very shitcode)
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "kos32sys1.h"
|
||||||
|
#include <clayer/boxlib.h>
|
||||||
|
|
||||||
|
struct kolibri_system_colors sys_color_table;
|
||||||
|
|
||||||
|
char statusbar[255];
|
||||||
|
char proc_info[1024];
|
||||||
|
char text_line[255];
|
||||||
|
|
||||||
|
enum BUTTONS
|
||||||
|
{
|
||||||
|
BTN_QUIT = 1,
|
||||||
|
BTN_POP = 10,
|
||||||
|
BTN_UNLOCK = 11
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FONT_W 8
|
||||||
|
#define FONT_H 14
|
||||||
|
#define LINES 10
|
||||||
|
|
||||||
|
void draw_window()
|
||||||
|
{
|
||||||
|
int win_hight, win_width, i, pos_y = get_skin_height() + 36; // 60 == 24+36
|
||||||
|
|
||||||
|
// start redraw
|
||||||
|
begin_draw();
|
||||||
|
// define&draw window
|
||||||
|
sys_create_window(10, 40, 600, 400, "My window", /*sys_color_table.work_area*/0xFFFFFF, 0x13);
|
||||||
|
|
||||||
|
// end redraw
|
||||||
|
end_draw();
|
||||||
|
}
|
||||||
|
scrollbar scroll_ver = {15, 100 - 26, 100 - 29, 0, 0, 2 /* type */, 115, 15, 0,0x353B47,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
kolibri_boxlib_init();
|
||||||
|
int gui_event;
|
||||||
|
uint32_t pressed_button = 0, mouse_button;
|
||||||
|
pos_t mouse_pos;
|
||||||
|
|
||||||
|
get_system_colors(&sys_color_table);
|
||||||
|
set_event_mask(0xC0000027); // mouse events only when focused window and mouse inside
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
gui_event = get_os_event();
|
||||||
|
switch(gui_event)
|
||||||
|
{
|
||||||
|
case KOLIBRI_EVENT_NONE:
|
||||||
|
// background work
|
||||||
|
break;
|
||||||
|
case KOLIBRI_EVENT_REDRAW:
|
||||||
|
draw_window();
|
||||||
|
scrollbar_v_draw(&scroll_ver);
|
||||||
|
break;
|
||||||
|
case KOLIBRI_EVENT_KEY:
|
||||||
|
// scroll
|
||||||
|
break;
|
||||||
|
case KOLIBRI_EVENT_BUTTON:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case KOLIBRI_EVENT_MOUSE:
|
||||||
|
scrollbar_v_mouse(&scroll_ver);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
1
programs/develop/ktcc/trunk/samples/clayer/readme.txt
Normal file
1
programs/develop/ktcc/trunk/samples/clayer/readme.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
kos32-tcc boxlib.c loadboxlib.o -lck -o boxlib.kex
|
Loading…
Reference in New Issue
Block a user