C_Layer: fixed some headers and code so that examples can build also with >= c99
git-svn-id: svn://kolibrios.org@8581 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d5cfdf6d55
commit
10b3ae76ba
@ -8,7 +8,7 @@ CLAYER = $(abspath ../../)
|
||||
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
|
||||
--image-base 0
|
||||
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99
|
||||
|
||||
INCLUDES = -I. -I$(SDK_DIR)/sources/newlib/libc/include
|
||||
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
|
||||
@ -29,4 +29,4 @@ $(NAME): $(OBJECTS) Makefile
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.map
|
||||
-rm -f *.o *.map $(NAME)
|
||||
|
@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
|
||||
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
|
||||
--image-base 0
|
||||
|
||||
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32
|
||||
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -std=c99
|
||||
|
||||
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
|
||||
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
|
||||
@ -17,9 +17,9 @@ OBJPATH = $(CLAYER)/OBJ
|
||||
|
||||
all:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(SOURCES) main.c
|
||||
$(LD) $(LIBPATH) $(LDFLAGS) --subsystem native main.o $(OBJPATH)/loadlibimg.obj -o $(NAME) -lgcc -lc.dll
|
||||
$(LD) $(LIBPATH) $(LDFLAGS) --subsystem native main.o $(OBJPATH)/loadlibimg.obj $(OBJPATH)/loadboxlib.obj -o $(NAME) -lgcc -lc.dll
|
||||
strip -S $(NAME)
|
||||
objcopy $(NAME) -O binary
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
-rm -f *.o $(NAME)
|
||||
|
@ -3,8 +3,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <kolibri_libimg.h>
|
||||
#include <kos32sys.h>
|
||||
#include <kolibri_gui.h>
|
||||
#include <kolibri_libimg.h>
|
||||
|
||||
#define NEW_IMG_H 128
|
||||
#define NEW_IMG_W 128
|
||||
|
@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
|
||||
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
|
||||
--image-base 0 -lgcc -ldll -lc.dll
|
||||
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=gnu90
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99
|
||||
|
||||
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
|
||||
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
|
||||
@ -29,4 +29,4 @@ $(NAME): $(OBJECTS) Makefile
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.map
|
||||
-rm -f *.o *.map $(NAME)
|
||||
|
@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
|
||||
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app-dynamic.lds \
|
||||
--image-base 0 -lgcc -ldll -lc.dll
|
||||
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=gnu90 -mno-ms-bitfields
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99 -mno-ms-bitfields
|
||||
|
||||
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
|
||||
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
|
||||
@ -47,4 +47,4 @@ dbutton_files: dbutton_files.o
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
-rm -f *.o boardmsg boardmsg.map dbutton_files editor_tree_msgbox editor_tree_msgbox.map option_menu scroll_progress
|
||||
|
@ -22,6 +22,14 @@
|
||||
#include "kolibri_libimg.h"
|
||||
#include "kolibri_msgbox.h"
|
||||
|
||||
/*extern inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
|
||||
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color);
|
||||
|
||||
extern inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
|
||||
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color);
|
||||
|
||||
extern inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position);
|
||||
*/
|
||||
char run_path[4096];
|
||||
char fname[4096];
|
||||
|
||||
@ -37,13 +45,13 @@ void set_os_keyb_mode(int mode)
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/* Load all libraries, initialize global tables like system color table and
|
||||
operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails
|
||||
to do it's job. This is all you need to call and all libraries and GUI
|
||||
elements can be used after a successful call to this function
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/* Load all libraries, initialize global tables like system color table and
|
||||
operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails
|
||||
to do it's job. This is all you need to call and all libraries and GUI
|
||||
elements can be used after a successful call to this function
|
||||
*/
|
||||
kolibri_gui_init();
|
||||
set_os_keyb_mode(1); // scan code mode needed for editor
|
||||
// kolibri_proclib_init(); // opensave && color dialogs
|
||||
@ -78,22 +86,22 @@ int main(int argc, char **argv)
|
||||
//adding sample text @cursor
|
||||
char *sampletext = "*123*=========ADDED SAMPLE TEXT=========*789*\n";
|
||||
(*ted_text_add)(ed, sampletext, strlen(sampletext), 0);
|
||||
|
||||
|
||||
// treelist as tree
|
||||
treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, /*TL_KEY_NO_EDIT |*/ TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff);
|
||||
(*tl_data_init)(tl);
|
||||
|
||||
// ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
strcpy(fname, run_path);
|
||||
strcat(fname, "tl_sys_16.png");
|
||||
tl->data_img_sys = load_image_file(fname);
|
||||
|
||||
// ÷èòàåì ôàéë ñ èêîíêàìè óçëîâ
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
strcpy(fname, run_path);
|
||||
strcat(fname, "tl_nod_16.png");
|
||||
tl->data_img = load_image_file(fname);
|
||||
|
||||
treelist_node_add(tl, "node1", 1, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé
|
||||
treelist_node_add(tl, "node1", 1, 0, 0); // <EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
(*tl_cur_next)(tl);
|
||||
treelist_node_add(tl, "node1.1", 1, 0, 1);
|
||||
(*tl_cur_next)(tl);
|
||||
@ -110,7 +118,7 @@ int main(int argc, char **argv)
|
||||
treelist_node_add(tl, "node3", 1, 0, 0);
|
||||
(*tl_cur_next)(tl);
|
||||
|
||||
(*tl_cur_beg)(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
|
||||
(*tl_cur_beg)(tl); //;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
gui_add_treelist(main_window, tl);
|
||||
|
||||
// treelist as listbox, no caption, no icons
|
||||
@ -121,7 +129,7 @@ int main(int argc, char **argv)
|
||||
tl2->data_img_sys = tl->data_img_sys;
|
||||
//tl2->data_img = tl->data_img; - no icons will be drawed
|
||||
|
||||
treelist_node_add(tl2, "list1", 0, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé
|
||||
treelist_node_add(tl2, "list1", 0, 0, 0); // <EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
(*tl_cur_next)(tl2);
|
||||
|
||||
treelist_node_add(tl2, "list2", 0, 0, 0);
|
||||
@ -130,13 +138,13 @@ int main(int argc, char **argv)
|
||||
treelist_node_add(tl2, "list3", 0, 0, 0);
|
||||
(*tl_cur_next)(tl2);
|
||||
|
||||
(*tl_cur_beg)(tl2); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
|
||||
(*tl_cur_beg)(tl2); //;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
gui_add_treelist(main_window, tl2);
|
||||
|
||||
msgbox* box = kolibri_new_msgbox("Exit", "Are\rYOU\rSure?", 3, "YES", "Absolute", "Not Yet", NULL); // default NOT
|
||||
|
||||
oskey_t key;
|
||||
do /* Start of main activity loop */
|
||||
do /* Start of main activity loop */
|
||||
{
|
||||
switch(gui_event)
|
||||
{
|
||||
@ -163,22 +171,22 @@ int main(int argc, char **argv)
|
||||
kolibri_handle_event_key(main_window, key);
|
||||
break;
|
||||
case KOLIBRI_EVENT_BUTTON:
|
||||
pressed_button = get_os_button();
|
||||
switch (pressed_button)
|
||||
{
|
||||
pressed_button = get_os_button();
|
||||
switch (pressed_button)
|
||||
{
|
||||
case BTN_QUIT:
|
||||
if (box->retval == 3 || box->retval == 0) // not started or cancelled, analyze when redraw after closing msgbox
|
||||
kolibri_start_msgbox(box, NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case KOLIBRI_EVENT_MOUSE:
|
||||
kolibri_handle_event_mouse(main_window);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
gui_event = get_os_event();
|
||||
} while(1) ; /* End of main activity loop */
|
||||
} while(1) ; /* End of main activity loop */
|
||||
|
||||
clearing:
|
||||
trap(0x55); // for stop in debug
|
||||
@ -190,10 +198,10 @@ trap(0x55); // for stop in debug
|
||||
|
||||
|
||||
editor_delete(ed);
|
||||
treelist_data_clear(tl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
treelist_data_clear(tl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char* load_file_inmem(char* fname, int32_t* read_sz)
|
||||
@ -230,14 +238,14 @@ char* load_image_file(char* fname)
|
||||
char *image_data = 0, *image_data_rgb = 0, *filedata = 0;
|
||||
|
||||
filedata = load_file_inmem(fname, &read_bytes);
|
||||
// îïðåäåëÿåì âèä èçîáðàæåíèÿ è ïåðåâîäèì åãî âî âðåìåííûé áóôåð image_data
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> image_data
|
||||
image_data = (*img_decode)(filedata, read_bytes, 0);
|
||||
w = *(int*)(image_data +4);
|
||||
h = *(int*)(image_data +8);
|
||||
image_data_rgb = malloc(w * h * 3);
|
||||
// ïðåîáðàçóåì èçîáðàæåíèå ê ôîðìàòó rgb
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rgb
|
||||
(*img_to_rgb2)(image_data, image_data_rgb);
|
||||
// óäàëÿåì âðåìåííûé áóôåð image_data
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> image_data
|
||||
(*img_destroy)(image_data);
|
||||
free(filedata);
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#define SCAN_CODE_ALTM 50
|
||||
#define SCAN_CODE_ALTE 18
|
||||
inline
|
||||
uint32_t get_os_keyb_modifiers()
|
||||
|
||||
static inline uint32_t get_os_keyb_modifiers()
|
||||
{
|
||||
register uint32_t val;
|
||||
__asm__ __volatile__(
|
||||
@ -43,8 +43,7 @@ uint32_t get_os_keyb_modifiers()
|
||||
#define KEY_LWIN 0x200
|
||||
#define KEY_RWIN 0x400
|
||||
|
||||
inline
|
||||
void set_os_keyb_mode(int mode)
|
||||
static inline void set_os_keyb_mode(int mode)
|
||||
// 0 - ASCII, 1 - SCAN
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
@ -52,14 +51,14 @@ void set_os_keyb_mode(int mode)
|
||||
::"a"(66), "b"(1), "c"(mode));
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Load all libraries, initialize global tables like system color table and
|
||||
operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails
|
||||
to do it's job. This is all you need to call and all libraries and GUI
|
||||
elements can be used after a successful call to this function
|
||||
*/
|
||||
kolibri_gui_init();
|
||||
int main()
|
||||
{
|
||||
/* Load all libraries, initialize global tables like system color table and
|
||||
operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails
|
||||
to do it's job. This is all you need to call and all libraries and GUI
|
||||
elements can be used after a successful call to this function
|
||||
*/
|
||||
kolibri_gui_init();
|
||||
int gui_event = KOLIBRI_EVENT_REDRAW;
|
||||
uint32_t pressed_button = 0;
|
||||
// uint32_t mouse_button;
|
||||
@ -68,18 +67,18 @@ int main()
|
||||
|
||||
|
||||
// creating GUI using library functions
|
||||
kolibri_window *main_window = kolibri_new_window(50, 40, 400, 160, "OptionBox and Menu demo");
|
||||
kolibri_window *main_window = kolibri_new_window(50, 40, 400, 160, "OptionBox and Menu demo");
|
||||
//check_box *checkbox = kolibri_new_check_box(20, 45, 12, 12, "Append BOARDMSG to entered message.");
|
||||
|
||||
option_box opts1[3];
|
||||
option_box *option1sel = opts1; // intially selected RED
|
||||
option_box opts1[3];
|
||||
option_box *option1sel = opts1; // intially selected RED
|
||||
|
||||
option_box *op1_1 = gui_optionbox(opts1, X_Y(20, 50), "G1 Item RED", &option1sel);
|
||||
option_box *op1_2 = gui_optionbox(opts1+1, X_Y(20, 70), "G1 Item GREEN", &option1sel);
|
||||
option_box *op1_3 = gui_optionbox(opts1+2, X_Y(20, 90), "G1 Item BLUE", &option1sel);
|
||||
option_box* option_group1[] = {op1_1, op1_2, op1_3, NULL};
|
||||
|
||||
option_box opts2[3];
|
||||
option_box opts2[3];
|
||||
option_box *option2sel = opts2 + 1; // intially selected #2
|
||||
option_box *op2_1 = gui_optionbox(&opts2[0], X_Y(140, 50), "G2 Item 1st", &option2sel);
|
||||
option_box *op2_2 = gui_optionbox(&opts2[1], X_Y(140, 70), "G2 Item 2nd", &option2sel);
|
||||
@ -89,17 +88,17 @@ int main()
|
||||
frame *fr1 = kolibri_new_frame_def(X_Y(12, 110), X_Y(40, 70), "Option 1");
|
||||
frame *fr2 = kolibri_new_frame_def(X_Y(132, 100), X_Y(40, 70), "Option 2");
|
||||
|
||||
gui_add_optiongroup(main_window, option_group1); // new syntax
|
||||
gui_add_optiongroup(main_window, option_group2);
|
||||
gui_add_frame(main_window, fr1);
|
||||
gui_add_frame(main_window, fr2);
|
||||
gui_add_optiongroup(main_window, option_group1); // new syntax
|
||||
gui_add_optiongroup(main_window, option_group2);
|
||||
gui_add_frame(main_window, fr1);
|
||||
gui_add_frame(main_window, fr2);
|
||||
|
||||
int option_index1 = 0; // index of selected option
|
||||
int option_index2 = 0;
|
||||
|
||||
char *menu1stru[] = {"Menu1", "Set RED", "Set GREEN", "Set BLUE", NULL};
|
||||
menubar* menu1 = kolibri_new_menubar_def(X_Y(10, 40), X_Y(5, 15), 80, 100, menu1stru);
|
||||
gui_add_menubar(main_window, menu1);
|
||||
gui_add_menubar(main_window, menu1);
|
||||
|
||||
char *menu2stru[] = {"mEnu2", "Set Option 1", "Set Option 2", "Set Option 3", NULL};
|
||||
menubar* menu2 = kolibri_new_menubar_def(X_Y(50, 40), X_Y(5, 15), 80, 100, menu2stru);
|
||||
@ -107,7 +106,7 @@ int main()
|
||||
|
||||
char *menu3stru[] = {"Quit", NULL};
|
||||
menubar* menu3 = kolibri_new_menubar_def(X_Y(90, 40), X_Y(5, 15), 0, 0, menu3stru);
|
||||
menu3->type = 1; // no subitems
|
||||
menu3->type = 1; // no subitems
|
||||
gui_add_menubar(main_window, menu3);
|
||||
|
||||
|
||||
@ -115,7 +114,7 @@ int main()
|
||||
set_os_keyb_mode(1); // needed for keyboard use in menu
|
||||
|
||||
|
||||
do /* Start of main activity loop */
|
||||
do /* Start of main activity loop */
|
||||
{
|
||||
if(option_index1 != option1sel - opts1)
|
||||
debug_board_printf("Option1 change to %d\n", option1sel - opts1);
|
||||
@ -138,17 +137,17 @@ int main()
|
||||
|
||||
if(keypress.code == SCAN_CODE_ALTM && get_os_keyb_modifiers() & (KEY_LALT | KEY_RALT))
|
||||
(*menu_bar_activate)(menu1); // wont work, immediately redraw command closes menu ( . but Alt+F1 worked in opendial.asm:463
|
||||
|
||||
|
||||
break;
|
||||
case KOLIBRI_EVENT_BUTTON:
|
||||
pressed_button = get_os_button();
|
||||
switch (pressed_button)
|
||||
{
|
||||
case BTN_QUIT:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
pressed_button = get_os_button();
|
||||
switch (pressed_button)
|
||||
{
|
||||
case BTN_QUIT:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case KOLIBRI_EVENT_MOUSE:
|
||||
// mouse_pos = get_mouse_pos(POS_WINDOW); // window relative
|
||||
// mouse_button = get_mouse_eventstate();
|
||||
@ -167,13 +166,13 @@ int main()
|
||||
{
|
||||
return 0; // quit
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
gui_event = get_os_event();
|
||||
} while(1) ; /* End of main activity loop */
|
||||
|
||||
return 0;
|
||||
}
|
||||
} while(1) ; /* End of main activity loop */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
|
||||
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
|
||||
--image-base 0 -lgcc -ldll -lc.dll
|
||||
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__
|
||||
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99
|
||||
|
||||
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
|
||||
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
|
||||
@ -29,4 +29,4 @@ $(NAME): $(OBJECTS) Makefile
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
-rm -f *.o $(NAME)
|
||||
|
@ -5,22 +5,22 @@ 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;
|
||||
|
||||
|
||||
inline pict_button* kolibri_pict_button(pict_button* b, uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line)
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
static inline pict_button* kolibri_pict_button(pict_button* b, uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line)
|
||||
{
|
||||
b->type = b->mouse_pos = b->mouse_keys = b->mouse_keys_old = b->select = b->click = 0;
|
||||
b->x_w = x_w;
|
||||
b->y_h = y_h;
|
||||
@ -30,20 +30,20 @@ inline pict_button* kolibri_pict_button(pict_button* b, uint32_t x_w, uint32_t y
|
||||
b->resolution_raw = bpp;
|
||||
b->palette_raw = palette;
|
||||
b->offset_raw = offset_line;
|
||||
|
||||
return b;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
inline pict_button* kolibri_new_pict_button(uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line)
|
||||
static inline pict_button* kolibri_new_pict_button(uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line)
|
||||
{
|
||||
pict_button *new_d_but = (pict_button *)malloc(sizeof(pict_button));
|
||||
return kolibri_pict_button(new_d_but, x_w, y_h, active_pict, passive_pict, pressed_pict, bpp, palette, offset_line);
|
||||
}
|
||||
|
||||
inline void gui_add_pict_button(kolibri_window *wnd, pict_button* db)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void gui_add_pict_button(kolibri_window *wnd, pict_button* db)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_D_BUTTON, db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void (*dynamic_button_draw)(pict_button *) __attribute__((__stdcall__));
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef KOLIBRI_FILEBROWSE_H
|
||||
#define KOLIBRI_FILEBROWSE_H
|
||||
#ifndef KOLIBRI_FILEBROWSE_H
|
||||
#define KOLIBRI_FILEBROWSE_H
|
||||
|
||||
struct __attribute__ ((__packed__)) fs_dirinfo {
|
||||
uint32_t subfn; // 1 read dir
|
||||
@ -91,14 +91,14 @@ struct fsBDFE_16 {
|
||||
wchar_t fname[260];
|
||||
}; // must be sized 560
|
||||
|
||||
|
||||
typedef struct __attribute__ ((__packed__)) {
|
||||
uint32_t type; // unused
|
||||
uint32_t x_w; // 10, 400
|
||||
|
||||
typedef struct __attribute__ ((__packed__)) {
|
||||
uint32_t type; // unused
|
||||
uint32_t x_w; // 10, 400
|
||||
uint32_t y_h; // 45, 550
|
||||
uint32_t icon_size_xy; // x_y (16, 16)
|
||||
uint32_t icon_size_xy; // x_y (16, 16)
|
||||
uint16_t line_size_x; // not used
|
||||
uint16_t line_size_y; // 18 or 17 - âûñîòà ëèíèè - ñòðîêè ñ ôàéëîì
|
||||
uint16_t line_size_y; // 18 or 17 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t type_size_x; // not used
|
||||
uint16_t size_size_x; // not used
|
||||
uint16_t date_size_x; // not used
|
||||
@ -110,17 +110,17 @@ typedef struct __attribute__ ((__packed__)) {
|
||||
uint32_t directory_path_area; // not used
|
||||
uint32_t file_name_area; // not used
|
||||
uint32_t select_flag; // widget have focus, set auto on mouseclick, but need to reset before mouse()
|
||||
color_t background_color; // self explained, 0xffffff
|
||||
color_t select_color; // self explained, 0xbbddff
|
||||
color_t background_color; // self explained, 0xffffff
|
||||
color_t select_color; // self explained, 0xbbddff
|
||||
color_t select_text_color; // self explained - have a bug - never really used
|
||||
color_t text_color; // self explained
|
||||
color_t reduct_text_color; // 0xff0000 - spec color for cutted filenames
|
||||
color_t marked_text_color; // not used
|
||||
uint32_t max_panel_line; // moved to scrollbar->cur_area, - ìàêñèìàëüíîå ÷èñëî ñòðîê â îêíå, àâòîðàñ÷èòûâàåòñÿ
|
||||
uint32_t select_panel_counter; // !=0 if want to draw multiselection ???
|
||||
uint32_t folder_block; // auto formed, êîëè÷åñòâî áëîêîâ äàííûõ âõîäà êàòàëîãà (ÁÄÂÊ) ????? format BDVK == bdfe,, // moved to scrollbar->max_area
|
||||
uint32_t start_draw_line; // internal - top showed file n. moved to scrollbar->position and back
|
||||
uint16_t start_draw_cursor_line; //internal
|
||||
uint32_t max_panel_line; // moved to scrollbar->cur_area, - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t select_panel_counter; // !=0 if want to draw multiselection ???
|
||||
uint32_t folder_block; // auto formed, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>) ????? format BDVK == bdfe,, // moved to scrollbar->max_area
|
||||
uint32_t start_draw_line; // internal - top showed file n. moved to scrollbar->position and back
|
||||
uint16_t start_draw_cursor_line; //internal
|
||||
void* folder_data; // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte
|
||||
uint32_t temp_counter; //internal
|
||||
uint32_t file_name_length; //internal
|
||||
@ -150,8 +150,8 @@ typedef struct __attribute__ ((__packed__)) {
|
||||
uint32_t mouse_pos_old; // saved internal
|
||||
uint32_t marked_counter; // number of marked files
|
||||
char* keymap_pointer; // keyboard layout map
|
||||
|
||||
} filebrowser;
|
||||
|
||||
} filebrowser;
|
||||
|
||||
static inline filebrowser* kolibri_filebrowser(filebrowser* fb, uint32_t x_w, uint32_t y_h, uint32_t font_size_xy, uint32_t icon_size_xy, void* icon_raw_area, void* icon_palette_raw, uint32_t icon_res,
|
||||
char* ini_file_start, char* ini_file_end,
|
||||
@ -162,7 +162,7 @@ static inline filebrowser* kolibri_filebrowser(filebrowser* fb, uint32_t x_w, ui
|
||||
static char type_table[128] = "<DIR> 1023b 00.00.00 00:00 temp1.asm";
|
||||
|
||||
memset(fb, 0, sizeof(filebrowser));
|
||||
fb->x_w = x_w;
|
||||
fb->x_w = x_w;
|
||||
fb->y_h = y_h;
|
||||
fb->font_size_xy = font_size_xy;
|
||||
|
||||
@ -171,7 +171,7 @@ static inline filebrowser* kolibri_filebrowser(filebrowser* fb, uint32_t x_w, ui
|
||||
fb->icon_palette_raw = icon_palette_raw;
|
||||
fb->icon_resolution_raw = icon_res;
|
||||
|
||||
fb->line_size_y = (icon_size_xy & 0xFFFF) + 2;
|
||||
fb->line_size_y = (icon_size_xy & 0xFFFF) + 2;
|
||||
|
||||
// constants
|
||||
fb->type_table = type_table;
|
||||
@ -181,8 +181,8 @@ static inline filebrowser* kolibri_filebrowser(filebrowser* fb, uint32_t x_w, ui
|
||||
fb->keymap_pointer = keymap_area;
|
||||
|
||||
// careful - font sizes may be encoded in colors as SysFn4
|
||||
fb->background_color = bgcolor; // self explained, 0xffffff
|
||||
fb->select_color = bk_select; // self explained, 0xbbddff
|
||||
fb->background_color = bgcolor; // self explained, 0xffffff
|
||||
fb->select_color = bk_select; // self explained, 0xbbddff
|
||||
fb->select_text_color = font_select; // self explained
|
||||
fb->text_color = font_color; // self explained
|
||||
fb->reduct_text_color = reduct_color; // 0xff0000 - spec color for cutted filenames
|
||||
@ -193,15 +193,15 @@ static inline filebrowser* kolibri_filebrowser(filebrowser* fb, uint32_t x_w, ui
|
||||
void* folder_data; // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte
|
||||
*/
|
||||
return fb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static inline filebrowser* kolibri_new_filebrowser(uint32_t x_w, uint32_t y_h, uint32_t font_size_xy, uint32_t icon_size_xy, void* icon_raw_area, void* icon_palette_raw, uint32_t icon_bpp,
|
||||
char* ini_file_start, char* ini_file_end,
|
||||
color_t font_select, color_t bk_select, color_t font_color, color_t bgcolor, color_t reduct_color)
|
||||
{
|
||||
filebrowser *new_fb = (filebrowser *)malloc(sizeof(filebrowser));
|
||||
{
|
||||
filebrowser *new_fb = (filebrowser *)malloc(sizeof(filebrowser));
|
||||
return kolibri_filebrowser(new_fb, x_w, y_h, font_size_xy, icon_size_xy, icon_raw_area, icon_palette_raw, icon_bpp, ini_file_start, ini_file_end,
|
||||
font_select, bk_select, font_color, bgcolor, reduct_color);
|
||||
font_select, bk_select, font_color, bgcolor, reduct_color);
|
||||
}
|
||||
|
||||
/* loading files leads to link functions even if no using filebrowser
|
||||
@ -213,18 +213,18 @@ inline filebrowser* kolibri_filebrowser_def(filebrowser* fb, uint32_t x_w, uint3
|
||||
|
||||
return kolibri_filebrowser(fb, x_w, y_h, X_Y(9, 16), X_Y(16, 16), icon_raw_area, icon_palette_raw, icon_res,
|
||||
ini_file_start, ini_file_end,
|
||||
0x000000, 0xbbddff, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0xff0000);
|
||||
0x000000, 0xbbddff, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0xff0000);
|
||||
}
|
||||
*/
|
||||
|
||||
inline void gui_add_filebrowser(kolibri_window *wnd, filebrowser* f)
|
||||
static inline void gui_add_filebrowser(kolibri_window *wnd, filebrowser* f)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_FILEBROWSE, f);
|
||||
kolibri_window_add_element(wnd, KOLIBRI_FILEBROWSE, f);
|
||||
}
|
||||
|
||||
extern void (*filebrowse_draw)(filebrowser *) __attribute__((__stdcall__));
|
||||
extern void (*filebrowse_key)(filebrowser *) __attribute__((__stdcall__));
|
||||
extern void (*filebrowse_mouse)(filebrowser *) __attribute__((__stdcall__));
|
||||
extern void (*filebrowse_draw)(filebrowser *) __attribute__((__stdcall__));
|
||||
extern void (*filebrowse_key)(filebrowser *) __attribute__((__stdcall__));
|
||||
extern void (*filebrowse_mouse)(filebrowser *) __attribute__((__stdcall__));
|
||||
|
||||
__attribute__((__stdcall__)) static inline void filebrowser_key(filebrowser *fb, oskey_t keypress)
|
||||
/// wrapper for key, translate keypress (ASCII mode) to action for browser
|
||||
@ -273,5 +273,5 @@ __attribute__((__stdcall__)) static inline void filebrowser_key(filebrowser *fb,
|
||||
(*filebrowse_key)(fb);
|
||||
}
|
||||
|
||||
|
||||
#endif /* KOLIBRI_FILEBROWSE_H */
|
||||
|
||||
#endif /* KOLIBRI_FILEBROWSE_H */
|
||||
|
@ -5,22 +5,22 @@ enum fr_text_position_t {
|
||||
FR_TOP,
|
||||
FR_BOTTON
|
||||
};
|
||||
|
||||
/*
|
||||
; FR_FLAGS = [x][yyy][z]
|
||||
; z - Caption
|
||||
; yyy - BorderStyle
|
||||
; x - BackStyle
|
||||
*/
|
||||
|
||||
/*
|
||||
; FR_FLAGS = [x][yyy][z]
|
||||
; z - Caption
|
||||
; yyy - BorderStyle
|
||||
; x - BackStyle
|
||||
*/
|
||||
enum fr_flags_t {
|
||||
FR_CAPTION = 1, // if text != null set auto
|
||||
FR_DOUBLE = 0, // default
|
||||
FR_RAISED = 2,
|
||||
FR_SUNKEN = 4,
|
||||
FR_ETCHED = 6,
|
||||
FR_RINGED = 8,
|
||||
FR_FILLED = 0x10
|
||||
};
|
||||
FR_CAPTION = 1, // if text != null set auto
|
||||
FR_DOUBLE = 0, // default
|
||||
FR_RAISED = 2,
|
||||
FR_SUNKEN = 4,
|
||||
FR_ETCHED = 6,
|
||||
FR_RINGED = 8,
|
||||
FR_FILLED = 0x10
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
@ -36,49 +36,49 @@ typedef struct {
|
||||
color_t font_color;
|
||||
color_t font_bg_color;
|
||||
}frame;
|
||||
|
||||
inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
|
||||
color_t font_color, color_t font_bgcolor, enum fr_flags_t flags)
|
||||
{
|
||||
|
||||
static inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
|
||||
color_t font_color, color_t font_bgcolor, enum fr_flags_t flags)
|
||||
{
|
||||
f->type = 0;
|
||||
f->x_w = x_w;
|
||||
f->y_h = y_h;
|
||||
f->ext_col = ext_col;
|
||||
f->int_col = int_col;
|
||||
f->flags = flags;
|
||||
if (text) f->flags |= FR_CAPTION;
|
||||
if (text) f->flags |= FR_CAPTION;
|
||||
f->text_pointer = text;
|
||||
f->text_position = text_position;
|
||||
f->font_number = 0; // 0 == font 6x9, 1==8x16
|
||||
f->font_size_y = 9;
|
||||
f->font_color = font_color | 0x80000000;
|
||||
f->font_bg_color = font_bgcolor;
|
||||
|
||||
|
||||
return f;
|
||||
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
|
||||
static inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
|
||||
color_t font_color, color_t font_bgcolor, enum fr_flags_t flags)
|
||||
{
|
||||
frame *new_frame = (frame *)malloc(sizeof(frame));
|
||||
return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags);
|
||||
}
|
||||
|
||||
inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text)
|
||||
{
|
||||
return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
|
||||
}
|
||||
|
||||
inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text)
|
||||
{
|
||||
return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
|
||||
}
|
||||
|
||||
inline void gui_add_frame(kolibri_window *wnd, frame* f)
|
||||
{
|
||||
}
|
||||
|
||||
static inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text)
|
||||
{
|
||||
return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
|
||||
}
|
||||
|
||||
static inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text)
|
||||
{
|
||||
return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
|
||||
}
|
||||
|
||||
static inline void gui_add_frame(kolibri_window *wnd, frame* f)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_FRAME, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void (*frame_draw)(frame *) __attribute__((__stdcall__));
|
||||
|
@ -117,8 +117,9 @@ extern Image* (*img_convert)(Image *src, Image *dst, uint32_t dst_type, uint32
|
||||
extern Image* (*img_resize_data)(Image *src, uint32_t width, uint32_t height) _stdcall;
|
||||
extern Image* (*img_scale)(Image* src, uint32_t crop_x, uint32_t crop_y, uint32_t crop_width, uint32_t crop_height, Image* dst, uint32_t scale_type, uint32_t inter, uint32_t new_width, uint32_t new_height) _stdcall;
|
||||
|
||||
void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color){
|
||||
for (uint32_t i = 0; i < width*height; i++) {
|
||||
void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color) {
|
||||
uint32_t i;
|
||||
for (i = 0; i < width*height; i++) {
|
||||
img->Data[i] = color;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef KOLIBRI_MENUBAR_H
|
||||
#define KOLIBRI_MENUBAR_H
|
||||
|
||||
#ifndef KOLIBRI_MENUBAR_H
|
||||
#define KOLIBRI_MENUBAR_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t type; // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò
|
||||
uint32_t type; // 1 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
uint32_t x_w; // âåðõíèé ïóíêò
|
||||
uint32_t x_w; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t y_h;
|
||||
|
||||
char* text_pointer;
|
||||
@ -14,12 +14,12 @@ typedef struct
|
||||
uint32_t mouse_pos;
|
||||
uint32_t mouse_keys;
|
||||
|
||||
uint32_t x_w1; // ïîäìåíþ
|
||||
uint32_t x_w1; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t y_h1;
|
||||
|
||||
color_t bckg_col; // ôîí âåðõíåãî ïóêòà
|
||||
color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà
|
||||
color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû)
|
||||
color_t bckg_col; // <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
color_t frnt_col; // <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
color_t menu_col; // <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
uint32_t select;
|
||||
uint32_t out_select;
|
||||
char* buf_adress;
|
||||
@ -30,23 +30,23 @@ typedef struct
|
||||
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; // öâåò øðèôòà âûáðàííîãî ïóíêòà
|
||||
color_t menu_sel_col; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
color_t bckg_text_col; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
color_t frnt_text_col; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t mouse_keys_old;
|
||||
uint32_t font_height;
|
||||
uint32_t cursor_out;
|
||||
uint32_t get_mouse_flag;
|
||||
} menubar;
|
||||
|
||||
|
||||
|
||||
static inline menubar* kolibri_menubar(menubar* bar, uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext,
|
||||
color_t sel_font, color_t unsel_font, color_t top_bg, color_t top_select, color_t sub_bg, color_t sub_select)
|
||||
{
|
||||
static char procinfo[1024];
|
||||
memset(bar, 0, sizeof(menubar));
|
||||
bar->type = 0;
|
||||
bar->x_w = x_w;
|
||||
bar->type = 0;
|
||||
bar->x_w = x_w;
|
||||
bar->y_h = y_h;
|
||||
|
||||
// count summary length
|
||||
@ -54,7 +54,7 @@ static inline menubar* kolibri_menubar(menubar* bar, uint32_t x_w, uint32_t y_h,
|
||||
int len = 0;
|
||||
for(mitem = menutext; *mitem; mitem++) len += strlen(*mitem) + 1;
|
||||
|
||||
// copy menu items in needed format
|
||||
// copy menu items in needed format
|
||||
bar->text_pointer = malloc(len + 1); // need to be freed manual at closing secondary windows with menu
|
||||
for (pc = bar->text_pointer, mitem = menutext; *mitem; pc += strlen(*mitem++) + 1)
|
||||
strcpy(pc, *mitem);
|
||||
@ -65,8 +65,8 @@ static inline menubar* kolibri_menubar(menubar* bar, uint32_t x_w, uint32_t y_h,
|
||||
bar->x_w1 = X_Y(x_w >> 16, sub_w);
|
||||
bar->y_h1 = X_Y((y_h >> 16) + (y_h & 0xFFFF), sub_h);
|
||||
|
||||
bar->interval = 16;
|
||||
bar->font_height = 8;
|
||||
bar->interval = 16;
|
||||
bar->font_height = 8;
|
||||
|
||||
bar->bckg_col = top_bg;
|
||||
bar->frnt_col = top_select;
|
||||
@ -77,37 +77,37 @@ static inline menubar* kolibri_menubar(menubar* bar, uint32_t x_w, uint32_t y_h,
|
||||
bar->procinfo = procinfo;
|
||||
|
||||
return bar;
|
||||
}
|
||||
|
||||
inline menubar* kolibri_new_menubar(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext,
|
||||
color_t sel_font, color_t unsel_font, color_t top_bg, color_t top_select, color_t sub_bg, color_t sub_select)
|
||||
{
|
||||
menubar *new_bar = (menubar*)malloc(sizeof(menubar));
|
||||
return kolibri_menubar(new_bar, x_w, y_h, sub_w, sub_h, menutext, sel_font, unsel_font, top_bg, top_select, sub_bg, sub_select);
|
||||
}
|
||||
|
||||
inline menubar* kolibri_menubar_def(menubar* bar, uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext)
|
||||
static inline menubar* kolibri_new_menubar(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext,
|
||||
color_t sel_font, color_t unsel_font, color_t top_bg, color_t top_select, color_t sub_bg, color_t sub_select)
|
||||
{
|
||||
menubar *new_bar = (menubar*)malloc(sizeof(menubar));
|
||||
return kolibri_menubar(new_bar, x_w, y_h, sub_w, sub_h, menutext, sel_font, unsel_font, top_bg, top_select, sub_bg, sub_select);
|
||||
}
|
||||
|
||||
static inline menubar* kolibri_menubar_def(menubar* bar, uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext)
|
||||
{
|
||||
return kolibri_menubar(bar, x_w, y_h, sub_w, sub_h, menutext,
|
||||
kolibri_color_table.color_work_button_text, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area,
|
||||
kolibri_color_table.color_work_button, kolibri_color_table.color_grab_bar_button, kolibri_color_table.color_work_button);
|
||||
}
|
||||
|
||||
inline menubar* kolibri_new_menubar_def(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext)
|
||||
static inline menubar* kolibri_new_menubar_def(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext)
|
||||
{
|
||||
return kolibri_new_menubar(x_w, y_h, sub_w, sub_h, menutext,
|
||||
kolibri_color_table.color_work_button_text, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area,
|
||||
kolibri_color_table.color_work_button, kolibri_color_table.color_grab_bar_button, kolibri_color_table.color_work_button);
|
||||
}
|
||||
|
||||
inline void gui_add_menubar(kolibri_window *wnd, menubar* bar)
|
||||
static inline void gui_add_menubar(kolibri_window *wnd, menubar* bar)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_MENU_BAR, bar);
|
||||
kolibri_window_add_element(wnd, KOLIBRI_MENU_BAR, bar);
|
||||
}
|
||||
|
||||
|
||||
extern void (*menu_bar_draw)(menubar *) __attribute__((__stdcall__));
|
||||
extern void (*menu_bar_mouse)(menubar *) __attribute__((__stdcall__));
|
||||
extern void (*menu_bar_activate)(menubar *) __attribute__((__stdcall__));
|
||||
|
||||
#endif /* KOLIBRI_MENUBAR_H */
|
||||
|
||||
|
||||
extern void (*menu_bar_draw)(menubar *) __attribute__((__stdcall__));
|
||||
extern void (*menu_bar_mouse)(menubar *) __attribute__((__stdcall__));
|
||||
extern void (*menu_bar_activate)(menubar *) __attribute__((__stdcall__));
|
||||
|
||||
#endif /* KOLIBRI_MENUBAR_H */
|
||||
|
@ -1,41 +1,41 @@
|
||||
#ifndef KOLIBRI_OPTIONBOX_H
|
||||
#define KOLIBRI_OPTIONBOX_H
|
||||
|
||||
#ifndef KOLIBRI_OPTIONBOX_H
|
||||
#define KOLIBRI_OPTIONBOX_H
|
||||
|
||||
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 ðàçìåð êâàäðàòà ÷åê áîêñà
|
||||
struct option_box_t **selected;
|
||||
uint16_t posx;
|
||||
uint16_t posy;
|
||||
uint32_t text_margin; // = 4 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t size; // 12 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
color_t color;
|
||||
color_t border_color; // individual border
|
||||
color_t text_color;
|
||||
char *text;
|
||||
uint32_t text_len;
|
||||
uint32_t flags;
|
||||
uint32_t text_len;
|
||||
uint32_t flags;
|
||||
}option_box;
|
||||
|
||||
extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__));
|
||||
extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__));
|
||||
extern void (*option_box_mouse)(option_box **)__attribute__((__stdcall__));
|
||||
|
||||
inline option_box* gui_optionbox(option_box* ob, uint32_t x_y, char* text, option_box**select)
|
||||
static inline option_box* gui_optionbox(option_box* ob, uint32_t x_y, char* text, option_box**select)
|
||||
{
|
||||
ob->selected = select;
|
||||
ob->posx = x_y >> 16;
|
||||
ob->posy = x_y & 0xFFFF;
|
||||
ob->text_margin = 4;
|
||||
ob->size = 12;
|
||||
ob->color = kolibri_color_table.color_work_button_text;
|
||||
ob->border_color = kolibri_color_table.color_work_button;
|
||||
ob->color = kolibri_color_table.color_work_button_text;
|
||||
ob->border_color = kolibri_color_table.color_work_button;
|
||||
ob->text_color = kolibri_color_table.color_work_text | 0x80000000;
|
||||
ob->text = text;
|
||||
ob->text_len = strlen(text);
|
||||
ob->flags = 0; // not used
|
||||
|
||||
return ob;
|
||||
}
|
||||
return ob;
|
||||
}
|
||||
|
||||
inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**select)
|
||||
static inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**select)
|
||||
{
|
||||
option_box* ob = malloc(sizeof(option_box));
|
||||
|
||||
@ -43,13 +43,13 @@ inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**selec
|
||||
}
|
||||
|
||||
#define gui_optionbox_def(a,b,c,d) gui_optionbox(a,b,c,d)
|
||||
|
||||
|
||||
#define gui_new_optionbox_def(a,b,c) gui_new_optionbox(a,b,c)
|
||||
|
||||
inline void gui_add_optiongroup(kolibri_window *wnd, option_box** option_group)
|
||||
static inline void gui_add_optiongroup(kolibri_window *wnd, option_box** option_group)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_OPTIONGROUP, option_group);
|
||||
kolibri_window_add_element(wnd, KOLIBRI_OPTIONGROUP, option_group);
|
||||
}
|
||||
|
||||
|
||||
#endif /* KOLIBRI_OPTIONBOX_H */
|
||||
|
||||
#endif /* KOLIBRI_OPTIONBOX_H */
|
||||
|
@ -5,23 +5,23 @@ typedef struct __attribute__ ((__packed__)) {
|
||||
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;
|
||||
} pathview;
|
||||
|
||||
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;
|
||||
} pathview;
|
||||
|
||||
|
||||
inline pathview* kolibri_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr)
|
||||
{
|
||||
|
||||
|
||||
static inline pathview* kolibri_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr)
|
||||
{
|
||||
p->type = p->temp_text_length = 0;
|
||||
p->x_y = x_y;
|
||||
p->font_size_x = font_number == 0 ? 6 : 8; // need correction for bigger fonts
|
||||
p->font_size_x = font_number == 0 ? 6 : 8; // need correction for bigger fonts
|
||||
p->area_size_x = width;
|
||||
p->font_number = font_number;
|
||||
p->background_flag = is_bkgr;
|
||||
@ -29,20 +29,20 @@ inline pathview* kolibri_pathview(pathview* p, uint32_t x_y, uint32_t width, uin
|
||||
p->work_area_pointer = temp_buf;
|
||||
p->font_color = font;
|
||||
p->background_color = bkgr;
|
||||
|
||||
return p;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
inline pathview* kolibri_new_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr)
|
||||
static inline pathview* kolibri_new_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr)
|
||||
{
|
||||
pathview *new_pv = (pathview *)malloc(sizeof(pathview));
|
||||
return kolibri_pathview(new_pv, x_y, width, font_number, is_bkgr, text, temp_buf, font, bkgr);
|
||||
}
|
||||
|
||||
inline void gui_add_pathview(kolibri_window *wnd, pathview* pv)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void gui_add_pathview(kolibri_window *wnd, pathview* pv)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_PATHSHOW, pv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void (*path_show_prepare)(pathview *) __attribute__((__stdcall__));
|
||||
|
@ -5,7 +5,7 @@ typedef struct __attribute__ ((__packed__)) {
|
||||
// uint16_t xsize;
|
||||
// uint16_t xpos;
|
||||
// uint16_t ysize;
|
||||
// uint16_t ypos;
|
||||
// uint16_t ypos;
|
||||
uint32_t x_w;
|
||||
uint32_t y_h;
|
||||
uint32_t btn_height;
|
||||
@ -33,12 +33,12 @@ typedef struct __attribute__ ((__packed__)) {
|
||||
uint32_t ar_offset;
|
||||
} scrollbar;
|
||||
|
||||
inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
|
||||
static inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
|
||||
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color)
|
||||
{
|
||||
memset(sb, 0, sizeof(scrollbar));
|
||||
{
|
||||
memset(sb, 0, sizeof(scrollbar));
|
||||
|
||||
sb->x_w = x_w;
|
||||
sb->x_w = x_w;
|
||||
sb->y_h = y_h;
|
||||
sb->btn_height = btn_height;
|
||||
sb->type = 1;
|
||||
@ -47,40 +47,40 @@ inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, u
|
||||
sb->position = position;
|
||||
sb->line_color = line_color;
|
||||
sb->back_color = back_color; // 0xeeeeee
|
||||
sb->front_color = front_color; // 0xbbddff
|
||||
sb->front_color = front_color; // 0xbbddff
|
||||
sb->ar_offset = max_area / 30; // temporary step 3%
|
||||
sb->all_redraw = 1;
|
||||
return sb;
|
||||
};
|
||||
|
||||
inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
|
||||
|
||||
static inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
|
||||
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color)
|
||||
{
|
||||
scrollbar *sb = (scrollbar *)malloc(sizeof(scrollbar));
|
||||
|
||||
return kolibri_scrollbar(sb, x_w, y_h, btn_height, max_area, cur_area, position, back_color, front_color, line_color);
|
||||
};
|
||||
|
||||
inline scrollbar* kolibri_scrollbar_def(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position)
|
||||
{
|
||||
return kolibri_scrollbar(sb, x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text);
|
||||
};
|
||||
|
||||
inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position)
|
||||
{
|
||||
return kolibri_new_scrollbar(x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text);
|
||||
};
|
||||
|
||||
inline void gui_add_scrollbar_h(kolibri_window *wnd, scrollbar* sb)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_H, sb);
|
||||
}
|
||||
|
||||
inline void gui_add_scrollbar_v(kolibri_window *wnd, scrollbar* sb)
|
||||
{
|
||||
return kolibri_scrollbar(sb, x_w, y_h, btn_height, max_area, cur_area, position, back_color, front_color, line_color);
|
||||
};
|
||||
|
||||
static inline scrollbar* kolibri_scrollbar_def(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position)
|
||||
{
|
||||
return kolibri_scrollbar(sb, x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text);
|
||||
};
|
||||
|
||||
static inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position)
|
||||
{
|
||||
return kolibri_new_scrollbar(x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text);
|
||||
};
|
||||
|
||||
static inline void gui_add_scrollbar_h(kolibri_window *wnd, scrollbar* sb)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_H, sb);
|
||||
}
|
||||
|
||||
static inline void gui_add_scrollbar_v(kolibri_window *wnd, scrollbar* sb)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_V, sb);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern void (*scrollbar_h_draw)(scrollbar*) __attribute__((__stdcall__));
|
||||
extern void (*scrollbar_h_mouse)(scrollbar*) __attribute__((__stdcall__));
|
||||
extern void (*scrollbar_v_draw)(scrollbar*) __attribute__((__stdcall__));
|
||||
|
@ -1,27 +1,27 @@
|
||||
#ifndef KOLIBRI_STATICTEXT_H
|
||||
#define KOLIBRI_STATICTEXT_H
|
||||
|
||||
typedef enum {
|
||||
cp866, // 6x9
|
||||
#ifndef KOLIBRI_STATICTEXT_H
|
||||
#define KOLIBRI_STATICTEXT_H
|
||||
|
||||
typedef enum {
|
||||
cp866, // 6x9
|
||||
CP866, // 8x16
|
||||
UTF16,
|
||||
UTF8
|
||||
} encoding_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t start_xy;
|
||||
char *text;
|
||||
uint32_t color_flags;
|
||||
uint32_t bg_color;
|
||||
}statictext;
|
||||
UTF8
|
||||
} encoding_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t start_xy;
|
||||
int32_t number;
|
||||
uint32_t color_flags;
|
||||
typedef struct {
|
||||
uint32_t start_xy;
|
||||
char *text;
|
||||
uint32_t color_flags;
|
||||
uint32_t bg_color;
|
||||
uint16_t width;
|
||||
}staticnum;
|
||||
}statictext;
|
||||
|
||||
typedef struct {
|
||||
uint32_t start_xy;
|
||||
int32_t number;
|
||||
uint32_t color_flags;
|
||||
uint32_t bg_color;
|
||||
uint16_t width;
|
||||
}staticnum;
|
||||
|
||||
statictext* kolibri_statictext(statictext* st, uint32_t xy, char *text, encoding_t enc, int size, color_t font, color_t bg)
|
||||
{
|
||||
@ -36,22 +36,22 @@ statictext* kolibri_statictext(statictext* st, uint32_t xy, char *text, encoding
|
||||
return st;
|
||||
}
|
||||
|
||||
statictext* kolibri_statictext_def(statictext* st, uint32_t xy, char *text)
|
||||
{
|
||||
return kolibri_statictext(st, xy, text, 0, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
|
||||
statictext* kolibri_statictext_def(statictext* st, uint32_t xy, char *text)
|
||||
{
|
||||
return kolibri_statictext(st, xy, text, 0, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
|
||||
statictext* kolibri_new_statictext(uint32_t xy, char *text, encoding_t enc, int size, color_t font, color_t bg)
|
||||
{
|
||||
statictext *st = (statictext*)malloc(sizeof(statictext));
|
||||
|
||||
return kolibri_statictext(st, xy, text, enc, size, font, bg);
|
||||
}
|
||||
return kolibri_statictext(st, xy, text, enc, size, font, bg);
|
||||
}
|
||||
|
||||
statictext* kolibri_new_statictext_def(uint32_t xy, char *text)
|
||||
{
|
||||
return kolibri_new_statictext(xy, text, 0, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
statictext* kolibri_new_statictext_def(uint32_t xy, char *text)
|
||||
{
|
||||
return kolibri_new_statictext(xy, text, 0, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
|
||||
__attribute__((__stdcall__))
|
||||
void statictext_draw(statictext *st)
|
||||
@ -64,11 +64,11 @@ void statictext_draw(statictext *st)
|
||||
"d"(st->text),
|
||||
"D"(st->bg_color)
|
||||
:);
|
||||
}
|
||||
}
|
||||
|
||||
inline void gui_add_statictext(kolibri_window *wnd, statictext* st)
|
||||
static inline void gui_add_statictext(kolibri_window *wnd, statictext* st)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_STATICTEXT, st);
|
||||
kolibri_window_add_element(wnd, KOLIBRI_STATICTEXT, st);
|
||||
}
|
||||
|
||||
|
||||
@ -87,26 +87,26 @@ staticnum* kolibri_staticnum(staticnum* st, uint32_t xy, int32_t width, int16_t
|
||||
return st;
|
||||
}
|
||||
|
||||
staticnum* kolibri_staticnum_def(staticnum* st, uint32_t xy, int16_t width, int32_t number)
|
||||
{
|
||||
return kolibri_staticnum(st, xy, width, number, 0, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
staticnum* kolibri_staticnum_def(staticnum* st, uint32_t xy, int16_t width, int32_t number)
|
||||
{
|
||||
return kolibri_staticnum(st, xy, width, number, 0, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
|
||||
staticnum* kolibri_new_staticnum(uint32_t xy, int32_t width, int32_t number, encoding_t enc, int size, color_t font, color_t bg)
|
||||
{
|
||||
staticnum *st = (staticnum*)malloc(sizeof(staticnum));
|
||||
|
||||
return kolibri_staticnum(st, xy, width, number, enc, size, font, bg);
|
||||
}
|
||||
return kolibri_staticnum(st, xy, width, number, enc, size, font, bg);
|
||||
}
|
||||
|
||||
staticnum* kolibri_new_staticnum_def(uint32_t xy, int32_t width, int32_t number)
|
||||
{
|
||||
return kolibri_new_staticnum(xy, width, number, cp866, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
|
||||
inline void gui_add_staticnum(kolibri_window *wnd, staticnum* sn)
|
||||
staticnum* kolibri_new_staticnum_def(uint32_t xy, int32_t width, int32_t number)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_STATICNUM, sn);
|
||||
return kolibri_new_staticnum(xy, width, number, cp866, 0, kolibri_color_table.color_work_text, 0);
|
||||
}
|
||||
|
||||
static inline void gui_add_staticnum(kolibri_window *wnd, staticnum* sn)
|
||||
{
|
||||
kolibri_window_add_element(wnd, KOLIBRI_STATICNUM, sn);
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ void staticnum_draw(staticnum *st)
|
||||
"S"(st->color_flags),
|
||||
"D"(st->bg_color)
|
||||
:);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* KOLIBRI_STATICTEXT_H */
|
||||
|
||||
#endif /* KOLIBRI_STATICTEXT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user