/programs/develop/new libGUI_C/SDK/MinGW(windows)/libGUI.c |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
/programs/develop/new libGUI_C/SDK/MinGW(windows)/libGUI.h |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
/programs/develop/new libGUI_C/SDK/MinGW and Cygwin(windows)/libGUI.c |
---|
0,0 → 1,243 |
/* |
libGUI dinamic library SDK |
load library and link function |
*/ |
#include "libGUI.h" |
struct IMPORT |
{ |
char *name; |
void *function; |
}__attribute__((packed)); |
typedef struct IMPORT import_t; |
static char *sys_libGUI_path="/sys/lib/libGUI.obj"; |
static char* funcnames[] = {"LibGUIversion","InitLibGUI","LibGUImain","QuitLibGUI", |
"CreateWindow","SetWindowSizeRequest", |
"PackControls","DestroyControl","SetControlSizeRequest","GetControlSizeX", |
"GetControlSizeY","SetControlNewPosition","GetControlPositionX", |
"GetControlPositionY","SetFocuse","RedrawControl","SpecialRedrawControl", |
"SetCallbackFunction","BlockCallbackFunction","UnblockCallbackFunction", |
"SetIDL_Function","DestroyIDL_Function", |
"SetTimerCallbackForFunction","DestroyTimerCallbackForFunction", |
"SetCallbackFunctionForEvent","DestroyCallbackFunctionForEvent", |
"CreateButton","CreateButtonWithText", |
"CreateProgressBar","SetProgressBarPulse","ProgressBarSetText","ProgressBarGetText", |
"CreateHorizontalScrollBar","CreateVerticalScrollBar", |
"CreateScrolledWindow","ScrolledWindowPackControls", |
"CreateImage", |
"CreateText","TextBackgroundOn","TextBackgroundOff", |
"LoadFont","FreeFont"}; |
static inline void* gui_ksys_load_dll(char *path) |
{ |
void *dll_export; |
__asm__ __volatile__( |
"int $0x40" |
:"=a"(dll_export) |
:"a"(68),"b"(19),"c"(path)); |
return(dll_export); |
} |
static inline void gui_ksys_debug_out(int c) |
{ |
__asm__ __volatile__( |
"int $0x40" |
: |
:"a"(63),"b"(1),"c"(c)); |
} |
static void gui_debug_out_str(char *s) |
{ |
while(*s) |
{ |
if (*s=='\n') gui_ksys_debug_out(13); |
gui_ksys_debug_out(*s); |
s++; |
} |
} |
static int gui_strcmp(const char* string1, const char* string2) |
{ |
while (1) |
{ |
if (*string1<*string2) |
return -1; |
if (*string1>*string2) |
return 1; |
if (*string1=='\0') |
return 0; |
string1++; |
string2++; |
} |
} |
static void* gui_cofflib_getproc(import_t *lib, char *name) |
{ |
int i; |
for(i = 0; lib[i].name && gui_strcmp(name, lib[i].name); i++); |
if(lib[i].name) return lib[i].function; |
else return NULL; |
} |
static inline void gui_ksys_exit(int value) |
{ |
__asm__ __volatile__( |
"int $0x40" |
: |
:"a"(-1),"b"(value)); |
} |
void link_libGUI(import_t *exp,char **imports) |
{ |
LibGUIversion=(DWORD (stdcall *)(void)) |
gui_cofflib_getproc(exp,imports[0]); |
InitLibGUI=(char (stdcall *)(void)) |
gui_cofflib_getproc(exp,imports[1]); |
LibGUImain=(void (stdcall *)(parent_t *WindowParent)) |
gui_cofflib_getproc(exp,imports[2]); |
QuitLibGUI=(void (stdcall *)(parent_t *window)) |
gui_cofflib_getproc(exp,imports[3]); |
CreateWindow=(void* (stdcall *)(void)) |
gui_cofflib_getproc(exp,imports[4]); |
SetWindowSizeRequest=(void (stdcall *)(parent_t *WindowParent,int size_x,int size_y)) |
gui_cofflib_getproc(exp,imports[5]); |
PackControls=(void (stdcall *)(void *Parent,void *control)) |
gui_cofflib_getproc(exp,imports[6]); |
DestroyControl=(void (stdcall *)(void *control)) |
gui_cofflib_getproc(exp,imports[7]); |
SetControlSizeRequest=(void (stdcall *)(void *Control,int new_size_x,int new_size_y)) |
gui_cofflib_getproc(exp,imports[8]); |
GetControlSizeX=(int (stdcall *)(void *Control)) |
gui_cofflib_getproc(exp,imports[9]); |
GetControlSizeY=(int (stdcall *)(void *Control)) |
gui_cofflib_getproc(exp,imports[10]); |
SetControlNewPosition=(void (stdcall *)(void *Control,int new_x,int new_y)) |
gui_cofflib_getproc(exp,imports[11]); |
GetControlPositionX=(int (stdcall *)(void *Control)) |
gui_cofflib_getproc(exp,imports[12]); |
GetControlPositionY=(int (stdcall *)(void *Control)) |
gui_cofflib_getproc(exp,imports[13]); |
SetFocuse=(void* (stdcall *)(void *Control)) |
gui_cofflib_getproc(exp,imports[14]); |
RedrawControl=(void (stdcall *)(void *Control)) |
gui_cofflib_getproc(exp,imports[15]); |
SpecialRedrawControl=(void (stdcall *)(void *Control)) |
gui_cofflib_getproc(exp,imports[16]); |
SetCallbackFunction=(gui_callback_t* (stdcall *)(void *Control, |
int event_name,void *callback_func,void *callback_func_data)) |
gui_cofflib_getproc(exp,imports[17]); |
BlockCallbackFunction=(void (stdcall *)(void *Control,gui_callback_t *callback_ID)) |
gui_cofflib_getproc(exp,imports[18]); |
UnblockCallbackFunction=(void (stdcall *)(void *Control,gui_callback_t *callback_ID)) |
gui_cofflib_getproc(exp,imports[19]); |
SetIDL_Function=(void (stdcall *)(parent_t *Parent,void *function,void *function_data)) |
gui_cofflib_getproc(exp,imports[20]); |
DestroyIDL_Function=(void (stdcall *)(parent_t *Parent)) |
gui_cofflib_getproc(exp,imports[21]); |
SetTimerCallbackForFunction=(gui_timer_t* (stdcall *)(parent_t *parent_window, |
int time_tick,void *func,void *func_data)) |
gui_cofflib_getproc(exp,imports[22]); |
DestroyTimerCallbackForFunction=(void (stdcall *)(gui_timer_t *timer)) |
gui_cofflib_getproc(exp,imports[23]); |
SetCallbackFunctionForEvent=(gui_callbackevent_t* (stdcall *)(parent_t *parent_window, |
int event_type,void *func,void *func_data)) |
gui_cofflib_getproc(exp,imports[24]); |
DestroyCallbackFunctionForEvent=(void (stdcall *)(gui_callbackevent_t *callback_event)) |
gui_cofflib_getproc(exp,imports[25]); |
CreateButton=(gui_button_t* (stdcall *)(gui_button_data_t *info_for_control)) |
gui_cofflib_getproc(exp,imports[26]); |
CreateButtonWithText=(gui_button_t* (stdcall *)(gui_button_data_t *info,char *txt)) |
gui_cofflib_getproc(exp,imports[27]); |
CreateProgressBar=(gui_progress_bar_t* (stdcall *)(gui_progress_bar_data_t *info_for_control)) |
gui_cofflib_getproc(exp,imports[28]); |
SetProgressBarPulse=(void (stdcall *)(gui_progress_bar_t *ProgressBar,int time_update)) |
gui_cofflib_getproc(exp,imports[29]); |
ProgressBarSetText=(void (stdcall *)(gui_progress_bar_t *pbar,char *txt)) |
gui_cofflib_getproc(exp,imports[30]); |
ProgressBarGetText=(char* (stdcall *)(gui_progress_bar_t *pbar)) |
gui_cofflib_getproc(exp,imports[31]); |
CreateHorizontalScrollBar=(gui_scroll_bar_t* (stdcall *)(gui_scroll_bar_data_t *info_for_control)) |
gui_cofflib_getproc(exp,imports[32]); |
CreateVerticalScrollBar=(gui_scroll_bar_t* (stdcall *)(gui_scroll_bar_data_t *info_for_control)) |
gui_cofflib_getproc(exp,imports[33]); |
CreateScrolledWindow=(gui_scrolled_window_t* (stdcall *)(gui_scrolled_window_data_t *info_for_control)) |
gui_cofflib_getproc(exp,imports[34]); |
ScrolledWindowPackControls=(void (stdcall *)(gui_scrolled_window_t *parent,void *Control)) |
gui_cofflib_getproc(exp,imports[35]); |
CreateImage=(gui_image_t* (stdcall *)(gui_image_data_t *info_for_control)) |
gui_cofflib_getproc(exp,imports[36]); |
CreateText=(gui_text_t* (stdcall *)(gui_text_data_t *info_for_control)) |
gui_cofflib_getproc(exp,imports[37]); |
TextBackgroundOn=(void (stdcall *)(gui_text_t *Text)) |
gui_cofflib_getproc(exp,imports[38]); |
TextBackgroundOff=(void (stdcall *)(gui_text_t *Text)) |
gui_cofflib_getproc(exp,imports[39]); |
LoadFont=(font_t* (stdcall *)(char *fullfontname)) |
gui_cofflib_getproc(exp,imports[40]); |
FreeFont=(void (stdcall *)(font_t *font)) |
gui_cofflib_getproc(exp,imports[41]); |
} |
void LoadLibGUI(char *lib_path) |
{ |
import_t *export; |
char *path; |
DWORD vers; |
if (lib_path==NULL) |
{ |
path=sys_libGUI_path; |
export=(import_t*)gui_ksys_load_dll(path); |
} |
else |
{ |
path=lib_path; |
export=(import_t*)gui_ksys_load_dll(path); |
} |
if (export==NULL) |
{ |
gui_debug_out_str("\ncan't load lib="); |
gui_debug_out_str(path); |
gui_ksys_exit(0); |
} |
else |
{ |
link_libGUI(export,funcnames); |
if (InitLibGUI()) |
{ |
gui_debug_out_str("\ncan't initialize libGUI"); |
gui_ksys_exit(0); |
} |
gui_debug_out_str(" initialized"); |
} |
} |
Property changes: |
Added: svn:executable |
/programs/develop/new libGUI_C/SDK/MinGW and Cygwin(windows)/libGUI.h |
---|
0,0 → 1,592 |
/* |
service structures of libGUI |
*/ |
#define NULL (void*)0 |
typedef unsigned int DWORD; |
typedef unsigned char BYTE; |
typedef unsigned short int WORD; |
typedef unsigned int size_t; |
#define stdcall __stdcall |
#define cdecl __cdecl |
///////////////////////////////////////////////////////////////////////// |
// libGUI sysyem messages types |
///////////////////////////////////////////////////////////////////////// |
#define MESSAGE_FULL_REDRAW_ALL 1 |
#define MESSAGE_KEYS_EVENT 2 |
#define MESSAGE_SPECIALIZED 3 |
#define MESSAGE_SET_FOCUSE 4 |
#define MESSAGE_CHANGE_FOCUSE 5 |
#define MESSAGE_MOUSE_EVENT 6 |
#define MESSAGE_CHANGE_POSITION_EVENT 7 |
#define MESSAGE_CHANGESIZE_EVENT 8 |
#define MESSAGE_CALL_TIMER_EVENT 9 |
#define MESSAGE_FULL_REDRAW_ALL_WITH_FINITION 10 |
#define MESSAGE_SET_MAIN_PARENT 11 |
#define MESSAGE_DESTROY_CONTROL -1 |
///////////////////////////////////////////////////////////////////////// |
// system keys states |
///////////////////////////////////////////////////////////////////////// |
#define KEY_DOWN 16 |
#define KEY_UP 17 |
#define KEY_HOTKEY 18 |
///////////////////////////////////////////////////////////////////////// |
// system mouse buttons states |
///////////////////////////////////////////////////////////////////////// |
#define MOUSE_LEFT_BUTTON_DOWN 19 |
#define MOUSE_LEFT_BUTTON_UP 20 |
#define MOUSE_RIGHT_BUTTON_DOWN 21 |
#define MOUSE_RIGHT_BUTTON_UP 22 |
#define MOUSE_MIDDLE_BUTTON_DOWN 23 |
#define MOUSE_MIDDLE_BUTTON_UP 24 |
#define MOUSE_4_BUTTON_DOWN 25 |
#define MOUSE_4_BUTTON_UP 26 |
#define MOUSE_5_BUTTON_DOWN 27 |
#define MOUSE_5_BUTTON_UP 28 |
//----------------------------------------------------------------------- |
// CONNECT EVENTS FOR CALLBACKs |
//----------------------------------------------------------------------- |
//////////////////////////////////////////////////////////////// |
// connect events for button |
//////////////////////////////////////////////////////////////// |
#define BUTTON_ENTER_EVENT 29 |
#define BUTTON_LEAVE_EVENT 30 |
#define BUTTON_PRESSED_EVENT 31 |
#define BUTTON_RELEASED_EVENT 32 |
//////////////////////////////////////////////////////////////// |
// connect events for scroll bar |
//////////////////////////////////////////////////////////////// |
#define SCROLLBAR_CHANGED_EVENT 33 |
//////////////////////////////////////////////////////////////// |
// connect events for main parent window |
//////////////////////////////////////////////////////////////// |
#define DELETE_EVENT 36 |
//////////////////////////////////////////////////////////////// |
// font type structure |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct FONT |
{ |
DWORD *fnt_draw; |
DWORD *fnt_unpacker; |
DWORD *fnt_fd; |
DWORD *fnt_bk; |
int sizex; |
int sizey; |
int size; |
int encoding_type; |
char *font; |
char *fnt_name; |
DWORD type; |
DWORD flags; |
}; |
#pragma pack(pop) |
typedef struct FONT font_t; |
//////////////////////////////////////////////////////////////// |
// header of parent of control |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct HEADERPARENT |
{ |
DWORD *ctrl_proc; |
DWORD *ctrl_fd; |
DWORD *ctrl_bk; |
DWORD *child_fd; |
DWORD *child_bk; |
DWORD *parent; |
DWORD *main_parent; |
DWORD ctrl_x; |
DWORD ctrl_y; |
DWORD ctrl_sizex; |
DWORD ctrl_sizey; |
DWORD ctrl_ID; |
DWORD *active_control_for_keys; |
DWORD *active_control_for_mouse; |
DWORD *callback; |
DWORD *finition; |
DWORD *timer; |
DWORD flags; |
DWORD **control_for_callback_function; |
DWORD **callback_for_control_callback; |
DWORD number_callbacks; |
DWORD *global_active_control_for_keys; |
DWORD *message; |
DWORD *timer_bk; |
DWORD *timer_fd; |
DWORD number_timers_for_controls; |
DWORD *calev_bk; |
DWORD *calev_fd; |
DWORD *IDL_func; |
DWORD *IDL_func_data; |
}; |
#pragma pack(pop) |
typedef struct HEADERPARENT parent_t; |
//////////////////////////////////////////////////////////////// |
// header of control |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct HEADER |
{ |
DWORD *ctrl_proc; |
DWORD *ctrl_fd; |
DWORD *ctrl_bk; |
DWORD *child_fd; |
DWORD *child_bk; |
DWORD *parent; |
DWORD *main_parent; |
DWORD ctrl_x; |
DWORD ctrl_y; |
DWORD ctrl_sizex; |
DWORD ctrl_sizey; |
DWORD ctrl_ID; |
DWORD *active_control_for_keys; |
DWORD *active_control_for_mouse; |
DWORD *callback; |
DWORD *finition; |
DWORD *timer; |
DWORD flags; |
}; |
#pragma pack(pop) |
typedef struct HEADER header_t; |
//////////////////////////////////////////////////////////////// |
// callback structure for callback function of control |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct CALLBACK |
{ |
DWORD *clb_bk; |
DWORD *clb_fd; |
DWORD *clb_control; |
DWORD *func; |
DWORD *func_data; |
DWORD connect_event; |
DWORD flags; |
}; |
#pragma pack(pop) |
typedef struct CALLBACK gui_callback_t; |
//////////////////////////////////////////////////////////////// |
// timer |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct TIMER |
{ |
DWORD *tmr_bk; |
DWORD *tmr_fd; |
DWORD *tmr_parent; |
DWORD *func; |
DWORD *func_data; |
DWORD last_time; |
DWORD time_tick; |
DWORD flags; |
}; |
#pragma pack(pop) |
typedef struct TIMER gui_timer_t; |
//////////////////////////////////////////////////////////////// |
// structure for callback events |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct CALLBACKEVENT |
{ |
DWORD *calev_bk; |
DWORD *calev_fd; |
DWORD *calev_parent; |
DWORD *func; |
DWORD *func_data; |
DWORD event_type; |
}; |
#pragma pack(pop) |
typedef struct CALLBACKEVENT gui_callbackevent_t; |
//////////////////////////////////////////////////////////////// |
// type of data - structure message |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct MESSAGE |
{ |
DWORD type; |
DWORD arg1; |
DWORD arg2; |
DWORD arg3; |
DWORD arg4; |
}; |
#pragma pack(pop) |
typedef struct MESSAGE gui_message_t; |
//////////////////////////////////////////////////////////////// |
// button |
//////////////////////////////////////////////////////////////// |
#pragma pack(push,1) |
struct ControlButton |
{ |
DWORD *ctrl_proc; |
DWORD *ctrl_fd; |
DWORD *ctrl_bk; |
DWORD *child_fd; |
DWORD *child_bk; |
DWORD *parent; |
DWORD *main_parent; |
DWORD ctrl_x; |
DWORD ctrl_y; |
DWORD ctrl_sizex; |
DWORD ctrl_sizey; |
DWORD ctrl_ID; |
DWORD *active_control_for_keys; |
DWORD *active_control_for_mouse; |
DWORD *callback; |
DWORD *finition; |
DWORD *timer; |
DWORD flags; |
//button's data |
+ |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ControlButton gui_button_t; |
+ |
+// information for creating control Button |
+#pragma pack(push,1) |
+struct ButtonData |
+{ |
+ int x; |
+ int y; |
+ int width; |
+ int height; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ButtonData gui_button_data_t; |
+ |
+//////////////////////////////////////////////////////////////// |
+// scroller |
+//////////////////////////////////////////////////////////////// |
+#pragma pack(push,1) |
+struct ControlScrollBar |
+{ |
+ DWORD *ctrl_proc; |
+ DWORD *ctrl_fd; |
+ DWORD *ctrl_bk; |
+ DWORD *child_fd; |
+ DWORD *child_bk; |
+ DWORD *parent; |
+ DWORD *main_parent; |
+ DWORD ctrl_x; |
+ DWORD ctrl_y; |
+ DWORD ctrl_sizex; |
+ DWORD ctrl_sizey; |
+ DWORD ctrl_ID; |
+ DWORD *active_control_for_keys; |
+ DWORD *active_control_for_mouse; |
+ DWORD *callback; |
+ DWORD *finition; |
+ DWORD *timer; |
+ DWORD flags; |
+ |
+ //scroll bar's data |
+ float ruller_size; |
+ float ruller_pos; |
+ float ruller_step; |
+ BYTE scb_flags; |
+}; |
+ |
+typedef struct ControlScrollBar gui_scroll_bar_t; |
+ |
+#pragma pack(push,1) |
+struct ScrollBarData |
+{ |
+ int x; |
+ int y; |
+ int width; |
+ int height; |
+ float ruller_size; |
+ float ruller_pos; |
+ float ruller_step; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ScrollBarData gui_scroll_bar_data_t; |
+//////////////////////////////////////////////////////////////// |
+// progressbar |
+//////////////////////////////////////////////////////////////// |
+#pragma pack(push,1) |
+struct ControlProgressBar |
+{ |
+ DWORD *ctrl_proc; |
+ DWORD *ctrl_fd; |
+ DWORD *ctrl_bk; |
+ DWORD *child_fd; |
+ DWORD *child_bk; |
+ DWORD *parent; |
+ DWORD *main_parent; |
+ DWORD ctrl_x; |
+ DWORD ctrl_y; |
+ DWORD ctrl_sizex; |
+ DWORD ctrl_sizey; |
+ DWORD ctrl_ID; |
+ DWORD *active_control_for_keys; |
+ DWORD *active_control_for_mouse; |
+ DWORD *callback; |
+ DWORD *finition; |
+ DWORD *timer; |
+ DWORD flags; |
+ |
+ //progress bar's data |
+ float progress; |
+ BYTE prb_flags; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ControlProgressBar gui_progress_bar_t; |
+ |
+#pragma pack(push,1) |
+struct ProgressBarData |
+{ |
+ int x; |
+ int y; |
+ int width; |
+ int height; |
+ float progress; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ProgressBarData gui_progress_bar_data_t; |
+//////////////////////////////////////////////////////////////// |
+// scrolled window |
+//////////////////////////////////////////////////////////////// |
+#pragma pack(push,1) |
+struct ControlScrolledWindow |
+{ |
+ DWORD *ctrl_proc; |
+ DWORD *ctrl_fd; |
+ DWORD *ctrl_bk; |
+ DWORD *child_fd; |
+ DWORD *child_bk; |
+ DWORD *parent; |
+ DWORD *main_parent; |
+ DWORD ctrl_x; |
+ DWORD ctrl_y; |
+ DWORD ctrl_sizex; |
+ DWORD ctrl_sizey; |
+ DWORD ctrl_ID; |
+ DWORD *active_control_for_keys; |
+ DWORD *active_control_for_mouse; |
+ DWORD *callback; |
+ DWORD *finition; |
+ DWORD *timer; |
+ DWORD flags; |
+ |
+ //scrolled windows's data |
+ DWORD virtual_x; |
+ DWORD virtual_y; |
+ DWORD virtual_sizex; |
+ DWORD virtual_sizey; |
+ DWORD *virtual_controls_x; |
+ DWORD *virtual_controls_y; |
+ DWORD number_virtual_controls; |
+ DWORD scroll_arrea_sizex; |
+ DWORD scroll_arrea_sizey; |
+ DWORD *horizontal_scroll; |
+ DWORD *vertical_scroll; |
+ BYTE scw_flags; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ControlScrolledWindow gui_scrolled_window_t; |
+ |
+#pragma pack(push,1) |
+struct ScrolledWindowData |
+{ |
+ int x; |
+ int y; |
+ int width; |
+ int height; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ScrolledWindowData gui_scrolled_window_data_t; |
+ |
+//////////////////////////////////////////////////////////////// |
+// image |
+//////////////////////////////////////////////////////////////// |
+#pragma pack(push,1) |
+struct ControlImage |
+{ |
+ DWORD *ctrl_proc; |
+ DWORD *ctrl_fd; |
+ DWORD *ctrl_bk; |
+ DWORD *child_fd; |
+ DWORD *child_bk; |
+ DWORD *parent; |
+ DWORD *main_parent; |
+ DWORD ctrl_x; |
+ DWORD ctrl_y; |
+ DWORD ctrl_sizex; |
+ DWORD ctrl_sizey; |
+ DWORD ctrl_ID; |
+ DWORD *active_control_for_keys; |
+ DWORD *active_control_for_mouse; |
+ DWORD *callback; |
+ DWORD *finition; |
+ DWORD *timer; |
+ DWORD flags; |
+ |
+ char bits_per_pixel; |
+ char bytes_per_pixel; |
+ char *img; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ControlImage gui_image_t; |
+ |
+#pragma pack(push,1) |
+struct ImageData |
+{ |
+ int x; |
+ int y; |
+ int width; |
+ int height; |
+ char bits_per_pixel; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ImageData gui_image_data_t; |
+ |
+//////////////////////////////////////////////////////////////// |
+// text |
+//////////////////////////////////////////////////////////////// |
+#pragma pack(push,1) |
+struct ControlText |
+{ |
+ DWORD *ctrl_proc; |
+ DWORD *ctrl_fd; |
+ DWORD *ctrl_bk; |
+ DWORD *child_fd; |
+ DWORD *child_bk; |
+ DWORD *parent; |
+ DWORD *main_parent; |
+ DWORD ctrl_x; |
+ DWORD ctrl_y; |
+ DWORD ctrl_sizex; |
+ DWORD ctrl_sizey; |
+ DWORD ctrl_ID; |
+ DWORD *active_control_for_keys; |
+ DWORD *active_control_for_mouse; |
+ DWORD *callback; |
+ DWORD *finition; |
+ DWORD *timer; |
+ DWORD flags; |
+ |
+ DWORD *font; |
+ DWORD color; |
+ DWORD background_color; |
+ char *text; |
+ BYTE txt_flags; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct ControlText gui_text_t; |
+ |
+#pragma pack(push,1) |
+struct TextData |
+{ |
+ int x; |
+ int y; |
+ DWORD *font; |
+ DWORD color; |
+ DWORD background_color; |
+ char background; |
+ char *text; |
+}; |
+#pragma pack(pop) |
+ |
+typedef struct TextData gui_text_data_t; |
+///////////////////////////////////////////////////////////////// |
+// load libGUI library and link functions |
+///////////////////////////////////////////////////////////////// |
+void LoadLibGUI(char *lib_path); |
+ |
+//********************************************************************** |
+// libGUI service functions |
+//********************************************************************** |
+ |
+DWORD (stdcall *LibGUIversion)(void); |
+char (stdcall *InitLibGUI)(void); |
+void (stdcall *LibGUImain)(parent_t *WindowParent); |
+void (stdcall *QuitLibGUI)(parent_t *window); |
+ |
+void* (stdcall *CreateWindow)(void); |
+void (stdcall *SetWindowSizeRequest)(parent_t *WindowParent,int size_x,int size_y); |
+ |
+void (stdcall *PackControls)(void *Parent,void *control); |
+void (stdcall *DestroyControl)(void *control); |
+void (stdcall *SetControlSizeRequest)(void *Control,int new_size_x,int new_size_y); |
+int (stdcall *GetControlSizeX)(void *Control); |
+int (stdcall *GetControlSizeY)(void *Control); |
+void (stdcall *SetControlNewPosition)(void *Control,int new_x,int new_y); |
+int (stdcall *GetControlPositionX)(void *Control); |
+int (stdcall *GetControlPositionY)(void *Control); |
+void* (stdcall *SetFocuse)(void *Control); |
+void (stdcall *RedrawControl)(void *Control); |
+void (stdcall *SpecialRedrawControl)(void *Control); |
+ |
+gui_callback_t* (stdcall *SetCallbackFunction)(void *Control, |
+ int event_name,void *callback_func, |
+ void *callback_func_data); |
+void (stdcall *BlockCallbackFunction)(void *Control,gui_callback_t *callback_ID); |
+void (stdcall *UnblockCallbackFunction)(void *Control,gui_callback_t *callback_ID); |
+ |
+void (stdcall *SetIDL_Function)(parent_t *Parent,void *function,void *function_data); |
+void (stdcall *DestroyIDL_Function)(parent_t *Parent); |
+ |
+gui_timer_t* (stdcall *SetTimerCallbackForFunction)(parent_t *parent_window, |
+ int time_tick,void *func,void *func_data); |
+void (stdcall *DestroyTimerCallbackForFunction)(gui_timer_t *timer); |
+ |
+gui_callbackevent_t* (stdcall *SetCallbackFunctionForEvent)(parent_t *parent_window, |
+ int event_type,void *func,void *func_data); |
+void (stdcall *DestroyCallbackFunctionForEvent)(gui_callbackevent_t *callback_event); |
+ |
+gui_button_t* (stdcall *CreateButton)(gui_button_data_t *info_for_control); |
+gui_button_t* (stdcall *CreateButtonWithText)(gui_button_data_t *info,char *txt); |
+ |
+gui_progress_bar_t* (stdcall *CreateProgressBar)(gui_progress_bar_data_t *info_for_control); |
+void (stdcall *SetProgressBarPulse)(gui_progress_bar_t *ProgressBar,int time_update); |
+void (stdcall *ProgressBarSetText)(gui_progress_bar_t *pbar,char *txt); |
+char* (stdcall *ProgressBarGetText)(gui_progress_bar_t *pbar); |
+ |
+gui_scroll_bar_t* (stdcall *CreateHorizontalScrollBar)(gui_scroll_bar_data_t *info_for_control); |
+gui_scroll_bar_t* (stdcall *CreateVerticalScrollBar)(gui_scroll_bar_data_t *info_for_control); |
+ |
+gui_scrolled_window_t* (stdcall *CreateScrolledWindow)(gui_scrolled_window_data_t *info_for_control); |
+void (stdcall *ScrolledWindowPackControls)(gui_scrolled_window_t *parent,void *Control); |
+ |
+gui_image_t* (stdcall *CreateImage)(gui_image_data_t *info_for_control); |
+ |
+gui_text_t* (stdcall *CreateText)(gui_text_data_t *info_for_control); |
+void (stdcall *TextBackgroundOn)(gui_text_t *Text); |
+void (stdcall *TextBackgroundOff)(gui_text_t *Text); |
+ |
+font_t* (stdcall *LoadFont)(char *fullfontname); |
+void (stdcall *FreeFont)(font_t *font); |
+ |
Property changes: |
Added: svn:executable |
/programs/develop/new libGUI_C/SRC/compilation/MinGW/Makefile |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
/programs/develop/new libGUI_C/SRC/compilation/cygwin/Makefile |
---|
0,0 → 1,11 |
SRC = libGUI.c |
TARGET = libGUI.obj |
CFLAGS = -O2 -nostdinc -nostdlib -march=pentium -fomit-frame-pointer -fno-builtin |
CC = gcc |
all: |
$(CC) -c $(SRC) $(CFLAGS) -o $(TARGET) |
strip -X --strip-unneeded $(TARGET) |
clean: |
rm *.obj |
rm $(TARGET) |
/programs/develop/new libGUI_C/SRC/compilation/cygwin |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/develop/new libGUI_C/SRC/control_button.inc |
---|
276,6 → 276,9 |
{ |
if (message->arg3==MOUSE_LEFT_BUTTON_DOWN) |
{ |
if ((button->btn_flags & FLAG_PRESSED_BUTTON_ON)==FALSE) |
{if (button->flags & FLAG_SHOW_CONTROL) |
DrawPressedButton(button);} |
button->btn_flags=button->btn_flags | FLAG_PRESSED_BUTTON_ON; |
} |
} |
291,7 → 294,6 |
(DWORD*)ControlCheckCallbackEvent(button,(DWORD)BUTTON_PRESSED_EVENT); |
main_parent->number_callbacks++; |
} |
if (button->flags & FLAG_SHOW_CONTROL) DrawPressedButton(button); |
} |
} |
break; |
399,7 → 401,7 |
memmove(txtdata.text,txt,len); |
text=CreateText(&txtdata); |
if (text->ctrl_sizex>Button->ctrl_sizex) Button->ctrl_sizex=text->ctrl_sizex+6; |
if (text->ctrl_sizex>Button->ctrl_sizex) Button->ctrl_sizex=text->ctrl_sizex+10; |
if (text->ctrl_sizey>Button->ctrl_sizey) Button->ctrl_sizey=text->ctrl_sizey+6; |
text->ctrl_x=(Button->ctrl_sizex/2)-(text->ctrl_sizex/2); |
/programs/develop/new libGUI_C/SRC/control_progress_bar.inc |
---|
2,7 → 2,6 |
control ProgressBar |
*/ |
void ProgressBarDrawProgress(struct ControlProgressBar *ProgressBar) |
{ |
int x; |
72,11 → 71,12 |
void DrawProgressBar(struct ControlProgressBar *ProgressBar) |
{ |
int x; |
int y; |
int sizex; |
int sizey; |
struct FINITION *fin; |
int x,y,sizex,sizey; |
char c; |
char *save_buf,*buf; |
int save_size_x,save_size_y; |
DWORD draw_output,flags; |
finition_t *fin; |
x=ProgressBar->ctrl_x; |
y=ProgressBar->ctrl_y; |
84,10 → 84,51 |
sizey=ProgressBar->ctrl_sizey; |
fin=(struct FINITION*)ProgressBar->finition; |
Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK); |
Draw(fin,TOOL_GRADIENT_UP_FILLED_RECTANGLE,x+1,y+1,sizex-2,sizey-2,COLOR_MIDDLE_LIGHT,COLOR_LIGHT); |
//alocate a buffer for draw text |
c=screen.bits_per_pixel >> 3; |
buf=malloc(sizex*sizey*c); |
//save current screen parameters |
save_buf=screen.buffer; |
save_size_x=screen.size_x; |
save_size_y=screen.size_y; |
draw_output=screen.draw_output; |
//load parameters of local buffer |
screen.buffer=buf; |
screen.size_x=sizex; |
screen.size_y=sizey; |
screen.draw_output=DRAW_OUTPUT_BUFFER; |
//move control |
SetControlNewPosition(ProgressBar,0,0); |
//save finition parameters |
flags=fin->flags; |
fin->flags &=FINITION_OFF; |
//draw progress bar in buffer |
Draw(fin,TOOL_RECTANGLE,0,0,sizex,sizey,COLOR_ABSOLUTE_DARK); |
ProgressBarDrawProgress(ProgressBar); |
//restore last position of control |
SetControlNewPosition(ProgressBar,x,y); |
//restore finition |
fin->flags=flags; |
//restore screen parameters |
screen.buffer=save_buf; |
screen.size_x=save_size_x; |
screen.size_y=save_size_y; |
screen.draw_output=draw_output; |
//move rendered objects from local buffer to screen |
if (fin->flags & FINITION_ON) |
DrawImageFinit(fin,x,y,sizex,sizey,screen.bits_per_pixel,buf); |
else |
DrawImage(x,y,sizex,sizey,screen.bits_per_pixel,buf); |
//free local buffer |
free(buf); |
} |
void SetProgressBarPulse(struct ControlProgressBar *ProgressBar,int time_tick) |
100,7 → 141,7 |
{ |
main_parent->number_timers_for_controls++; |
ProgressBar->timer=(DWORD*)SetTimerCallbackForControl(time_tick,&ProgressBarDrawProgress,ProgressBar); |
ProgressBar->timer=(DWORD*)SetTimerCallbackForControl(time_tick,&DrawProgressBar,ProgressBar); |
timer=(struct TIMER*)ProgressBar->timer; |
timer->flags=timer->flags | FLAG_TIMER_ON; |
} |
148,6 → 189,7 |
{ |
ProgressBar->ctrl_x=ProgressBar->ctrl_x+message->arg1; |
ProgressBar->ctrl_y=ProgressBar->ctrl_y+message->arg2; |
SendMessage((struct HEADER*)ProgressBar,message); |
break; |
} |
case MESSAGE_CALL_TIMER_EVENT: |
157,6 → 199,7 |
timer=(struct TIMER*)ProgressBar->timer; |
if (timer->flags & FLAG_TIMER_ON) Timer(timer); |
} |
SendMessage((struct HEADER*)ProgressBar,message); |
break; |
} |
case MESSAGE_DESTROY_CONTROL: |
163,6 → 206,7 |
{ |
if (ProgressBar->timer!=(DWORD*)NULL) free(ProgressBar->timer); |
free(ProgressBar->finition); |
SendMessage((struct HEADER*)ProgressBar,message); |
break; |
} |
case MESSAGE_SET_MAIN_PARENT: |
169,13 → 213,12 |
{ |
SendMessage((struct HEADER*)ProgressBar,message); |
ProgressBar->main_parent=(DWORD*)message->arg1; |
SendMessage((struct HEADER*)ProgressBar,message); |
break; |
} |
default: break; |
} |
//send message to child controls(if there is) |
SendMessage((struct HEADER*)ProgressBar,message); |
} |
//--------------------------------------------------------------------------------- |
/programs/develop/new libGUI_C/SRC/control_scrolled_window.inc |
---|
103,45 → 103,26 |
} |
//////////////////////////////////////////////////////////////////////////////// |
// Draw full Scroll Bar |
// Draw full Scrolled Window |
//////////////////////////////////////////////////////////////////////////////// |
void DrawScrolledWindow(struct ControlScrolledWindow *ScrolledWindow) |
void ScrollWin_FuncCallback_HVScroll(struct HEADER* control,void *data) |
{ |
int x,y,sizex,sizey; |
struct FINITION *fin; |
x=ScrolledWindow->ctrl_x; |
y=ScrolledWindow->ctrl_y; |
sizex=ScrolledWindow->ctrl_sizex; |
sizey=ScrolledWindow->ctrl_sizey; |
fin=(struct FINITION*)ScrolledWindow->finition; |
Draw(fin,TOOL_FILLED_RECTANGLE,x+1,y+1,ScrolledWindow->scroll_arrea_sizex, |
ScrolledWindow->scroll_arrea_sizey,COLOR_LIGHT); |
if ((ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_HORIZONTAL_SCROLL_ON) || |
(ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_VERTICAL_SCROLL_ON)) |
{ |
Draw(fin,TOOL_RECTANGLE,x,y,ScrolledWindow->scroll_arrea_sizex+2, |
ScrolledWindow->scroll_arrea_sizey+2,0xff0000); |
} |
else |
Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK); |
} |
void ScrollWin_FuncCallback_HScroll(struct HEADER* control,void *data) |
{ |
struct ControlScrollBar *Hscrollbar,*Vscrollbar; |
struct ControlScrolledWindow *ScrolledWindow; |
struct ControlScrolledWindow *ScrolledWindow; |
struct HEADER *seek_control,*exchange_control; |
struct MESSAGE local_message; |
struct FINITION *fin; |
struct MESSAGE local_message; |
int i,new_x,new_y,x,y,sizex,sizey; |
char c; |
char *save_buf,*buf; |
int save_size_x,save_size_y; |
DWORD draw_output; |
Hscrollbar=(struct ControlScrollBar*)control; |
ScrolledWindow=(struct ControlScrolledWindow*)data; |
ScrolledWindow=(gui_scrolled_window_t*)data; |
Hscrollbar=(gui_scroll_bar_t*)ScrolledWindow->horizontal_scroll; |
Vscrollbar=(gui_scroll_bar_t*)ScrolledWindow->vertical_scroll; |
ScrolledWindow->virtual_x=(ScrolledWindow->virtual_sizex-ScrolledWindow->scroll_arrea_sizex)*Hscrollbar->ruller_pos; |
ScrolledWindow->virtual_y=(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey)*Vscrollbar->ruller_pos; |
x=ScrolledWindow->ctrl_x+1; |
y=ScrolledWindow->ctrl_y+1; |
148,16 → 129,32 |
sizex=ScrolledWindow->scroll_arrea_sizex; |
sizey=ScrolledWindow->scroll_arrea_sizey; |
//alocate a buffer for draw text |
c=screen.bits_per_pixel >> 3; |
i=sizex*sizey*c; |
buf=malloc(i); |
//save current screen parameters |
save_buf=screen.buffer; |
save_size_x=screen.size_x; |
save_size_y=screen.size_y; |
draw_output=screen.draw_output; |
//load parameters of local buffer |
screen.buffer=buf; |
screen.size_x=sizex; |
screen.size_y=sizey; |
screen.draw_output=DRAW_OUTPUT_BUFFER; |
//fill buffer by background color |
FillArrea(buf,i,screen.bits_per_pixel,COLOR_LIGHT); |
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION; |
local_message.arg1=x; |
local_message.arg2=y; |
local_message.arg1=0; |
local_message.arg2=0; |
local_message.arg3=sizex; |
local_message.arg4=sizey; |
fin=(finition_t*)ScrolledWindow->finition; |
Draw(fin,TOOL_FILLED_RECTANGLE,x,y,sizex,sizey,COLOR_LIGHT); |
Vscrollbar=(struct ControlScrollBar*)ScrolledWindow->vertical_scroll; |
seek_control=(struct HEADER*)Vscrollbar->ctrl_fd; |
//move controls in new position |
for(i=0;i<ScrolledWindow->number_virtual_controls;i++) |
167,71 → 164,24 |
SetControlNewPosition(seek_control,new_x,new_y); |
if (CheckCrossRectangles(local_message.arg1,local_message.arg2,local_message.arg3,local_message.arg4, |
seek_control->ctrl_x,seek_control->ctrl_y,seek_control->ctrl_sizex,seek_control->ctrl_sizey)==TRUE) |
if (CheckCrossRectangles(x,y,sizex,sizey,new_x,new_y, |
seek_control->ctrl_sizex, |
seek_control->ctrl_sizey)==TRUE) |
{ |
seek_control->flags=seek_control->flags | FLAG_SHOW_CONTROL; |
seek_control->flags=seek_control->flags & FLAG_MOUSE_BLOCKED_OFF; |
} |
else |
{ |
seek_control->flags=seek_control->flags & FLAG_HIDE_CONTROL; |
seek_control->flags=seek_control->flags | FLAG_MOUSE_BLOCKED_ON; |
} |
if (seek_control->flags & FLAG_SHOW_CONTROL) |
{ |
//move control |
SetControlNewPosition(seek_control,new_x-x,new_y-y); |
//call draw control in buffer |
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc; |
ControlProc(seek_control,&local_message); |
} |
exchange_control=(struct HEADER*)seek_control->ctrl_fd; |
seek_control=exchange_control; |
} |
} |
void ScrollWin_FuncCallback_VScroll(struct HEADER* control,void *data) |
{ |
struct ControlScrollBar *Hscrollbar,*Vscrollbar; |
struct ControlScrolledWindow *ScrolledWindow; |
struct HEADER *seek_control,*exchange_control; |
struct MESSAGE local_message; |
struct FINITION *fin; |
int i,new_x,new_y,x,y,sizex,sizey; |
Vscrollbar=(struct ControlScrollBar*)control; |
ScrolledWindow=(struct ControlScrolledWindow*)data; |
ScrolledWindow->virtual_y=(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey)*Vscrollbar->ruller_pos; |
x=ScrolledWindow->ctrl_x+1; |
y=ScrolledWindow->ctrl_y+1; |
sizex=ScrolledWindow->scroll_arrea_sizex; |
sizey=ScrolledWindow->scroll_arrea_sizey; |
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION; |
local_message.arg1=x; |
local_message.arg2=y; |
local_message.arg3=sizex; |
local_message.arg4=sizey; |
fin=(finition_t*)ScrolledWindow->finition; |
Draw(fin,TOOL_FILLED_RECTANGLE,x,y,sizex,sizey,COLOR_LIGHT); |
seek_control=(struct HEADER*)Vscrollbar->ctrl_fd; |
//move controls in new position |
for(i=0;i<ScrolledWindow->number_virtual_controls;i++) |
{ |
new_x=ScrolledWindow->virtual_controls_x[i]-ScrolledWindow->virtual_x; |
new_y=ScrolledWindow->virtual_controls_y[i]-ScrolledWindow->virtual_y; |
SetControlNewPosition(seek_control,new_x,new_y); |
if (CheckCrossRectangles(local_message.arg1,local_message.arg2,local_message.arg3,local_message.arg4, |
seek_control->ctrl_x,seek_control->ctrl_y,seek_control->ctrl_sizex,seek_control->ctrl_sizey)==TRUE) |
{ |
seek_control->flags=seek_control->flags | FLAG_SHOW_CONTROL; |
seek_control->flags=seek_control->flags & FLAG_MOUSE_BLOCKED_OFF; |
//restore last position of control |
SetControlNewPosition(seek_control,new_x,new_y); |
//restore coordinates of last finition of control |
fin=(finition_t*)seek_control->finition; |
fin->x=x; |
fin->y=y; |
} |
else |
{ |
239,17 → 189,49 |
seek_control->flags=seek_control->flags | FLAG_MOUSE_BLOCKED_ON; |
} |
if (seek_control->flags & FLAG_SHOW_CONTROL) |
{ |
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc; |
ControlProc(seek_control,&local_message); |
} |
exchange_control=(struct HEADER*)seek_control->ctrl_fd; |
seek_control=exchange_control; |
} |
//restore screen parameters |
screen.buffer=save_buf; |
screen.size_x=save_size_x; |
screen.size_y=save_size_y; |
screen.draw_output=draw_output; |
//move rendered objects from local buffer to screen |
fin=(finition_t*)ScrolledWindow->finition; |
if (fin->flags & FINITION_ON) |
DrawImageFinit(fin,x,y,sizex,sizey,screen.bits_per_pixel,buf); |
else |
DrawImage(x,y,sizex,sizey,screen.bits_per_pixel,buf); |
//free local buffer |
free(buf); |
} |
void DrawScrolledWindow(struct ControlScrolledWindow *ScrolledWindow) |
{ |
int x,y,sizex,sizey; |
struct FINITION *fin; |
x=ScrolledWindow->ctrl_x; |
y=ScrolledWindow->ctrl_y; |
sizex=ScrolledWindow->ctrl_sizex; |
sizey=ScrolledWindow->ctrl_sizey; |
fin=(struct FINITION*)ScrolledWindow->finition; |
if ((ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_HORIZONTAL_SCROLL_ON) || |
(ScrolledWindow->scw_flags & FLAG_SCROLL_WIN_VERTICAL_SCROLL_ON)) |
{ |
Draw(fin,TOOL_RECTANGLE,x,y,ScrolledWindow->scroll_arrea_sizex+2, |
ScrolledWindow->scroll_arrea_sizey+2,COLOR_ABSOLUTE_DARK); |
} |
else |
Draw(fin,TOOL_RECTANGLE,x,y,sizex,sizey,COLOR_ABSOLUTE_DARK); |
ScrollWin_FuncCallback_HVScroll(NULL,ScrolledWindow); |
} |
void ScrlWinCheckActivatedForKeysControl(struct ControlScrolledWindow *ScrolledWindow) |
{ |
struct HEADER *control,*seek_control,*exchange_control; |
326,46 → 308,7 |
Vscrollbar->ruller_pos=Vscrollbar->ruller_pos/((float)(ScrolledWindow->virtual_sizey-ScrolledWindow->scroll_arrea_sizey)); |
SpecialRedrawControl(Vscrollbar); |
} |
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION; |
local_message.arg1=x; |
local_message.arg2=y; |
local_message.arg3=sizex; |
local_message.arg4=sizey; |
fin=(finition_t*)ScrolledWindow->finition; |
Draw(fin,TOOL_FILLED_RECTANGLE,x,y,sizex,sizey,COLOR_LIGHT); |
seek_control=(struct HEADER*)Vscrollbar->ctrl_fd; |
//move controls in new position |
for(i=0;i<ScrolledWindow->number_virtual_controls;i++) |
{ |
sx=ScrolledWindow->virtual_controls_x[i]-ScrolledWindow->virtual_x; |
sy=ScrolledWindow->virtual_controls_y[i]-ScrolledWindow->virtual_y; |
SetControlNewPosition(seek_control,sx,sy); |
if (CheckCrossRectangles(x,y,sizex,sizey,seek_control->ctrl_x,seek_control->ctrl_y, |
seek_control->ctrl_sizex,seek_control->ctrl_sizey)==TRUE) |
{ |
seek_control->flags=seek_control->flags | FLAG_SHOW_CONTROL; |
seek_control->flags=seek_control->flags & FLAG_MOUSE_BLOCKED_OFF; |
} |
else |
{ |
seek_control->flags=seek_control->flags & FLAG_HIDE_CONTROL; |
seek_control->flags=seek_control->flags | FLAG_MOUSE_BLOCKED_ON; |
} |
if (seek_control->flags & FLAG_SHOW_CONTROL) |
{ |
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc; |
ControlProc(seek_control,&local_message); |
} |
exchange_control=(struct HEADER*)seek_control->ctrl_fd; |
seek_control=exchange_control; |
} |
ScrollWin_FuncCallback_HVScroll(NULL,ScrolledWindow); |
} |
//--------------------------------------------------------------------------------- |
375,8 → 318,8 |
{ |
int i,x,y,sizex,sizey; |
struct HEADER *seek_control,*exchange_control; |
struct ControlScrollBar *Hscrollbar,*Vscrollbar; |
struct MESSAGE local_message; |
struct ControlScrollBar *Hscrollbar,*Vscrollbar; |
struct MESSAGE local_message; |
struct FINITION *fin; |
struct TIMER *timer; |
393,35 → 336,13 |
if (ScrolledWindow->flags & FLAG_SHOW_CONTROL) |
{ |
DrawScrolledWindow(ScrolledWindow); |
//send message to scroll bars |
Hscrollbar=(struct ControlScrollBar*)ScrolledWindow->horizontal_scroll; |
Vscrollbar=(struct ControlScrollBar*)ScrolledWindow->vertical_scroll; |
ControlProc=(void (*)(void *Control,struct MESSAGE *message))Hscrollbar->ctrl_proc; |
ControlProc((struct HEADER*)Hscrollbar,message); |
ControlProc=(void (*)(void *Control,struct MESSAGE *message))Vscrollbar->ctrl_proc; |
ControlProc((struct HEADER*)Vscrollbar,message); |
//send message finit redraw only to some child controls of ScrolledWondow |
local_message.type=MESSAGE_FULL_REDRAW_ALL_WITH_FINITION; |
local_message.arg1=ScrolledWindow->ctrl_x+1; |
local_message.arg2=ScrolledWindow->ctrl_y+1; |
local_message.arg3=ScrolledWindow->scroll_arrea_sizex; |
local_message.arg4=ScrolledWindow->scroll_arrea_sizey; |
seek_control=(struct HEADER *)Vscrollbar->ctrl_fd; |
while(seek_control!=(struct HEADER*)NULL) |
{ |
if (seek_control->flags & FLAG_SHOW_CONTROL) |
{ |
ControlProc=(void (*)(void *Control,struct MESSAGE *message))seek_control->ctrl_proc; |
ControlProc(seek_control,&local_message); |
} |
exchange_control=(struct HEADER*)seek_control->ctrl_fd; |
seek_control=exchange_control; |
} |
Hscrollbar=(gui_scroll_bar_t*)ScrolledWindow->horizontal_scroll; |
Vscrollbar=(gui_scroll_bar_t*)ScrolledWindow->vertical_scroll; |
//draw scroll bars |
ControlProc=(void (*)(void *Control,gui_message_t *message))Hscrollbar->ctrl_proc; |
ControlProc(Hscrollbar,message); |
ControlProc=(void (*)(void *Control,gui_message_t *message))Vscrollbar->ctrl_proc; |
ControlProc(Vscrollbar,message); |
} |
break; |
} |
590,8 → 511,8 |
HorizontalScrollBar=CreateHorizontalScrollBar(&HorizontalScrollData); |
VerticalScrollBar=CreateVerticalScrollBar(&VerticalScrollData); |
SetCallbackFunction(HorizontalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HScroll,ScrolledWindow); |
SetCallbackFunction(VerticalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_VScroll,ScrolledWindow); |
SetCallbackFunction(HorizontalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HVScroll,ScrolledWindow); |
SetCallbackFunction(VerticalScrollBar,SCROLLBAR_CHANGED_EVENT,&ScrollWin_FuncCallback_HVScroll,ScrolledWindow); |
PackControls(ScrolledWindow,HorizontalScrollBar); |
PackControls(ScrolledWindow,VerticalScrollBar); |
/programs/develop/new libGUI_C/SRC/draw_controls.inc |
---|
1,5 → 1,5 |
/* |
function for draw controls |
functions for draw controls |
*/ |
//--------------------------------------------------------------------------------- |
1219,32 → 1219,37 |
switch(screen.bits_per_pixel) |
{ |
case 32: |
case 24: |
{ |
if (bits_per_pixel==32) |
{//convert 32 bit image to 24 bit image |
j=sizex*sizey; |
ptr_src=img; |
ptr_screen=malloc(j*3); |
ptr_screen2=ptr_screen; |
for(i=0;i<j;i++) |
{ |
*(char*)ptr_screen=*(char*)ptr_src; |
*((char*)ptr_screen+1)=*((char*)ptr_src+1); |
*((char*)ptr_screen+2)=*((char*)ptr_src+2); |
switch(bits_per_pixel) |
{//check bits per pixel in picture |
case 32: |
{//convert 32 bit image to 24 bit image |
j=sizex*sizey; |
ptr_src=img; |
ptr_screen=malloc(j*3); |
ptr_screen2=ptr_screen; |
for(i=0;i<j;i++) |
{ |
*(char*)ptr_screen=*(char*)ptr_src; |
*((char*)ptr_screen+1)=*((char*)ptr_src+1); |
*((char*)ptr_screen+2)=*((char*)ptr_src+2); |
ptr_src+=4; |
ptr_screen+=3; |
ptr_src+=4; |
ptr_screen+=3; |
} |
gui_ksys_put_image_window(ptr_screen2,x,y,countx,county); |
free(ptr_screen2); |
break; |
} |
gui_ksys_put_image_window(ptr_screen2,x,y,countx,county); |
free(ptr_screen2); |
case 24: |
{ |
gui_ksys_put_image_window(img,x,y,countx,county); |
break; |
} |
} |
break; |
} |
case 24: |
{ |
gui_ksys_put_image_window(img,x,y,countx,county); |
break; |
} |
default: break; |
} |
break; |
1258,42 → 1263,38 |
switch(bits_per_pixel) |
{ |
case 32://display 32 bit image in 24 bit mode |
{ |
pitch_screen=screen.size_x*3; |
pitch_src=countx << 2; |
ptr_screen=screen.buffer+pitch_screen*y+x*3; |
{//convert and draw 32 bit image in 24 bit buffer |
ptr_screen=screen.buffer+(screen.size_x*y+x)*3; |
add_screen=(screen.size_x-countx)*3; |
ptr_src=img; |
add_screen=pitch_screen-pitch_src; |
//copy line of byte with size x |
for(i=0;i<county;i++) |
{ |
for(j=0;j<pitch_src;j++) |
for(j=0;j<countx;j++) |
{ |
*(char*)ptr_screen=*(char*)ptr_src; |
ptr_src++; |
ptr_screen++; |
*((char*)ptr_screen+1)=*((char*)ptr_src+1); |
*((char*)ptr_screen+2)=*((char*)ptr_src+2); |
ptr_src+=4; |
ptr_screen+=3; |
} |
ptr_screen+=add_screen; |
} |
break; |
} |
case 24://display 24 bit image in 24 bit mode |
{ |
pitch_screen=screen.size_x*3; |
pitch_src=countx*3; |
ptr_screen=screen.buffer+pitch_screen*y+x*3; |
ptr_src=img; |
add_screen=pitch_screen-pitch_src; |
case 24: |
{//display 24 bit image in 24 bit buffer |
ptr_screen=screen.buffer+(screen.size_x*y+x)*3; |
add_screen=screen.size_x*3; |
add_src=countx*3; |
//copy line of byte with size x |
for(i=0;i<county;i++) |
{ |
for(j=0;j<pitch_src;j++) |
{ |
*(char*)ptr_screen=*(char*)ptr_src; |
ptr_src++; |
ptr_screen++; |
} |
memmove(ptr_screen,img,add_src); |
ptr_screen+=add_screen; |
img+=add_src; |
} |
break; |
} |
1305,30 → 1306,43 |
{ //check source image resolution |
switch(bits_per_pixel) |
{ |
case 32://display 32 bit image in 32 bit mode |
case 32: |
{//display 32 bit image in 32 bit mode |
ptr_screen=screen.buffer+(screen.size_x*y+x)*4; |
add_screen=screen.size_x*4; |
add_src=countx*4; |
//copy line of byte with size x |
for(i=0;i<county;i++) |
{ |
memmove(ptr_screen,img,add_src); |
ptr_screen+=add_screen; |
img+=add_src; |
} |
break; |
} |
case 24://display 24 bit image in 32 bit mode |
{ |
pitch_screen=screen.size_x << 2; |
pitch_src=countx << 2; |
ptr_screen=screen.buffer+pitch_screen*y+x*4; |
ptr_screen=screen.buffer+(screen.size_x*y+x)*4; |
add_screen=(screen.size_x-countx)*4; |
ptr_src=img; |
add_screen=pitch_screen-pitch_src; |
//copy line of byte with size x |
for(i=0;i<county;i++) |
{ |
for(j=0;j<pitch_src;j++) |
for(j=0;j<countx;j++) |
{ |
*(char*)ptr_screen=*(char*)ptr_src; |
ptr_src++; |
ptr_screen++; |
*((char*)ptr_screen+1)=*((char*)ptr_src+1); |
*((char*)ptr_screen+2)=*((char*)ptr_src+2); |
ptr_src+=3; |
ptr_screen+=4; |
} |
ptr_screen+=add_screen; |
} |
break; |
} |
case 24://display 24 bit image in 32 bit mode |
{ |
break; |
} |
default: break; |
} |
default: break; |
1401,6 → 1415,16 |
county=y2-y1+1; |
//cut finited rectangle from image and move them into buffer |
bytes_per_pixel=bits_per_pixel >> 3; |
buf=malloc(countx*county*bytes_per_pixel); |
ptr_dest=buf; |
pitch_src=sizex*bytes_per_pixel; |
ptr_src=img+pitch_src*(y1-y)+(x1-x)*bytes_per_pixel; |
add_src=sizex*bytes_per_pixel; |
countline=countx*bytes_per_pixel; |
switch(bits_per_pixel) |
{ |
case 32: |
1407,26 → 1431,12 |
case 24: |
case 16: |
case 8: |
{ //allocate buffer |
bytes_per_pixel=bits_per_pixel >> 3; |
buf=malloc(countx*county*bytes_per_pixel); |
ptr_dest=buf; |
pitch_src=sizex*bytes_per_pixel; |
ptr_src=img+pitch_src*(y1-y)+(x1-x)*bytes_per_pixel; |
add_src=(sizex-countx)*bytes_per_pixel; |
countline=countx*bytes_per_pixel; |
//copy line of byte with size x |
{ |
for(i=0;i<county;i++) |
{ |
for(j=0;j<countline;j++) |
{ |
*(char*)ptr_dest=*(char*)ptr_src; |
ptr_dest++; |
ptr_src++; |
} |
memmove(ptr_dest,ptr_src,countline); |
ptr_src+=add_src; |
ptr_dest+=countline; |
} |
break; |
} |
/programs/develop/new libGUI_C/SRC/fonts_meneger.inc |
---|
173,9 → 173,9 |
unsigned int i,j,k,step,len; |
int x,y,size_x,save_size_x,save_size_y; |
unsigned char *p,*buf,*save_buf; |
unsigned char c,draw_output; |
unsigned char c; |
DWORD draw_output; |
step=font->sizex*font->sizey; |
len=strlen(s); |
/programs/develop/new libGUI_C/SRC/kolibri_system.h |
---|
313,7 → 313,7 |
} |
//------------------------------------------------------------------------------------------ |
// wait event |
// wait event while not timeout |
//------------------------------------------------------------------------------------------ |
extern inline int gui_ksys_wait_event_with_timeout(DWORD timeout) |
{ |
/programs/develop/new libGUI_C/SRC/libGUI.h |
---|
2,7 → 2,7 |
service structures of libGUI |
*/ |
DWORD ID; |
static DWORD ID; |
//screen's parameters |
#define BYTES_PER_PIXEL 4 |
111,12 → 111,12 |
#define DRAW_OUTPUT_SCREEN 0 |
#define DRAW_OUTPUT_BUFFER 1 |
static struct |
static struct SCREEN |
{ |
char *buffer; |
char bits_per_pixel; |
char bytes_per_pixel; |
char draw_output; |
DWORD bits_per_pixel; |
DWORD bytes_per_pixel; |
DWORD draw_output; |
int x; |
int y; |
int size_x; |
124,6 → 124,7 |
int skin_height; |
int display_size_x; |
int display_size_y; |
char *buffer; |
}screen; |
//////////////////////////////////////////////////////////////// |
/programs/develop/new libGUI_C/SRC/libGUI_menegement.inc |
---|
1326,12 → 1326,13 |
int old_y; |
control=(struct HEADER*)Control; |
/* |
main_parent=(parent_t*)control->main_parent; |
if (control->parent==(DWORD*)main_parent) |
{//check position of child control of main parent |
if (new_x+control->ctrl_sizex-1>screen.size_x) return; |
if (new_y+control->ctrl_sizey-1>screen.size_y) return; |
} |
}*/ |
message.type=(DWORD)MESSAGE_CHANGE_POSITION_EVENT; |
message.arg1=(DWORD)(new_x-control->ctrl_x); |
/programs/develop/new libGUI_C/SRC/main_libGUI.inc |
---|
34,8 → 34,9 |
{ |
//check for timers |
if ((WindowParent->timer_bk!=(DWORD*)NULL) || |
(WindowParent->number_timers_for_controls!=0)) {event=gui_ksys_check_event();} |
else {event=gui_ksys_wait_event();} |
(WindowParent->number_timers_for_controls!=0)) {event=gui_ksys_wait_event_with_timeout(1);} |
else {event=gui_ksys_wait_event();} |
//get and chack system events |
switch(event) |
{ |
/programs/develop/new libGUI_C/SRC/string.inc |
---|
6,15 → 6,30 |
{ |
void *value; |
__asm__ __volatile__( |
"movl %%edi,%%eax\n\t" |
"cld\n\t" |
"rep\n\t" |
"movsb" |
:"=D"(value) |
:"c"(length),"S"(src),"D"(dst) |
:"eax"); |
if (length & 3) |
{//length not aligned in 4 bytes use reb movsb |
__asm__ __volatile__( |
"movl %%edi,%%eax\n\t" |
"cld\n\t" |
"rep\n\t" |
"movsb" |
:"=D"(value) |
:"c"(length),"S"(src),"D"(dst) |
:"eax"); |
} |
else |
{//length aligned in 4 bytes use rep movsd |
length=length >> 2;//length=length/4 |
__asm__ __volatile__( |
"movl %%edi,%%eax\n\t" |
"cld\n\t" |
"rep\n\t" |
"movsd" |
:"=D"(value) |
:"c"(length),"S"(src),"D"(dst) |
:"eax"); |
} |
return(value); |
} |