Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 8580 → Rev 8581

/contrib/C_Layer/INCLUDE/kolibri_d_button.h
5,22 → 5,22
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
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__));
/contrib/C_Layer/INCLUDE/kolibri_filebrowse.h
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
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 - ������ ����� - ������ � ������
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
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, - ������������ ����� ����� � ����, �����������������
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
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,9 → 150,9
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,
color_t font_select, color_t bk_select, color_t font_color, color_t bgcolor, color_t reduct_color)
162,7 → 162,7
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
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
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
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
 
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
(*filebrowse_key)(fb);
}
 
 
#endif /* KOLIBRI_FILEBROWSE_H */
 
#endif /* KOLIBRI_FILEBROWSE_H */
/contrib/C_Layer/INCLUDE/kolibri_frame.h
5,22 → 5,22
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,10 → 36,10
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;
46,7 → 46,7
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
53,32 → 53,32
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__));
/contrib/C_Layer/INCLUDE/kolibri_libimg.h
117,8 → 117,9
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;
}
}
/contrib/C_Layer/INCLUDE/kolibri_menubar.h
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 ���� ��� �������, ������ �����
 
uint32_t x_w; // âåðõíèé ïóíêò
uint32_t x_w; // ������� �����
uint32_t y_h;
 
char* text_pointer;
14,12 → 14,12
uint32_t mouse_pos;
uint32_t mouse_keys;
 
uint32_t x_w1; // ïîäìåíþ
uint32_t x_w1; // �������
uint32_t y_h1;
 
color_t bckg_col; // ôîí âåðõíåãî ïóêòà
color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà
color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû)
color_t bckg_col; // ��� �������� �����
color_t frnt_col; // ��� ���������� �������� ������
color_t menu_col; // ��� ���������� ����� (��������)
uint32_t select;
uint32_t out_select;
char* buf_adress;
30,23 → 30,23
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; // ���� ���� ���������� ���������
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;
 
 
 
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
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
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,16 → 77,16
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,
}
 
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);
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_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,
93,7 → 93,7
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,
100,14 → 100,14
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 */
/contrib/C_Layer/INCLUDE/kolibri_optionbox.h
1,24 → 1,24
#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 ���������� �� �������������� ��� ����� �� �������
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;
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;
25,17 → 25,17
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
}
 
#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 */
/contrib/C_Layer/INCLUDE/kolibri_pathshow.h
5,23 → 5,23
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
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__));
/contrib/C_Layer/INCLUDE/kolibri_scrollbar.h
5,7 → 5,7
// 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
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
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)
{
};
 
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);
};
 
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)
{
};
 
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);
};
 
inline void gui_add_scrollbar_h(kolibri_window *wnd, scrollbar* sb)
{
};
 
static 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)
{
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__));
/contrib/C_Layer/INCLUDE/kolibri_statictext.h
1,28 → 1,28
#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)
{
st->start_xy = xy;
36,22 → 36,22
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
"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
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);
}
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)
static inline void gui_add_staticnum(kolibri_window *wnd, staticnum* sn)
{
kolibri_window_add_element(wnd, KOLIBRI_STATICNUM, sn);
kolibri_window_add_element(wnd, KOLIBRI_STATICNUM, sn);
}
 
 
128,7 → 128,7
"S"(st->color_flags),
"D"(st->bg_color)
:);
}
}
 
 
#endif /* KOLIBRI_STATICTEXT_H */
 
#endif /* KOLIBRI_STATICTEXT_H */