C Layer: code refactoring
git-svn-id: svn://kolibrios.org@6457 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
38cd3c4ee4
commit
407fab40d9
@ -1,4 +1,4 @@
|
||||
#include "kolibri_gui.h"
|
||||
#include <kolibri_gui.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -12,10 +12,10 @@ int main()
|
||||
unsigned int gui_event = KOLIBRI_EVENT_REDRAW;
|
||||
oskey_t key;
|
||||
|
||||
struct kolibri_window *main_window = kolibri_new_window(50, 50, 400, 100, "BoardMsg: OpenDialog 0.12");
|
||||
struct check_box *checkbox = kolibri_new_check_box(20, 40, 12, 12, "Append BOARDMSG to entered message.");
|
||||
struct edit_box *textbox = kolibri_new_edit_box(20, 55, 40);
|
||||
struct kolibri_button *button = kolibri_new_button(310, 55, 24, 14, 0x21, kolibri_color_table.color_work_button);
|
||||
kolibri_window *main_window = kolibri_new_window(50, 50, 400, 100, "BoardMsg: OpenDialog 0.12");
|
||||
check_box *checkbox = kolibri_new_check_box(20, 40, 12, 12, "Append BOARDMSG to entered message.");
|
||||
edit_box *textbox = kolibri_new_edit_box(20, 55, 40);
|
||||
kolibri_button *button = kolibri_new_button(310, 55, 24, 14, 0x21, kolibri_color_table.color_work_button);
|
||||
|
||||
kolibri_window_add_element(main_window, KOLIBRI_EDIT_BOX, textbox);
|
||||
kolibri_window_add_element(main_window, KOLIBRI_CHECK_BOX, checkbox);
|
||||
@ -57,7 +57,7 @@ int main()
|
||||
debug_board_write_str(textbox->text);
|
||||
debug_board_write_str("\n");
|
||||
break;
|
||||
case 0x00000001:
|
||||
case BUTTON_CLOSE:
|
||||
kolibri_exit();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
#Please set up kolibrios sources here : /home/<username>/kolibrios
|
||||
|
||||
kos32-gcc -c -I${HOME}/kolibrios/contrib/sdk/sources/newlib/libc/include -g -U_Win32 -U_WIN32 -U__MINGW32__ boardmsg.c -o boardmsg.o
|
||||
kos32-gcc -c -I${HOME}/kolibrios/contrib/sdk/sources/newlib/libc/include -I../../INCLUDE -g -U_Win32 -U_WIN32 -U__MINGW32__ boardmsg.c -o boardmsg.o
|
||||
|
||||
fasm loadboxlib.asm loadboxlib.obj
|
||||
|
||||
kos32-ld *.o *.obj -T${HOME}/kolibrios/contrib/sdk/sources/newlib/libc/app.lds -nostdlib -static --image-base 0 -lgcc -L/home/autobuild/tools/win32/mingw32/lib /home/autobuild/tools/win32/lib/libdll.a /home/autobuild/tools/win32/lib/libapp.a /home/autobuild/tools/win32/lib/libc.dll.a -static -o boardxmsg -Map=boardxmsg.map
|
||||
kos32-ld *.o ../../OBJ/loadboxlib.obj -T${HOME}/kolibrios/contrib/sdk/sources/newlib/libc/app.lds -nostdlib -static --image-base 0 -lgcc -L/home/autobuild/tools/win32/mingw32/lib /home/autobuild/tools/win32/lib/libdll.a /home/autobuild/tools/win32/lib/libapp.a /home/autobuild/tools/win32/lib/libc.dll.a -static -o boardxmsg -Map=boardxmsg.map
|
||||
|
||||
objcopy -O binary boardxmsg
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define KOLIBRI_BUF2D_H
|
||||
|
||||
/*ToDo
|
||||
* buf_curve_bezier
|
||||
* voxel function
|
||||
*/
|
||||
|
||||
@ -21,7 +20,7 @@ int kolibri_buf2d_init(void)
|
||||
}
|
||||
|
||||
|
||||
struct buf2d_struct {
|
||||
typedef struct {
|
||||
unsigned int *buf_pointer;
|
||||
uint16_t left;
|
||||
uint16_t top;
|
||||
@ -29,7 +28,7 @@ struct buf2d_struct {
|
||||
unsigned int height;
|
||||
unsigned int bgcolor;
|
||||
uint8_t color_bit;
|
||||
};
|
||||
}buf2d_struct;
|
||||
|
||||
enum BUF2D_ALGORITM_FILTR {
|
||||
SIERRA_LITE,
|
||||
@ -46,12 +45,12 @@ enum BUF2D_OPT_CROP {
|
||||
BUF2D_OPT_CROP_RIGHT = 8
|
||||
};
|
||||
|
||||
extern void (*buf2d_create_asm)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_curve_bezier_asm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_create_asm)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_curve_bezier_asm)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
|
||||
struct buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit)
|
||||
buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit)
|
||||
{
|
||||
struct buf2d_struct *new_buf2d_struct = (struct buf2d_struct *)malloc(sizeof(struct buf2d_struct));
|
||||
buf2d_struct *new_buf2d_struct = (buf2d_struct *)malloc(sizeof(buf2d_struct));
|
||||
new_buf2d_struct -> left = tlx;
|
||||
new_buf2d_struct -> top = tly;
|
||||
new_buf2d_struct -> width = sizex;
|
||||
@ -62,35 +61,35 @@ struct buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex
|
||||
return new_buf2d_struct;
|
||||
}
|
||||
|
||||
void buf2d_curve_bezier(struct buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color)
|
||||
void buf2d_curve_bezier(buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color)
|
||||
{
|
||||
buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color);
|
||||
}
|
||||
|
||||
extern void (*buf2d_draw)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_clear)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_delete)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_rotate)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_resize)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_line)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_line_sm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_filled_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_circle)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_img_hdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_img_wdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_conv_24_to_8)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_conv_24_to_32)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_bit_blt_transp)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_bit_blt_alpha)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_convert_text_matrix)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_draw_text)(struct buf2d_struct *, struct buf2d_struct *, const char *, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_crop_color)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_offset_h)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_flood_fill)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_set_pixel)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern unsigned int (*buf2d_get_pixel)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_flip_h)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_flip_v)(struct buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_filter_dither)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_draw)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_clear)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_delete)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_rotate)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_resize)(buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_line)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_line_sm)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_rect_by_size)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_filled_rect_by_size)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_circle)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_img_hdiv2)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_img_wdiv2)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_conv_24_to_8)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_conv_24_to_32)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_bit_blt_transp)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_bit_blt_alpha)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_convert_text_matrix)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_draw_text)(buf2d_struct *, buf2d_struct *, const char *, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_crop_color)(buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_offset_h)(buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_flood_fill)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_set_pixel)(buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern unsigned int (*buf2d_get_pixel)(buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_flip_h)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_flip_v)(buf2d_struct *) __attribute__((__stdcall__));
|
||||
extern void (*buf2d_filter_dither)(buf2d_struct *, unsigned int) __attribute__((__stdcall__));
|
||||
#endif /* KOLIBRI_BUF2D_H */
|
||||
|
@ -1,18 +1,18 @@
|
||||
#ifndef KOLIBRI_BUTTON_H
|
||||
#define KOLIBRI_BUTTON_H
|
||||
|
||||
struct kolibri_button {
|
||||
typedef struct {
|
||||
unsigned int x65536sizex;
|
||||
unsigned int y65536sizey;
|
||||
unsigned int color;
|
||||
unsigned int identifier;
|
||||
unsigned int XY;
|
||||
};
|
||||
}kolibri_button;
|
||||
|
||||
struct kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey,
|
||||
kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey,
|
||||
unsigned int identifier, unsigned int color)
|
||||
{
|
||||
struct kolibri_button* new_button = (struct kolibri_button *)malloc(sizeof(struct kolibri_button));
|
||||
kolibri_button* new_button = (kolibri_button *)malloc(sizeof(kolibri_button));
|
||||
new_button -> x65536sizex = (tlx << 16) + sizex;
|
||||
new_button -> y65536sizey = (tly << 16) + sizey;
|
||||
new_button -> color = color;
|
||||
@ -21,7 +21,7 @@ struct kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, un
|
||||
return new_button;
|
||||
}
|
||||
|
||||
void draw_button(struct kolibri_button *some_button)
|
||||
void draw_button(kolibri_button *some_button)
|
||||
{
|
||||
define_button(some_button -> x65536sizex, some_button -> y65536sizey, some_button -> identifier, some_button -> color);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ enum CHECKBOX_FLAGS {
|
||||
/* Add more flags later */
|
||||
};
|
||||
|
||||
struct check_box {
|
||||
typedef struct {
|
||||
unsigned int left_s;
|
||||
unsigned int top_s;
|
||||
unsigned int ch_text_margin;
|
||||
@ -20,11 +20,11 @@ struct check_box {
|
||||
|
||||
/* Users can use members above this */
|
||||
unsigned int size_of_str;
|
||||
};
|
||||
}check_box;
|
||||
|
||||
struct check_box* kolibri_new_check_box(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey, char *label_text)
|
||||
check_box* kolibri_new_check_box(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey, char *label_text)
|
||||
{
|
||||
struct check_box* new_checkbox = (struct check_box *)malloc(sizeof(struct check_box));
|
||||
check_box* new_checkbox = (check_box *)malloc(sizeof(check_box));
|
||||
new_checkbox -> left_s = (tlx << 16) + sizex;
|
||||
new_checkbox -> top_s = (tly << 16) + sizey;
|
||||
new_checkbox -> ch_text_margin = 10;
|
||||
@ -37,7 +37,7 @@ struct check_box* kolibri_new_check_box(unsigned int tlx, unsigned int tly, unsi
|
||||
return new_checkbox;
|
||||
}
|
||||
|
||||
extern void (*check_box_draw2)(struct check_box *) __attribute__((__stdcall__));
|
||||
extern void (*check_box_mouse2)(struct check_box *)__attribute__((__stdcall__));
|
||||
extern void (*check_box_draw2)(check_box *) __attribute__((__stdcall__));
|
||||
extern void (*check_box_mouse2)(check_box *)__attribute__((__stdcall__));
|
||||
|
||||
#endif /* KOLIBRI_CHECKBOX_H */
|
||||
|
@ -4,7 +4,7 @@
|
||||
char cd_com_area_name[] = "FFFFFFFF_color_dialog";
|
||||
char cd_start_path[] = "/rd/1/colrdial";
|
||||
|
||||
struct color_dialog {
|
||||
typedef struct {
|
||||
unsigned int type;
|
||||
unsigned int procinfo;
|
||||
unsigned int com_area_name;
|
||||
@ -18,13 +18,13 @@ struct color_dialog {
|
||||
unsigned short y_start;
|
||||
unsigned int color_type;
|
||||
unsigned int color;
|
||||
};
|
||||
}color_dialog;
|
||||
|
||||
void cd_fake_on_redraw(void) {}
|
||||
|
||||
struct open_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
|
||||
{
|
||||
struct color_dialog *new_colordialog = (struct color_dialog *)malloc(sizeof(struct color_dialog));
|
||||
color_dialog *new_colordialog = (color_dialog *)malloc(sizeof(color_dialog));
|
||||
char *proc_info = (char *)calloc(1024, sizeof(char));
|
||||
|
||||
new_colordialog -> type = type;
|
||||
@ -43,6 +43,6 @@ struct open_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short t
|
||||
return new_colordialog;
|
||||
}
|
||||
|
||||
extern void (*ColorDialog_init)(struct open_dialog *) __attribute__((__stdcall__));
|
||||
extern void (*ColorDialog_start)(struct open_dialog *) __attribute__((__stdcall__));
|
||||
extern void (*ColorDialog_init)(color_dialog *) __attribute__((__stdcall__));
|
||||
extern void (*ColorDialog_start)(color_dialog *) __attribute__((__stdcall__));
|
||||
#endif /* KOLIBRI_COLORDIALOG_H */
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef KOLIBRI_COLORS_H
|
||||
#define KOLIBRI_COLORS_H
|
||||
struct kolibri_system_colors {
|
||||
typedef struct {
|
||||
unsigned int color_frame_area;
|
||||
unsigned int color_grab_bar;
|
||||
unsigned int color_grab_bar_button;
|
||||
@ -11,11 +11,11 @@ struct kolibri_system_colors {
|
||||
unsigned int color_work_button_text;
|
||||
unsigned int color_work_text;
|
||||
unsigned int color_work_graph;
|
||||
};
|
||||
}kolibri_system_colors;
|
||||
|
||||
struct kolibri_system_colors kolibri_color_table;
|
||||
kolibri_system_colors kolibri_color_table;
|
||||
|
||||
void kolibri_get_system_colors(struct kolibri_system_colors *color_table)
|
||||
void kolibri_get_system_colors(kolibri_system_colors *color_table)
|
||||
{
|
||||
__asm__ volatile ("int $0x40"
|
||||
:
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "kolibri_colors.h"
|
||||
|
||||
struct edit_box {
|
||||
typedef struct {
|
||||
unsigned int width;
|
||||
unsigned int left;
|
||||
unsigned int top;
|
||||
@ -25,7 +25,7 @@ struct edit_box {
|
||||
unsigned int cl_curs_y;
|
||||
unsigned int shift;
|
||||
unsigned int shift_old;
|
||||
};
|
||||
}edit_box;
|
||||
|
||||
/* Initializes an Editbox with sane settings, sufficient for most use.
|
||||
This will let you create a box and position it somewhere on the screen.
|
||||
@ -42,10 +42,10 @@ struct edit_box {
|
||||
max_chars = Limit of number of characters user can enter into edit box.
|
||||
*/
|
||||
|
||||
struct edit_box* kolibri_new_edit_box(unsigned int tlx, unsigned int tly, unsigned int max_chars)
|
||||
edit_box* kolibri_new_edit_box(unsigned int tlx, unsigned int tly, unsigned int max_chars)
|
||||
{
|
||||
unsigned int PIXELS_PER_CHAR = 7;
|
||||
struct edit_box *new_textbox = (struct edit_box *)malloc(sizeof(struct edit_box));
|
||||
edit_box *new_textbox = (edit_box *)malloc(sizeof(edit_box));
|
||||
char *text_buffer = (char *)calloc(max_chars + 1, sizeof(char));
|
||||
|
||||
/* Update blur_border_color and shift_color from box_lib.mac macro */
|
||||
@ -77,13 +77,13 @@ struct edit_box* kolibri_new_edit_box(unsigned int tlx, unsigned int tly, unsign
|
||||
return new_textbox;
|
||||
}
|
||||
|
||||
extern void (*edit_box_draw)(struct edit_box *) __attribute__((__stdcall__));
|
||||
extern void (*edit_box_draw)(edit_box *) __attribute__((__stdcall__));
|
||||
|
||||
/* editbox_key is a wrapper written in assembly to handle key press events for editboxes */
|
||||
/* because inline assembly in GCC is a PITA and interferes with the EAX (AH) register */
|
||||
/* which edit_box_key requires */
|
||||
extern void editbox_key(struct edit_box *) __attribute__((__stdcall__));
|
||||
extern void editbox_key(edit_box *) __attribute__((__stdcall__));
|
||||
|
||||
extern void (*edit_box_mouse)(struct edit_box *) __attribute__((__stdcall__));
|
||||
extern void (*edit_box_mouse)(edit_box *) __attribute__((__stdcall__));
|
||||
extern volatile unsigned press_key;
|
||||
#endif /* KOLIBRI_EDITBOX_H */
|
||||
|
@ -6,7 +6,7 @@ enum {
|
||||
BOTTON
|
||||
};
|
||||
|
||||
struct frame {
|
||||
typedef struct {
|
||||
unsigned int type;
|
||||
uint16_t size_x;
|
||||
uint16_t start_x;
|
||||
@ -21,11 +21,11 @@ struct frame {
|
||||
unsigned int font_size_y;
|
||||
unsigned int font_color;
|
||||
unsigned int font_backgr_color;
|
||||
};
|
||||
}frame;
|
||||
|
||||
struct frame* kolibri_new_frame(uint16_t tlx, uint16_t tly, uint16_t sizex, uint16_t sizey, unsigned int ext_col, unsigned int int_col, unsigned int draw_text_flag, char *text_pointer, unsigned int text_position, unsigned int font_color, unsigned int font_bgcolor)
|
||||
frame* kolibri_new_frame(uint16_t tlx, uint16_t tly, uint16_t sizex, uint16_t sizey, unsigned int ext_col, unsigned int int_col, unsigned int draw_text_flag, char *text_pointer, unsigned int text_position, unsigned int font_color, unsigned int font_bgcolor)
|
||||
{
|
||||
struct frame *new_frame = (struct frame *)malloc(sizeof(struct frame));
|
||||
frame *new_frame = (frame *)malloc(sizeof(frame));
|
||||
new_frame -> type = 0;
|
||||
new_frame -> size_x = sizex;
|
||||
new_frame -> start_x = tlx;
|
||||
@ -43,6 +43,6 @@ struct frame* kolibri_new_frame(uint16_t tlx, uint16_t tly, uint16_t sizex, uint
|
||||
return new_frame;
|
||||
}
|
||||
|
||||
extern void (*frame_draw)(struct frame *) __attribute__((__stdcall__));
|
||||
extern void (*frame_draw)(frame *) __attribute__((__stdcall__));
|
||||
|
||||
#endif /* KOLIBRI_FRAME_H */
|
||||
|
@ -19,7 +19,9 @@ enum KOLIBRI_GUI_EVENTS {
|
||||
KOLIBRI_EVENT_MOUSE = 6 /* Mouse activity (movement, button press) was detected */
|
||||
};
|
||||
|
||||
void kolibri_handle_event_redraw(struct kolibri_window* some_window)
|
||||
#define BUTTON_CLOSE 0x1
|
||||
|
||||
void kolibri_handle_event_redraw(kolibri_window* some_window)
|
||||
{
|
||||
/* Draw windows with system color table. */
|
||||
|
||||
@ -33,7 +35,7 @@ void kolibri_handle_event_redraw(struct kolibri_window* some_window)
|
||||
/* Enumerate and draw all window elements here */
|
||||
if(some_window->elements) /* Draw all elements added to window */
|
||||
{
|
||||
struct kolibri_window_element* current_element = some_window -> elements;
|
||||
kolibri_window_element* current_element = some_window -> elements;
|
||||
|
||||
do
|
||||
{
|
||||
@ -60,12 +62,12 @@ void kolibri_handle_event_redraw(struct kolibri_window* some_window)
|
||||
}
|
||||
}
|
||||
|
||||
void kolibri_handle_event_key(struct kolibri_window* some_window)
|
||||
void kolibri_handle_event_key(kolibri_window* some_window)
|
||||
{
|
||||
/* Enumerate and trigger key handling functions of window elements here */
|
||||
if(some_window->elements)
|
||||
{
|
||||
struct kolibri_window_element *current_element = some_window -> elements;
|
||||
kolibri_window_element *current_element = some_window -> elements;
|
||||
|
||||
do
|
||||
{
|
||||
@ -78,12 +80,12 @@ void kolibri_handle_event_key(struct kolibri_window* some_window)
|
||||
}
|
||||
}
|
||||
|
||||
void kolibri_handle_event_mouse(struct kolibri_window* some_window)
|
||||
void kolibri_handle_event_mouse(kolibri_window* some_window)
|
||||
{
|
||||
/* Enumerate and trigger mouse handling functions of window elements here */
|
||||
if(some_window->elements)
|
||||
{
|
||||
struct kolibri_window_element *current_element = some_window -> elements;
|
||||
kolibri_window_element *current_element = some_window -> elements;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -33,24 +33,24 @@ enum KOLIBRI_GUI_ELEMENT_TYPE {
|
||||
};
|
||||
|
||||
/* Linked list which connects together all the elements drawn inside a GUI window */
|
||||
struct kolibri_window_element {
|
||||
typedef struct{
|
||||
enum KOLIBRI_GUI_ELEMENT_TYPE type;
|
||||
void *element;
|
||||
struct kolibri_window_element *next, *prev;
|
||||
};
|
||||
void *next, *prev;
|
||||
}kolibri_window_element;
|
||||
|
||||
|
||||
typedef void (*cb_elem_boxlib)(void *) __attribute__((__stdcall__));
|
||||
|
||||
/* Generic structure for supporting functions on various elements of Kolibri's GUI */
|
||||
struct kolibri_element_operations {
|
||||
typedef struct {
|
||||
cb_elem_boxlib redraw_fn;
|
||||
cb_elem_boxlib mouse_fn;
|
||||
cb_elem_boxlib key_fn;
|
||||
};
|
||||
}kolibri_element_operations;
|
||||
|
||||
/* Structure for a GUI Window on Kolibri. It also contains all the elements drawn in window */
|
||||
struct kolibri_window {
|
||||
typedef struct{
|
||||
unsigned int topleftx, toplefty;
|
||||
unsigned int sizex, sizey;
|
||||
char *window_title;
|
||||
@ -58,14 +58,14 @@ struct kolibri_window {
|
||||
/* Refer to sysfuncs, value to be stored in EDX (Function 0) */
|
||||
unsigned int XY;
|
||||
|
||||
struct kolibri_window_element *elements;
|
||||
};
|
||||
kolibri_window_element *elements;
|
||||
}kolibri_window;
|
||||
|
||||
/*---------------------End of Structure and enum definitions---------------*/
|
||||
/*---------------------Define various functions for initializing GUI-------*/
|
||||
|
||||
/* Master table containing operations for various GUI elements in one place */
|
||||
struct kolibri_element_operations kolibri_gui_op_table[KOLIBRI_NUM_GUI_ELEMENTS];
|
||||
kolibri_element_operations kolibri_gui_op_table[KOLIBRI_NUM_GUI_ELEMENTS];
|
||||
|
||||
void kolibri_init_gui_op_table(void)
|
||||
{
|
||||
@ -99,9 +99,9 @@ kolibri_gui_op_table[KOLIBRI_FRAME].key_fn = NULL;
|
||||
/* Create a new main GUI window for KolibriOS */
|
||||
/* tl stands for TOP LEFT. x and y are coordinates. */
|
||||
|
||||
struct kolibri_window * kolibri_new_window(int tlx, int tly, int sizex, int sizey, char *title)
|
||||
kolibri_window * kolibri_new_window(int tlx, int tly, int sizex, int sizey, char *title)
|
||||
{
|
||||
struct kolibri_window *new_win = (struct kolibri_window *)malloc(sizeof(struct kolibri_window));
|
||||
kolibri_window *new_win = (kolibri_window *)malloc(sizeof(kolibri_window));
|
||||
|
||||
new_win->topleftx = tlx;
|
||||
new_win->toplefty = tly;
|
||||
@ -115,9 +115,9 @@ struct kolibri_window * kolibri_new_window(int tlx, int tly, int sizex, int size
|
||||
}
|
||||
|
||||
/* Add an element to an existing window */
|
||||
void kolibri_window_add_element(struct kolibri_window *some_window, enum KOLIBRI_GUI_ELEMENT_TYPE element_type, void *some_gui_element)
|
||||
void kolibri_window_add_element(kolibri_window *some_window, enum KOLIBRI_GUI_ELEMENT_TYPE element_type, void *some_gui_element)
|
||||
{
|
||||
struct kolibri_window_element *new_element = (struct kolibri_window_element *)malloc(sizeof(struct kolibri_window_element));
|
||||
kolibri_window_element *new_element = (kolibri_window_element *)malloc(sizeof(kolibri_window_element));
|
||||
|
||||
new_element -> type = element_type;
|
||||
new_element -> element = some_gui_element;
|
||||
@ -130,7 +130,7 @@ void kolibri_window_add_element(struct kolibri_window *some_window, enum KOLIBRI
|
||||
}
|
||||
else
|
||||
{
|
||||
struct kolibri_window_element *last_element = some_window -> elements -> prev;
|
||||
kolibri_window_element *last_element = some_window -> elements -> prev;
|
||||
|
||||
last_element -> next = new_element;
|
||||
new_element -> next = some_window -> elements; /* start of linked list */
|
||||
|
@ -13,6 +13,50 @@ int kolibri_libimg_init(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
//list of format id's
|
||||
#define LIBIMG_FORMAT_BMP 1
|
||||
#define LIBIMG_FORMAT_ICO 2
|
||||
#define LIBIMG_FORMAT_CUR 3
|
||||
#define LIBIMG_FORMAT_GIF 4
|
||||
#define LIBIMG_FORMAT_PNG 5
|
||||
#define LIBIMG_FORMAT_JPEG 6
|
||||
#define LIBIMG_FORMAT_TGA 7
|
||||
#define LIBIMG_FORMAT_PCX 8
|
||||
#define LIBIMG_FORMAT_XCF 9
|
||||
#define LIBIMG_FORMAT_TIFF 10
|
||||
#define LIBIMG_FORMAT_PNM 11
|
||||
#define LIBIMG_FORMAT_WBMP 12
|
||||
#define LIBIMG_FORMAT_XBM 13
|
||||
#define LIBIMG_FORMAT_Z80 14
|
||||
|
||||
//error codes
|
||||
#define LIBIMG_ERROR_OUT_OF_MEMORY 1
|
||||
#define LIBIMG_ERROR_FORMAT 2
|
||||
#define LIBIMG_ERROR_CONDITIONS 3
|
||||
#define LIBIMG_ERROR_BIT_DEPTH 4
|
||||
#define LIBIMG_ERROR_ENCODER 5
|
||||
#define LIBIMG_ERROR_SRC_TYPE 6
|
||||
#define LIBIMG_ERROR_SCALE 7
|
||||
#define LIBIMG_ERROR_INTER 8
|
||||
#define LIBIMG_ERROR_NOT_INPLEMENTED 9
|
||||
#define LIBIMG_ERROR_INVALID_INPUT 10
|
||||
|
||||
//encode flags (byte 0x02 of _common option)
|
||||
#define LIBIMG_ENCODE_STRICT_SPECIFIC 0x01
|
||||
#define LIBIMG_ENCODE_STRICT_BIT_DEPTH 0x02
|
||||
#define LIBIMG_ENCODE_DELETE_ALPHA 0x08
|
||||
#define LIBIMG_ENCODE_FLUSH_ALPHA 0x10
|
||||
|
||||
|
||||
#define FLIP_VERTICAL 0x01
|
||||
#define FLIP_HORIZONTAL 0x02
|
||||
|
||||
#define ROTATE_90_CW 0x01
|
||||
#define ROTATE_180 0x02
|
||||
#define ROTATE_270_CW 0x03
|
||||
#define ROTATE_90_CCW ROTATE_270_CW
|
||||
#define ROTATE_270_CCW ROTATE_90_CW
|
||||
|
||||
extern void* (*img_decode)(void *, uint32_t, uint32_t) __attribute__((__stdcall__));
|
||||
extern void* (*img_encode)(void *, uint32_t, uint32_t) __attribute__((__stdcall__));
|
||||
extern void* (*img_create)(uint32_t, uint32_t, uint32_t) __attribute__((__stdcall__));
|
||||
|
@ -5,7 +5,7 @@ char sz_com_area_name[] = "FFFFFFFF_open_dialog";
|
||||
char sz_dir_default_path[] = "/rd/1";
|
||||
char sz_start_path[] = "/rd/1/File managers/opendial";
|
||||
|
||||
struct open_dialog {
|
||||
typedef struct {
|
||||
unsigned int mode;
|
||||
unsigned int procinfo;
|
||||
unsigned int com_area_name;
|
||||
@ -22,19 +22,19 @@ struct open_dialog {
|
||||
unsigned short x_start;
|
||||
unsigned short y_size;
|
||||
unsigned short y_start;
|
||||
};
|
||||
}open_dialog;
|
||||
|
||||
struct od_filter {
|
||||
typedef struct {
|
||||
unsigned int size;
|
||||
unsigned char end;
|
||||
};
|
||||
}od_filter;
|
||||
|
||||
void fake_on_redraw(void) {}
|
||||
|
||||
struct open_dialog* kolibri_new_open_dialog(unsigned int mode, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
|
||||
{
|
||||
struct open_dialog *new_opendialog = (struct open_dialog *)malloc(sizeof(struct open_dialog));
|
||||
struct od_filter *new_od_filter = (struct od_filter *)malloc(sizeof(struct od_filter));
|
||||
open_dialog *new_opendialog = (open_dialog *)malloc(sizeof(open_dialog));
|
||||
od_filter *new_od_filter = (od_filter *)malloc(sizeof(od_filter));
|
||||
char *plugin_path = (char *)calloc(4096, sizeof(char));
|
||||
char *openfile_path = (char *)calloc(4096, sizeof(char));
|
||||
char *proc_info = (char *)calloc(1024, sizeof(char));
|
||||
@ -62,6 +62,6 @@ struct open_dialog* kolibri_new_open_dialog(unsigned int mode, unsigned short tl
|
||||
return new_opendialog;
|
||||
}
|
||||
|
||||
extern void (*OpenDialog_init)(struct open_dialog *) __attribute__((__stdcall__));
|
||||
extern void (*OpenDialog_start)(struct open_dialog *) __attribute__((__stdcall__));
|
||||
extern void (*OpenDialog_init)(open_dialog *) __attribute__((__stdcall__));
|
||||
extern void (*OpenDialog_start)(open_dialog *) __attribute__((__stdcall__));
|
||||
#endif /* KOLIBRI_OPENDIALOG_H */
|
||||
|
Loading…
Reference in New Issue
Block a user