/contrib/C_Layer/ASM/loadboxlib.asm |
---|
12,7 → 12,7 |
include '../../../programs/dll.inc' |
public init_boxlib as '_init_boxlib_asm' |
public editbox_key_thunk as '_editbox_key@4' ; renamed due to ambiguity |
public editbox_key as '_editbox_key@4' |
public press_key as '_press_key' |
;;; Returns 0 on success. -1 on failure. |
34,7 → 34,7 |
;; Wrapper to handle edit_box_key function for editboxes. |
;; Call this baby from C (refer kolibri_editbox.h for details) |
editbox_key_thunk: |
editbox_key: |
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] |
59,12 → 59,12 |
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' , \ |
scroll_bar_vertical_draw, 'scrollbar_ver_draw' , \ |
scroll_bar_vertical_mouse, 'scrollbar_ver_mouse' , \ |
scroll_bar_horizontal_draw, 'scrollbar_hor_draw' , \ |
scroll_bar_horizontal_mouse, 'scrollbar_hor_mouse' , \ |
dinamic_button_draw, 'dbutton_draw' , \ |
dinamic_button_mouse, 'dbutton_mouse' , \ |
menu_bar_draw, 'menu_bar_draw' , \ |
menu_bar_mouse, 'menu_bar_mouse' , \ |
menu_bar_activate, 'menu_bar_activate' , \ |
128,11 → 128,9 |
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' |
142,8 → 140,3 |
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' |
/contrib/C_Layer/ASM/Makefile |
---|
2,6 → 2,6 |
FASM = fasm |
all: $(patsubst %.asm,%.obj,$(wildcard *.asm)) |
mv $^ ../OBJ |
mv $^ ../OBJ/ |
%.obj: %.asm |
$(FASM) $< $% |
/contrib/C_Layer/EXAMPLE/libguic_kolibri/scroll_progress.c |
---|
File deleted |
/contrib/C_Layer/INCLUDE/kolibri_scrollbar.h |
---|
File deleted |
/contrib/C_Layer/INCLUDE/kolibri_statictext.h |
---|
File deleted |
/contrib/C_Layer/INCLUDE/kolibri_checkbox.h |
---|
3,13 → 3,6 |
#include "kolibri_colors.h" |
/* |
ch_flag_en - ôëàã óñòàíîâëåííîãî ÷åê áîêñà |
ch_flag_top - ôëàã ðàñïîëîæåíèÿ òåêñòà ââåðõó |
ch_flag_middle - ôëàã ðàñïîëîæåíèÿ òåêñòà â öåíòðå |
ch_flag_bottom - ôëàã ðàñïîëîæåíèÿ òåêñòà â íèçó ò.å. ïî óìîë÷àíèþ ïðèíèìàåòñÿ çíà÷åíèå âíèçó |
*/ |
enum CHECKBOX_FLAGS { |
CHECKBOX_IS_SET = 0x00000002 |
/* Add more flags later */ |
39,7 → 32,7 |
new_checkbox -> left_s = (tlx << 16) + sizex; |
new_checkbox -> top_s = (tly << 16) + sizey; |
new_checkbox -> ch_text_margin = 10; |
new_checkbox -> color = 0xFFFFFFFF; // 0x80AABBCC, 31-bit mus be set asciiz |
new_checkbox -> color = 0xFFFFFFFF; |
new_checkbox -> border_color = kolibri_color_table.color_work_graph; |
new_checkbox -> text_color = kolibri_color_table.color_work_text; |
new_checkbox -> text = label_text; |
/contrib/C_Layer/INCLUDE/kolibri_gui_elements.h |
---|
7,11 → 7,7 |
#include "kolibri_button.h" |
#include "kolibri_progressbar.h" |
#include "kolibri_frame.h" |
#include "kolibri_scrollbar.h" |
#include "kolibri_statictext.h" |
#define X_Y(x,y) (((x)<<16)|(y)) |
/* enum KOLIBRI_GUI_ELEMENT_TYPE contains all available GUI items from box_lib */ |
/* More elements can be added from other libraries as required */ |
enum KOLIBRI_GUI_ELEMENT_TYPE { |
18,8 → 14,7 |
KOLIBRI_EDIT_BOX, |
KOLIBRI_CHECK_BOX, |
KOLIBRI_RADIO_BUTTON, |
KOLIBRI_SCROLL_BAR_H, |
KOLIBRI_SCROLL_BAR_V, |
KOLIBRI_SCROLL_BAR, |
KOLIBRI_DYNAMIC_BUTTON, |
KOLIBRI_MENU_BAR, |
KOLIBRI_FILE_BROWSER, |
28,8 → 23,6 |
KOLIBRI_TEXT_EDITOR, |
KOLIBRI_FRAME, |
KOLIBRI_PROGRESS_BAR, |
KOLIBRI_STATICTEXT, |
KOLIBRI_STATICNUM, |
KOLIBRI_BUTTON, |
94,7 → 87,6 |
kolibri_gui_op_table[KOLIBRI_PROGRESS_BAR].redraw_fn = (cb_elem_boxlib)progressbar_draw; |
kolibri_gui_op_table[KOLIBRI_PROGRESS_BAR].mouse_fn = NULL; |
kolibri_gui_op_table[KOLIBRI_PROGRESS_BAR].key_fn = NULL; |
debug_board_printf("PROGRESS (%x,%x,%x)\n", progressbar_draw,0,0); |
/* Setting up functions for frame GUI elements*/ |
kolibri_gui_op_table[KOLIBRI_FRAME].redraw_fn = (cb_elem_boxlib)frame_draw; |
101,28 → 93,6 |
kolibri_gui_op_table[KOLIBRI_FRAME].mouse_fn = NULL; |
kolibri_gui_op_table[KOLIBRI_FRAME].key_fn = NULL; |
debug_board_printf("FRAME (%x,%x,%x)\n", frame_draw,0,0); |
/* scrollbars */ |
kolibri_gui_op_table[KOLIBRI_SCROLL_BAR_H].redraw_fn = (cb_elem_boxlib)scrollbar_h_draw; |
kolibri_gui_op_table[KOLIBRI_SCROLL_BAR_H].mouse_fn = (cb_elem_boxlib)scrollbar_h_mouse; |
kolibri_gui_op_table[KOLIBRI_SCROLL_BAR_H].key_fn = NULL; |
debug_board_printf("SCROLL_H (%x,%x,%x)\n", scrollbar_h_draw,scrollbar_h_mouse,0); |
kolibri_gui_op_table[KOLIBRI_SCROLL_BAR_V].redraw_fn = (cb_elem_boxlib)scrollbar_v_draw; |
kolibri_gui_op_table[KOLIBRI_SCROLL_BAR_V].mouse_fn = (cb_elem_boxlib)scrollbar_v_mouse; |
kolibri_gui_op_table[KOLIBRI_SCROLL_BAR_V].key_fn = NULL; |
debug_board_printf("SCROLL_V (%x,%x,%x)\n", scrollbar_v_draw,scrollbar_v_mouse,0); |
kolibri_gui_op_table[KOLIBRI_STATICTEXT].redraw_fn = (cb_elem_boxlib)statictext_draw; |
kolibri_gui_op_table[KOLIBRI_STATICTEXT].mouse_fn = NULL; |
kolibri_gui_op_table[KOLIBRI_STATICTEXT].key_fn = NULL; |
kolibri_gui_op_table[KOLIBRI_STATICNUM].redraw_fn = (cb_elem_boxlib)staticnum_draw; |
kolibri_gui_op_table[KOLIBRI_STATICNUM].mouse_fn = NULL; |
kolibri_gui_op_table[KOLIBRI_STATICNUM].key_fn = NULL; |
debug_board_printf("STATICNUM (%x,%x,%x)\n", staticnum_draw,0,0); |
} |
/* Create a new main GUI window for KolibriOS */ |
/contrib/C_Layer/INCLUDE/kolibri_editbox.h |
---|
3,47 → 3,23 |
#include "kolibri_colors.h" |
/* flags meaning |
ed_figure_only= 1000000000000000b ;îäíè ñèìâîëû |
ed_always_focus= 100000000000000b |
ed_focus= 10b ;ôîêóñ ïðèëîæåíèÿ |
ed_pass= 1b ;ïîëå ñ ïàðîëåì |
ed_shift_on= 1000b ;åñëè íå óñòàíîâëåí -çíà÷èò âïåðâûå íàæàò shift,åñëè áûë óñòàíîâëåí, çíà÷èò ìû óæå ÷òî - òî äåëàëè óäåðæèâàÿ shift |
ed_shift_on_off=1111111111110111b |
ed_shift= 100b ;âêëþ÷àåòñÿ ïðè íàæàòèè íà shift ò.å. åñëè íàæèìàþ |
ed_shift_off= 1111111111111011b |
ed_shift_bac= 10000b ;áèò äëÿ î÷èñòêè âûäåëåíîãî shift ò.å. ïðè óñòàíîâêå ãîâîðèò ÷òî åñòü âûäåëåíèå |
ed_shift_bac_cl=1111111111101111b ;î÷èñòêà ïðè óäàëåíèè âûäåëåíèÿ |
ed_shift_cl= 1111111111100011b |
ed_shift_mcl= 1111111111111011b |
ed_left_fl= 100000b |
ed_right_fl= 1111111111011111b |
ed_offset_fl= 1000000b |
ed_offset_cl= 1111111110111111b |
ed_insert= 10000000b |
ed_insert_cl= 1111111101111111b |
ed_mouse_on = 100000000b |
ed_mous_adn_b= 100011000b |
ed_mouse_on_off=1111111011111111b |
*/ |
typedef struct { |
unsigned int width; |
unsigned int left; |
unsigned int top; |
unsigned int color; |
unsigned int shift_color; // selected text color |
unsigned int shift_color; |
unsigned int focus_border_color; |
unsigned int blur_border_color; |
unsigned int text_color; |
unsigned int max; |
char *text; |
unsigned int mouse_variable; // mus be int* pointer to saved mouse pos ?? |
unsigned int mouse_variable; |
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 size; |
unsigned int pos; |
unsigned int offset; |
unsigned int cl_curs_x; |
unsigned int cl_curs_y; |
109,6 → 85,5 |
extern void editbox_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; |
#endif /* KOLIBRI_EDITBOX_H */ |
/contrib/C_Layer/INCLUDE/kolibri_gui.h |
---|
13,20 → 13,13 |
#include "kolibri_gui_elements.h" |
enum KOLIBRI_GUI_EVENTS { |
KOLIBRI_EVENT_NONE = 0, /* Event queue is empty */ |
KOLIBRI_EVENT_REDRAW = 1, /* Window and window elements should be redrawn */ |
KOLIBRI_EVENT_KEY = 2, /* A key on the keyboard was pressed */ |
KOLIBRI_EVENT_BUTTON = 3, /* A button was clicked with the mouse */ |
KOLIBRI_EVENT_DESKTOP = 5, /* Desktop redraw finished */ |
KOLIBRI_EVENT_MOUSE = 6, /* Mouse activity (movement, button press) was detected */ |
KOLIBRI_EVENT_IPC = 7, /* Interprocess communication notify */ |
KOLIBRI_EVENT_NETWORK = 8, /* Network event */ |
KOLIBRI_EVENT_DEBUG = 9, /* Debug subsystem event */ |
KOLIBRI_EVENT_IRQBEGIN = 16 /* 16..31 IRQ0..IRQ15 interrupt =IRQBEGIN+IRQn */ |
KOLIBRI_EVENT_MOUSE = 6 /* Mouse activity (movement, button press) was detected */ |
}; |
#define BUTTON_CLOSE 0x1 |
#define BTN_QUIT 1 |
void kolibri_handle_event_redraw(kolibri_window* some_window) |
{ |
47,7 → 40,7 |
do |
{ |
/* The redraw_fn serves as draw_fn on initial draw */ |
if((int)kolibri_gui_op_table[current_element -> type].redraw_fn > 0) // -1 if DLL link fail |
if(kolibri_gui_op_table[current_element -> type].redraw_fn) |
kolibri_gui_op_table[current_element -> type].redraw_fn(current_element -> element); |
//sie after fixing calling conventions no more needed |
79,7 → 72,7 |
do |
{ |
/* Only execute if the function pointer isn't NULL */ |
if((int)kolibri_gui_op_table[current_element -> type].key_fn > 0) |
if(kolibri_gui_op_table[current_element -> type].key_fn) |
kolibri_gui_op_table[current_element -> type].key_fn(current_element -> element); |
current_element = current_element -> next; |
96,7 → 89,7 |
do |
{ |
if((int)kolibri_gui_op_table[current_element -> type].mouse_fn > 0) |
if(kolibri_gui_op_table[current_element -> type].mouse_fn) |
kolibri_gui_op_table[current_element -> type].mouse_fn(current_element -> element); |
current_element = current_element -> next; |
/contrib/C_Layer/INCLUDE/kolibri_progressbar.h |
---|
1,7 → 1,7 |
#ifndef KOLIBRI_PROGRESSBAR_H |
#define KOLIBRI_PROGRESSBAR_H |
typedef struct { |
struct progress_bar { |
unsigned int value; |
unsigned int left; |
unsigned int top; |
13,11 → 13,11 |
unsigned int back_color; |
unsigned int progress_color; |
unsigned int frame_color; |
} progressbar; |
}; |
progressbar* kolibri_new_progressbar(unsigned int min_value, unsigned int max_value, unsigned int cur_value, unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey) |
struct progress_bar* kolibri_new_progress_bar(unsigned int min_value, unsigned int max_value, unsigned int cur_value, unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey) |
{ |
progressbar *new_progressbar = (progressbar*)malloc(sizeof(progressbar)); |
struct progress_bar *new_progressbar = (struct progress_bar *)malloc(sizeof(struct progress_bar)); |
new_progressbar -> value = cur_value; |
new_progressbar -> left = tlx; |
27,13 → 27,13 |
new_progressbar -> style = 1; |
new_progressbar -> min = min_value; |
new_progressbar -> max = max_value; |
new_progressbar -> back_color = 0xffffff; // white |
new_progressbar -> progress_color = 0x00ff00; // green |
new_progressbar -> frame_color = 0x000000; // black |
new_progressbar -> back_color = 0xffffff; |
new_progressbar -> progress_color = 0x00ff00; |
new_progressbar -> frame_color = 0x000000; |
return new_progressbar; |
} |
extern void (*progressbar_draw)(progressbar *) __attribute__((__stdcall__)); |
extern void (*progressbar_progress)(progressbar *) __attribute__((__stdcall__)); |
extern void (*progressbar_draw)(struct progress_bar *) __attribute__((__stdcall__)); |
extern void (*progressbar_progress)(struct progress_bar *) __attribute__((__stdcall__)); |
#endif /* KOLIBRI_PROGRESSBAR_H */ |