/programs/develop/libraries/libGUI/examples/src/text.c |
---|
File deleted |
/programs/develop/libraries/libGUI/examples/src/button.c |
---|
File deleted |
/programs/develop/libraries/libGUI/examples/src/progress_bar.c |
---|
File deleted |
/programs/develop/libraries/libGUI/examples/src/image.c |
---|
File deleted |
/programs/develop/libraries/libGUI/examples/src/scroll_bar.c |
---|
File deleted |
/programs/develop/libraries/libGUI/examples/src/scrolled_window.c |
---|
File deleted |
/programs/develop/libraries/libGUI/examples/src/ASM/BUTTON.ASM |
---|
0,0 → 1,115 |
;Hello world example |
use32 |
db 'MENUET01' |
dd 1 |
dd start |
dd i_end |
dd 0x1500 |
dd 0x1500 |
dd 0 |
dd 0 |
TRUE = 1 |
FALSE = 0 |
include 'libGUI.inc' |
start: |
;load libGUI labrari |
push NULL ;use default system path to library |
call LoadLibGUI |
;create main window |
CreateWindow |
mov [window],eax |
;change size of main window |
SetWindowSizeRequest [window],90,60 |
;set callback function for button close window |
SetCallbackFunction [window],DELETE_EVENT,callback_func_delete_window,NULL |
;create control Button with text |
mov [bdata.x],5 |
mov [bdata.y],5 |
mov [bdata.wight],70 |
mov [bdata.height],20 |
CreateButtonWithText bdata,btext |
mov [button],eax |
;set callback functions for button |
SetCallbackFunction [button],BUTTON_ENTER_EVENT,callback_func1,NULL |
SetCallbackFunction [button],BUTTON_PRESSED_EVENT,callback_func2,NULL |
SetCallbackFunction [button],BUTTON_RELEASED_EVENT,callback_func3,NULL |
SetCallbackFunction [button],BUTTON_LEAVE_EVENT,callback_func4,NULL |
;pack control Text in window |
PackControls [window],[button] |
;start libGUI main loop |
LibGUImain [window] |
;void callback_func_delete_window(header_t *control,void *data) |
callback_func_delete_window: |
mov eax,[esp+4] ;control |
QuitLibGUI eax |
ret |
;void callback_func1(header_t *control,void *data) |
callback_func1: |
;save esi befor use |
push esi |
mov esi,btext1 |
call gui_ksys_debug_out_str |
pop esi |
ret |
;void callback_func2(header_t *control,void *data) |
callback_func2: |
;save esi befor use |
push esi |
mov esi,btext2 |
call gui_ksys_debug_out_str |
pop esi |
ret |
;void callback_func3(header_t *control,void *data) |
callback_func3: |
;save esi befor use |
push esi |
mov esi,btext3 |
call gui_ksys_debug_out_str |
pop esi |
ret |
;void callback_func4(header_t *control,void *data) |
callback_func4: |
;save esi befor use |
push esi |
mov esi,btext4 |
call gui_ksys_debug_out_str |
pop esi |
ret |
align 4 |
;----------------------data-------------------- |
btext db 'Click Me!',0 |
btext1 db 13,10,'entry in button',0 |
btext2 db 13,10,'button pressed',0 |
btext3 db 13,10,'button released',0 |
btext4 db 13,10,'leave button',0 |
bdata gui_button_data_t |
window rd 1;parent_t *window |
button rd 1;gui_button_t *button |
i_end: |
/programs/develop/libraries/libGUI/examples/src/ASM/IMAGE.ASM |
---|
0,0 → 1,92 |
;Hello world example |
use32 |
db 'MENUET01' |
dd 1 |
dd start |
dd i_end |
dd 0x1000 |
dd 0x1000 |
dd 0 |
dd 0 |
TRUE = 1 |
FALSE = 0 |
include 'libGUI.inc' |
start: |
;load libGUI labrari |
push NULL ;use default system path to library |
call LoadLibGUI |
;create main window |
CreateWindow |
mov [window],eax |
;change size of main window |
SetWindowSizeRequest [window],220,142 |
;set callback function for button close window |
SetCallbackFunction [window],DELETE_EVENT,callback_func_delete_window,NULL |
;create control Image |
mov [imgdata.x],5 |
mov [imgdata.y],5 |
mov [imgdata.wight],200 |
mov [imgdata.height],100 |
mov [imgdata.bits_per_pixel],32 |
CreateImage imgdata |
mov [image],eax |
;copy data from pointer to local variable |
;for access to filds of structure |
mov ecx,[image] |
mov eax,[ecx+HEADER_SIZE+2] ;pointer to picture |
xor ecx,ecx |
for_size_y: |
xor edx,edx |
for_size_x: |
;generate color |
mov ebx,edx ;i |
mov esi,ecx ;j |
imul ebx,ebx ;i*i |
imul esi,esi ;j*j |
add ebx,esi ;i*i+j*J |
mov esi,edx ;i |
lea esi,[esi+2*esi] ;i*3 |
sub ebx,esi ;i*i+j*j-i*3 |
mov esi,ecx ;j |
shl esi,1 ;j*2 |
add ebx,esi ;i*i+j*j-i*3+2*j |
imul ebx,100 ;100*(i*i+j*j-i*3+2*j) |
mov [eax],ebx |
add eax,4 |
inc edx |
cmp edx,200 |
jl for_size_x |
inc ecx |
cmp ecx,100 |
jl for_size_y |
;pack control Text in window |
PackControls [window],[image] |
;start libGUI main loop |
LibGUImain [window] |
;void callback_func_delete_window(header_t *control,void *data) |
callback_func_delete_window: |
mov eax,[esp+4] ;control |
QuitLibGUI eax |
ret |
align 4 |
;----------------data----------------- |
imgdata gui_image_data_t |
window rd 1;parent_t *window |
image rd 1 |
i_end: |
/programs/develop/libraries/libGUI/examples/src/ASM/PROGRESS_BAR.ASM |
---|
0,0 → 1,191 |
;Hello world example |
use32 |
db 'MENUET01' |
dd 1 |
dd start |
dd i_end |
dd 0x1000 |
dd 0x1000 |
dd 0 |
dd 0 |
TRUE = 1 |
FALSE = 0 |
include 'libGUI.inc' |
start: |
;load libGUI labrari |
push NULL ;use default system path to library |
call LoadLibGUI |
;create main window |
CreateWindow |
mov [window],eax |
;change size of main window |
SetWindowSizeRequest [window],320,57 |
;set callback function for button close window |
SetCallbackFunction [window],DELETE_EVENT,callback_func_delete_window,NULL |
;create control Text |
mov [pbdata.x],5 |
mov [pbdata.y],5 |
mov [pbdata.wight],300;use default system libGUI font |
mov [pbdata.height],25;use background for text |
mov [pbdata.progress],dword 0.0 |
CreateProgressBar pbdata |
mov [progress_bar],eax |
;create timer for update progress level each 50 milliseconds |
SetTimerCallbackForFunction [window],5,progress_bar_callback,[progress_bar] |
;pack control Text in window |
PackControls [window],[progress_bar] |
;redraw progress bar automatically each 50 milleseconds |
SetProgressBarPulse [progress_bar],5 |
;start libGUI main loop |
LibGUImain [window] |
;void progress_bar_callback(void *data) |
progress_bar_callback: |
mov eax,[esp+4];pointer to control progress bar |
mov ecx,[eax+HEADER_SIZE];progress |
mov [progress],ecx |
mov [increment],dword 0.01 |
mov [digit],100 |
fld dword[increment] |
fld dword[progress] |
fadd st0,st1 |
fst dword [progress] |
fild dword[digit] |
fmul st0,st1 |
fistp dword[digit] |
fstp st0 ;free progress |
fstp st0 ;free increment |
cmp [progress],dword 1.0 |
jl no_max_progress |
mov [progress],dword 0.0 |
no_max_progress: |
mov ecx,[progress] |
mov [eax+HEADER_SIZE],ecx ;save new value of progress |
;print progressvalue in string |
push ebx ;save befor use |
mov eax,txt |
add eax,9 |
mov ebx,eax ;save eax |
push eax |
push [digit] |
call dec_to_str |
add ebx,eax |
mov [ebx],byte '%' |
mov [ebx+1],byte 0 |
pop ebx |
;set text for progress bar |
ProgressBarSetText [progress_bar],txt |
ret |
;void callback_func_delete_window(header_t *control,void *data) |
callback_func_delete_window: |
mov eax,[esp+4] ;control |
QuitLibGUI eax |
ret |
;int dectostr(int digit,char *str) |
dec_to_str: |
mov eax,[esp+4];digit |
mov ecx,[esp+8];string |
push ebx esi edi ;save befor use |
cmp eax,10 |
jl print_digit |
mov ebx,eax ;save digit |
mov edi,1 |
mov esi,10 |
next_i_div: |
cdq ;extend to edx:eax |
idiv esi ;eax=eax/esi |
test eax,eax |
jz no_mul_ten |
imul edi,esi ;edi=edi*10 |
no_mul_ten: |
mov eax,edx ;eax=eax % 10 |
cmp eax,esi |
jae next_i_div |
test eax,eax |
jnz no_multyple_10 |
;print digit in string |
mov [ecx],byte '1' |
inc ecx |
mov eax,ebx ;eax=digit |
next_i_str_: |
cdq ;extend to edx:eax |
idiv edi ;eax=eax/edi |
mov [ecx],byte '0' |
inc ecx |
mov eax,edx ;eax=eax % edi |
cmp eax,10 |
jae next_i_str_ |
dec ecx |
jmp exit_multyple |
no_multyple_10: |
;print digit in string |
mov eax,ebx ;eax=digit |
next_i_str: |
cdq ;extend to edx:eax |
idiv edi ;eax=eax/edi |
add al,byte '0' ;al='0'+digit |
mov [ecx],byte al |
inc ecx |
mov eax,edx ;eax=eax % edi |
cmp eax,10 |
jae next_i_str |
print_digit: |
add al,byte '0' |
mov [ecx],byte al |
exit_multyple: |
mov eax,ecx |
pop edi esi ebx |
sub eax,[esp+8] ;number of printed simbols |
inc eax |
ret 8 |
align 4 |
;----------------data----------------- |
txt db 'PROGRESS ',0,0,0,0,0,0 |
pbdata gui_progress_bar_data_t |
window rd 1 |
progress_bar rd 1 |
progress rd 1 |
increment rd 1 |
digit rd 1 |
i_end: |
/programs/develop/libraries/libGUI/examples/src/ASM/SCROLLED_WINDOW.ASM |
---|
0,0 → 1,111 |
;Hello world example |
use32 |
db 'MENUET01' |
dd 1 |
dd start |
dd i_end |
dd 0x10000 |
dd 0x10000 |
dd 0 |
dd 0 |
TRUE = 1 |
FALSE = 0 |
include 'libGUI.inc' |
start: |
;load libGUI labrari |
push NULL ;use default system path to library |
call LoadLibGUI |
;create main window |
CreateWindow |
mov [window],eax |
;change size of main window |
SetWindowSizeRequest [window],270,282 |
;set callback function for button close window |
SetCallbackFunction [window],DELETE_EVENT,callback_func_delete_window,NULL |
;create control HorizontalScrollBar |
mov [swdata.x],5 |
mov [swdata.y],5 |
mov [swdata.wight],250 |
mov [swdata.height],250 |
CreateScrolledWindow swdata |
mov [scrolled_window],eax |
;create buttons |
mov ecx,10 |
next_j: |
mov edx,10 |
next_i: |
mov esi,edx ;i |
mov edi,ecx ;j |
dec esi ;i-1 |
dec edi ;j-1 |
imul esi,75 ;(i-1)*75 |
imul edi,25 ;(j-1)*25 |
add esi,10 ;10+(i-1)*75 |
add edi,10 ;10+(j-1)*25 |
mov [bdata.x],esi |
mov [bdata.y],edi |
mov [bdata.wight],70 |
mov [bdata.height],20 |
push ecx edx esi edi;save registers befor call |
CreateButtonWithText bdata,btxt |
mov [button],eax |
;set callback functions for scroll bars |
SetCallbackFunction [button],BUTTON_PRESSED_EVENT,callback_func,NULL |
;pack control Button in ScrolledWindow |
ScrolledWindowPackControls [scrolled_window],[button] |
pop edi esi edx ecx |
dec edx |
jnz next_i |
dec ecx |
jnz next_j |
;pack scrolled window in window |
PackControls [window],[scrolled_window] |
;start libGUI main loop |
LibGUImain [window] |
;void callback_func(header_t *control,void *data) |
callback_func: |
mov eax,[esp+4];pointer to control |
push esi;save befor use |
mov esi,message |
call gui_ksys_debug_out_str |
pop esi |
ret |
;void callback_func_delete_window(header_t *control,void *data) |
callback_func_delete_window: |
mov eax,[esp+4] ;control |
QuitLibGUI eax |
ret |
align 4 |
;----------------data----------------- |
btxt db 'button',0 |
message db 13,10,'pressed button',0 |
bdata gui_button_data_t |
swdata gui_scrolled_window_data_t |
window rd 1 |
scrolled_window rd 1 |
button rd 1 |
i_end: |
/programs/develop/libraries/libGUI/examples/src/ASM/SCROLL_BAR.ASM |
---|
0,0 → 1,110 |
;Hello world example |
use32 |
db 'MENUET01' |
dd 1 |
dd start |
dd i_end |
dd 0x1000 |
dd 0x1000 |
dd 0 |
dd 0 |
TRUE = 1 |
FALSE = 0 |
include 'libGUI.inc' |
start: |
;load libGUI labrari |
push NULL ;use default system path to library |
call LoadLibGUI |
;create main window |
CreateWindow |
mov [window],eax |
;change size of main window |
SetWindowSizeRequest [window],270,207 |
;set callback function for button close window |
SetCallbackFunction [window],DELETE_EVENT,callback_func_delete_window,NULL |
;create control HorizontalScrollBar |
mov [hsbdata.x],5 |
mov [hsbdata.y],5 |
mov [hsbdata.wight],250 |
mov [hsbdata.height],16 |
mov [hsbdata.ruller_size],dword 0.2 ;ruler size 0..1 |
mov [hsbdata.ruller_pos],dword 0.5 ;ruler position 0..1 |
mov [hsbdata.ruller_step],dword 0.1 ;ruler step 0..1 |
CreateHorizontalScrollBar hsbdata |
mov [hscroll_bar],eax |
;create control HorizontalScrollBar |
mov [vsbdata.x],5 |
mov [vsbdata.y],26 |
mov [vsbdata.wight],16 |
mov [vsbdata.height],150 |
mov [vsbdata.ruller_size],dword 0.5 ;ruler size 0..1 |
mov [vsbdata.ruller_pos],dword 0.05 ;ruler position 0..1 |
mov [vsbdata.ruller_step],dword 0.1 ;ruler step 0..1 |
CreateVerticalScrollBar vsbdata |
mov [vscroll_bar],eax |
;set callback functions for scroll bars |
SetCallbackFunction [hscroll_bar],SCROLLBAR_CHANGED_EVENT,hscroll_bar_callback,NULL |
SetCallbackFunction [vscroll_bar],SCROLLBAR_CHANGED_EVENT,vscroll_bar_callback,NULL |
;pack controls in window |
PackControls [window],[hscroll_bar] |
PackControls [window],[vscroll_bar] |
;start libGUI main loop |
LibGUImain [window] |
;void hscroll_bar_callback(header_ *control,void *data) |
hscroll_bar_callback: |
mov eax,[esp+4];pointer to control scroll bar |
push ebx |
mov ebx,[eax+HEADER_SIZE];size of ruler |
mov ecx,[eax+HEADER_SIZE+4];position of ruler |
mov edx,[eax+HEADER_SIZE+8];step change position of ruler by press |
;buttons of scroll bar |
pop ebx |
ret |
;void hscroll_bar_callback(header_ *control,void *data) |
vscroll_bar_callback: |
mov eax,[esp+4];pointer to control scroll bar |
push ebx ;save befor use |
mov ebx,[eax+HEADER_SIZE];size of ruler |
mov ecx,[eax+HEADER_SIZE+4];position of ruler |
mov edx,[eax+HEADER_SIZE+8];step change position of ruler by press |
;buttons of scroll bar |
pop ebx |
ret |
;void callback_func_delete_window(header_t *control,void *data) |
callback_func_delete_window: |
mov eax,[esp+4] ;control |
QuitLibGUI eax |
ret |
align 4 |
;----------------data----------------- |
hsbdata gui_scroll_bar_data_t |
vsbdata gui_scroll_bar_data_t |
window rd 1 |
hscroll_bar rd 1 |
vscroll_bar rd 1 |
i_end: |
/programs/develop/libraries/libGUI/examples/src/ASM/TEXT.ASM |
---|
0,0 → 1,63 |
;Hello world example |
use32 |
db 'MENUET01' |
dd 1 |
dd start |
dd i_end |
dd 0x800 |
dd 0x800 |
dd 0 |
dd 0 |
TRUE = 1 |
FALSE = 0 |
include 'libGUI.inc' |
start: |
;load libGUI labrari |
push NULL ;use default system path to library |
call LoadLibGUI |
;create main window |
CreateWindow |
mov [window],eax |
;change size of main window |
SetWindowSizeRequest [window],92,46 |
;set callback function for button close window |
SetCallbackFunction [window],DELETE_EVENT,callback_func_delete_window,NULL |
;create control Text |
mov [txtdata.x],5 |
mov [txtdata.y],5 |
mov [txtdata.font],NULL;use default system libGUI font |
mov [txtdata.background],TRUE;use background for text |
mov [txtdata.color],0xffffff;text color |
mov [txtdata.background_color],0xff8000 |
mov [txtdata.text],txt |
CreateText txtdata |
mov [text],eax |
;pack control Text in window |
PackControls [window],[text] |
;start libGUI main loop |
LibGUImain [window] |
;void callback_func_delete_window(header_t *control,void *data) |
callback_func_delete_window: |
mov eax,[esp+4] ;control |
QuitLibGUI eax |
ret |
align 4 |
;----------------data----------------- |
txt db 'Hello world!',0 |
txtdata gui_text_data_t |
window rd 1;parent_t *window |
text rd 1;gui_text_data_t *text |
i_end: |
/programs/develop/libraries/libGUI/examples/src/ASM |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/develop/libraries/libGUI/examples/src/C/button.c |
---|
0,0 → 1,70 |
/* |
test libGUI library |
*/ |
#include "stdarg.h" |
#include "libGUI.h" |
#include "stdio.h" |
#include "stdlib.h" |
#include "string.h" |
#define FALSE 0 |
#define TRUE 1 |
void callback_func_delete_window(header_t *control,void *data) |
{ |
QuitLibGUI((parent_t*)control); |
} |
void callback_func1(header_t *control,void *data) |
{ |
printf("\nentry in button"); |
} |
void callback_func2(header_t *control,void *data) |
{ |
printf("\nbutton pressed"); |
} |
void callback_func3(header_t *control,void *data) |
{ |
printf("\nbutton released"); |
} |
void callback_func4(header_t *control,void *data) |
{ |
printf("\nleave button"); |
} |
int main(int argc, char *argv[]) |
{ |
parent_t *window; |
gui_callback_t *id1,*id2,*id3,*id4; |
gui_button_data_t button_data; |
gui_button_t *button; |
//load libGUI library |
LoadLibGUI(NULL); |
//create main window |
window=CreateWindow(); |
SetWindowSizeRequest(window,90,60); |
//create button |
button_data.x=5; |
button_data.y=5; |
button_data.width=70; |
button_data.height=20; |
//create button with text |
button=CreateButtonWithText(&button_data,"Click my!"); |
//set callback functions for button close window |
SetCallbackFunction(window,DELETE_EVENT,&callback_func_delete_window,NULL); |
//set callback functions for button |
id1=SetCallbackFunction(button,BUTTON_ENTER_EVENT,&callback_func1,NULL); |
id2=SetCallbackFunction(button,BUTTON_PRESSED_EVENT,&callback_func2,NULL); |
id3=SetCallbackFunction(button,BUTTON_RELEASED_EVENT,&callback_func3,NULL); |
id4=SetCallbackFunction(button,BUTTON_LEAVE_EVENT,&callback_func4,NULL); |
//pack button in window |
PackControls(window,button); |
//start main libGUI loop |
LibGUImain(window); |
} |
/programs/develop/libraries/libGUI/examples/src/C/image.c |
---|
0,0 → 1,52 |
/* |
test libGUI library |
*/ |
#include "stdarg.h" |
#include "libGUI.h" |
#include "stdlib.h" |
#include "stdio.h" |
void callback_func_delete_window(header_t *control,void *data) |
{ |
QuitLibGUI((parent_t*)control); |
} |
int main(int argc, char *argv[]) |
{ |
parent_t *window; |
gui_image_data_t imdata; |
gui_image_t *image; |
int i,j; |
unsigned int *img; |
//load libGUI library |
LoadLibGUI(NULL);//use default system path to library |
//create main window |
window=CreateWindow(); |
//change window size |
SetWindowSizeRequest(window,220,142); |
//set callback function for close window button |
SetCallbackFunction(window,DELETE_EVENT,&callback_func_delete_window,NULL); |
//create image |
imdata.x=5; |
imdata.y=5; |
imdata.width=200; |
imdata.height=100; |
imdata.bits_per_pixel=32;//bits per pixel |
image=CreateImage(&imdata); |
img=(unsigned int*)image->img; |
//generate 32 bits image |
for(i=0;i<GetControlSizeY(image);i++) |
{ |
for(j=0;j<GetControlSizeX(image);j++) |
{ |
*img=100*(i*i+j*j-i*3+2*j); |
img++; |
} |
} |
//pack image in window |
PackControls(window,image); |
//start main libGUI loop |
LibGUImain(window); |
} |
/programs/develop/libraries/libGUI/examples/src/C/progress_bar.c |
---|
0,0 → 1,66 |
/* |
test libGUI library |
*/ |
#include "stdarg.h" |
#include "libGUI.h" |
#include "string.h" |
void callback_func_delete_window(header_t *control,void *data) |
{ |
QuitLibGUI((parent_t*)control); |
} |
void ProgressBarCallback(void *data) |
{ |
gui_progress_bar_t *progress_bar; |
int progress; |
static char txt[16]; |
progress_bar=(gui_progress_bar_t*)data; |
progress_bar->progress+=0.01;//incrase progress |
if (progress_bar->progress>1.0) progress_bar->progress=0.0; |
//calculate progress level in % |
progress=progress_bar->progress*100; |
snprintf(txt,16,"progress %d%%",progress); |
//set text for progress bar |
ProgressBarSetText(progress_bar,txt); |
} |
int main(int argc, char *argv[]) |
{ |
parent_t *window; |
gui_progress_bar_data_t progress_bar_data; |
gui_progress_bar_t *progress_bar; |
gui_timer_t *timer; |
//load libGUI library |
LoadLibGUI(NULL);//use default system path to library |
//create main window |
window=CreateWindow(); |
//change size of main window |
SetWindowSizeRequest(window,320,57); |
//set callback function for button close window |
SetCallbackFunction(window,DELETE_EVENT,&callback_func_delete_window,NULL); |
//create progress bar |
progress_bar_data.x=5; |
progress_bar_data.y=5; |
progress_bar_data.width=300; |
progress_bar_data.height=25; |
progress_bar_data.progress=0.0; |
progress_bar=CreateProgressBar(&progress_bar_data); |
//create timer for update progress level each 50 millisecunds |
timer=SetTimerCallbackForFunction(window,5,&ProgressBarCallback,progress_bar); |
//pack progress bar in window |
PackControls(window,progress_bar); |
//update progress bar automatically each 50 millisecund |
SetProgressBarPulse(progress_bar,5); |
//call main libGUI loop |
LibGUImain(window); |
} |
/programs/develop/libraries/libGUI/examples/src/C/scroll_bar.c |
---|
0,0 → 1,76 |
/* |
test libGUI library |
*/ |
#include "stdarg.h" |
#include "libGUI.h" |
#include "stdio.h" |
#define FALSE 0 |
#define TRUE 1 |
void callback_func_delete_window(header_t *control,void *data) |
{ |
printf("\nlibGUI quit..."); |
QuitLibGUI((parent_t*)control); |
} |
void ScrollStateH(header_t *control,void *data) |
{ |
gui_scroll_bar_t *hsc; |
hsc=(gui_scroll_bar_t*)control; |
printf("\nhorizontal ruler position %d%%",(int)(hsc->ruller_pos*100)); |
} |
void ScrollStateV(header_t *control,void *data) |
{ |
gui_scroll_bar_t *vsc; |
vsc=(gui_scroll_bar_t*)control; |
printf("\nvertical ruler position %d%%",(int)(vsc->ruller_pos*100)); |
} |
int main(int argc, char *argv[]) |
{ |
parent_t *window; |
gui_callback_t *id1,*id2; |
gui_scroll_bar_data_t horizontal_sbar_data; |
gui_scroll_bar_data_t vertical_sbar_data; |
gui_scroll_bar_t *ScrollBarH; |
gui_scroll_bar_t *ScrollBarV; |
//load libGUI library |
LoadLibGUI(NULL);//use default system path to library |
//create main window |
window=CreateWindow(); |
//change size of window |
SetWindowSizeRequest(window,270,207); |
//create horizontal scroll bar |
horizontal_sbar_data.x=5; |
horizontal_sbar_data.y=5; |
horizontal_sbar_data.width=250; |
horizontal_sbar_data.height=16; |
horizontal_sbar_data.ruller_size=0.2;//size of ruler E [0,1] |
horizontal_sbar_data.ruller_pos=0.5;//ruler position E [0,1] |
horizontal_sbar_data.ruller_step=0.1;//step of change ruler pos after press of button E [0,1] |
//create vertical scroll bar |
vertical_sbar_data.x=5; |
vertical_sbar_data.y=26; |
vertical_sbar_data.width=16; |
vertical_sbar_data.height=150; |
vertical_sbar_data.ruller_size=0.5;//size of ruler E [0,1] |
vertical_sbar_data.ruller_pos=0.05;//ruler position E [0,1] |
vertical_sbar_data.ruller_step=0.1;//step of change ruler pos after press of button E [0,1] |
//create horizontal and vertical scroll bars |
ScrollBarH=CreateHorizontalScrollBar(&horizontal_sbar_data); |
ScrollBarV=CreateVerticalScrollBar(&vertical_sbar_data); |
//set callback functions for scroll bars |
id1=SetCallbackFunction(ScrollBarH,SCROLLBAR_CHANGED_EVENT,&ScrollStateH,NULL); |
id2=SetCallbackFunction(ScrollBarV,SCROLLBAR_CHANGED_EVENT,&ScrollStateV,NULL); |
//pack scroll bars in window |
PackControls(window,ScrollBarH); |
PackControls(window,ScrollBarV); |
//start minl libGUI loop |
LibGUImain(window); |
} |
/programs/develop/libraries/libGUI/examples/src/C/scrolled_window.c |
---|
0,0 → 1,67 |
/* |
test libGUI library |
*/ |
#include "stdarg.h" |
#include "libGUI.h" |
#include "stdio.h" |
#include "stdlib.h" |
#include "string.h" |
void callback_func_delete_window(header_t *control,void *data) |
{ |
QuitLibGUI((parent_t*)control); |
} |
void callback_func(header_t *control,void *data) |
{ |
printf("\npressed button with ID=%d control=%d",(int)control->ctrl_ID,(int)control); |
} |
int main(int argc, char *argv[]) |
{ |
parent_t *window; |
gui_button_data_t button_data; |
gui_button_t *button; |
gui_scrolled_window_data_t scroll_win_data; |
gui_scrolled_window_t *ScrollWin; |
int i,j; |
static char txt[20]; |
//load libGUI library |
LoadLibGUI(NULL); |
//create main window |
window=CreateWindow(); |
//change size of window |
SetWindowSizeRequest(window,270,282); |
//create scrolled window |
scroll_win_data.x=5; |
scroll_win_data.y=5; |
scroll_win_data.width=250; |
scroll_win_data.height=250; |
ScrollWin=CreateScrolledWindow(&scroll_win_data); |
//create buttons |
for(j=1;j<=10;j++) |
{ |
for(i=1;i<=10;i++) |
{ |
button_data.x=10+(i-1)*75; |
button_data.y=10+(j-1)*25; |
button_data.width=70; |
button_data.height=20; |
snprintf(txt,20,"(%d,%d)",j,i); |
button=CreateButtonWithText(&button_data,txt); |
SetCallbackFunction(button,BUTTON_PRESSED_EVENT,&callback_func,NULL); |
ScrolledWindowPackControls(ScrollWin,button); |
} |
} |
//set callback function for button close window |
SetCallbackFunction(window,DELETE_EVENT,&callback_func_delete_window,NULL); |
//pack scrolled window in window |
PackControls(window,ScrollWin); |
//start main libGUI loop |
LibGUImain(window); |
} |
/programs/develop/libraries/libGUI/examples/src/C/text.c |
---|
0,0 → 1,45 |
/* |
hello world example |
*/ |
#include "libGUI.h" |
#define TRUE 1 |
#define FALSE 0 |
void callback_func_delete_window(header_t *control,void *data) |
{ |
QuitLibGUI((parent_t*)control); |
} |
int main(int argc, char *argv[]) |
{ |
parent_t *window; |
gui_text_data_t txtdata; |
gui_text_t *text; |
//load libGUI library |
LoadLibGUI(NULL);//load from default system path to library |
//create main window |
window=CreateWindow(); |
//change size of window |
SetWindowSizeRequest(window,92,46); |
//set callback function for button close window |
SetCallbackFunction(window,DELETE_EVENT,&callback_func_delete_window,NULL); |
//create control text |
txtdata.x=5; |
txtdata.y=5; |
txtdata.font=NULL;//use default system libGUI font |
txtdata.background=TRUE;//use background for text |
txtdata.color=0xffffff;//text color |
txtdata.background_color=0xff8000;//background color |
txtdata.text="Hello world!"; |
text=CreateText(&txtdata); |
//pack control text in window |
PackControls(window,text); |
//start libGUI main loop |
LibGUImain(window); |
} |
/programs/develop/libraries/libGUI/examples/src/C |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/develop/sdk/trunk/libGUI/MinGW(windows)/libGUI.c |
---|
File deleted |
/programs/develop/sdk/trunk/libGUI/MinGW(windows)/libGUI.h |
---|
File deleted |
/programs/develop/sdk/trunk/libGUI/MinGW(windows) |
---|
Property changes: |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/programs/develop/sdk/trunk/libGUI/Cygwin and MinGW (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; |
}; |
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"); |
} |
} |
/programs/develop/sdk/trunk/libGUI/Cygwin and MinGW (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); |
+ |
/programs/develop/sdk/trunk/libGUI/Cygwin and MinGW (windows) |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/develop/sdk/trunk/libGUI/FASM/LIBGUI.INC |
---|
0,0 → 1,1070 |
;----------------------------------------------------------------------- |
; assembler SDK for libGUI |
;----------------------------------------------------------------------- |
HEADER_SIZE = 18*4 |
NULL = 0 |
;/////////////////////////////////////////////////////////////////////// |
;// libGUI system messages types |
;/////////////////////////////////////////////////////////////////////// |
MESSAGE_FULL_REDRAW_ALL = 1 |
MESSAGE_KEYS_EVENT = 2 |
MESSAGE_SPECIALIZED = 3 |
MESSAGE_SET_FOCUSE = 4 |
MESSAGE_CHANGE_FOCUSE = 5 |
MESSAGE_MOUSE_EVENT = 6 |
MESSAGE_CHANGE_POSITION_EVENT = 7 |
MESSAGE_CHANGESIZE_EVENT = 8 |
MESSAGE_CALL_TIMER_EVENT = 9 |
MESSAGE_FULL_REDRAW_ALL_WITH_FINITION = 10 |
MESSAGE_SET_MAIN_PARENT = 11 |
MESSAGE_DESTROY_CONTROL = -1 |
;/////////////////////////////////////////////////////////////////////// |
;// system keys states |
;/////////////////////////////////////////////////////////////////////// |
KEY_DOWN = 16 |
KEY_UP = 17 |
KEY_HOTKEY = 18 |
;/////////////////////////////////////////////////////////////////////// |
;// system mouse buttons states |
;/////////////////////////////////////////////////////////////////////// |
MOUSE_LEFT_BUTTON_DOWN = 19 |
MOUSE_LEFT_BUTTON_UP = 20 |
MOUSE_RIGHT_BUTTON_DOWN = 21 |
MOUSE_RIGHT_BUTTON_UP = 22 |
MOUSE_MIDDLE_BUTTON_DOWN = 23 |
MOUSE_MIDDLE_BUTTON_UP = 24 |
MOUSE_4_BUTTON_DOWN = 25 |
MOUSE_4_BUTTON_UP = 26 |
MOUSE_5_BUTTON_DOWN = 27 |
MOUSE_5_BUTTON_UP = 28 |
;--------------------------------------------------------------------- |
; CONNECT EVENTS FOR CALLBACKs |
;--------------------------------------------------------------------- |
;//////////////////////////////////////////////////////////////// |
;// connect events for button |
;//////////////////////////////////////////////////////////////// |
BUTTON_ENTER_EVENT = 29 |
BUTTON_LEAVE_EVENT = 30 |
BUTTON_PRESSED_EVENT = 31 |
BUTTON_RELEASED_EVENT = 32 |
;//////////////////////////////////////////////////////////////// |
;// connect events for scroll bar |
;//////////////////////////////////////////////////////////////// |
SCROLLBAR_CHANGED_EVENT = 33 |
;//////////////////////////////////////////////////////////////// |
;// connect events for main parent window |
;//////////////////////////////////////////////////////////////// |
DELETE_EVENT = 36 |
;----------------------------------------------------------------------- |
;------------------------libGUI functions------------------------------- |
;----------------------------------------------------------------------- |
;DWORD LibGUIversion(void); |
macro LibGUIversion |
{ |
call [imp_LibGUIversion] |
} |
;char InitLibGUI(void); |
macro InitLibGUI |
{ |
call [imp_InitLibGUI] |
} |
;void LibGUImain(parent_t *WindowParent); |
macro LibGUImain WindowParent |
{ |
pushd WindowParent |
call [imp_LibGUImain] |
add esp,1*4 |
} |
;void QuitLibGUI(parent_t *window); |
macro QuitLibGUI window |
{ |
pushd window |
call [imp_QuitLibGUI] |
add esp,1*4 |
} |
;void* CreateWindow(void) |
macro CreateWindow |
{ |
call [imp_CreateWindow] |
} |
;void SetWindowSizeRequest(parent_t *WindowParent,int size_x,int size_y) |
macro SetWindowSizeRequest WindowParent,sizex,sizey |
{ |
pushd sizey |
pushd sizex |
pushd WindowParent |
call [imp_SetWindowSizeRequest] |
add esp,3*4 |
} |
;void PackControls(void *Parent,void *control); |
macro PackControls Parent,control |
{ |
pushd control |
pushd Parent |
call [imp_PackControls] |
add esp,2*4 |
} |
;void DestroyControl(void *control); |
macro DestroyControl control |
{ |
pushd control |
call [imp_DestroyControl] |
add esp,1*4 |
} |
;void SetControlSizeRequest(void *Control,int new_size_x,int new_size_y); |
macro SetControlSizeRequest Control,new_size_x,new_size_y |
{ |
pushd new_size_y |
pushd new_size_x |
pushd Control |
call [imp_SetControlSizeRequest] |
add esp 3*4 |
} |
;int GetControlSizeX(void *Control); |
macro GetControlSizeX Control |
{ |
pushd Control |
call [imp_GetControlSizeX] |
add esp 1*4 |
} |
;int GetControlSizeY(void *Control); |
macro GetControlSizeY Control |
{ |
pushd Control |
call [imp_GetControlSizeY] |
add esp 1*4 |
} |
;void SetControlNewPosition(void *Control,int new_x,int new_y) |
macro SetControlNewPosition Control,new_x,new_y |
{ |
pushd new_y |
pushd new_x |
pushd Control |
call [imp_SetControlNewPosition] |
add esp,3*4 |
} |
;int GetControlPositionX(void *Control); |
macro GetControlPositionX Control |
{ |
pushd Control |
call [imp_GetControlPositionX] |
add esp,1*4 |
} |
;int GetControlPositionY(void *Control); |
macro GetControlPositionY Control |
{ |
pushd Control |
call [imp_GetControlPositionY] |
add esp,1*4 |
} |
;void* SetFocuse(void *Control); |
macro SetFocuse Control |
{ |
pushd Control |
call [imp_SetFocuse] |
add esp,1*4 |
} |
;void RedrawControl(void *Control) |
macro RedrawControl Control |
{ |
pushd Control |
call [imp_RedrawControl] |
add esp,1*4 |
} |
;void SpecialRedrawControl(void *Control) |
macro SpecialRedrawControl Control |
{ |
pushd Control |
call [imp_SpecialRedrawControl] |
add esp,1*4 |
} |
;SetCallbackFunction(void *Control,int event_name,void *callback_func,void *callback_func_data); |
macro SetCallbackFunction Control,event_name,callback_func,callback_func_data |
{ |
pushd callback_func_data |
pushd callback_func |
pushd event_name |
pushd Control |
call [imp_SetCallbackFunction] |
add esp,4*4 |
} |
;BlockCallbackFunction(void *Control,gui_callback_t *callback_ID) |
macro BlockCallbackFunction Control,callback_ID |
{ |
pushd callback_ID |
pushd Control |
call [imp_BlockCallbackFunction] |
add esp,2*4 |
} |
;void UnblockCallbackFunction(void *Control,gui_callback_t *callback_ID) |
macro UnblockCallbackFunction Control,callback_ID |
{ |
pushd callback_ID |
pushd Control |
call [imp_UnblockCallbackFunction] |
add esp,2*4 |
} |
;void SetIDL_Function(parent_t *Parent,void *function,void *function_data) |
macro SetIDL_Function Parent,function,function_data |
{ |
pushd function_data |
pushd function |
pushd Parent |
call [imp_SetIDL_Function] |
add esp,3*4 |
} |
;void DestroyIDL_Function(parent_t *Parent) |
macro DestroyIDL_Function Parent |
{ |
pushd Parent |
call [imp_DestroyIDL_Function] |
add eso,1*4 |
} |
;SetTimerCallbackForFunction(parent_t *parent_window,int time_tick,void *func,void *func_data) |
macro SetTimerCallbackForFunction parent_window,time_tick,func,func_data |
{ |
pushd func_data |
pushd func |
pushd time_tick |
pushd parent_window |
call [imp_SetTimerCallbackForFunction] |
add esp,4*4 |
} |
;DestroyTimerCallbackForFunction(gui_timer_t *timer) |
macro DestroyTimerCallbackForFunction timer |
{ |
pushd timer |
call [imp_DestroyTimerCallbackForFunction] |
add esp,1*4 |
} |
;SetCallbackFunctionForEvent)(parent_t *parent_window,int event_type,void *func,void *func_data) |
macro SetCallbackFunctionForEvent parent_window,event_type,func,func_data |
{ |
pushd func_data |
pushd func |
pushd event_type |
pushd parent_window |
call [imp_SetCallbackFunctionForEvent] |
add esp,4*4 |
} |
;DestroyCallbackFunctionForEvent(gui_callbackevent_t *callback_event) |
macro DestroyCallbackFunctionForEvent callback_event |
{ |
pushd callback_event |
call [imp_DestroyCallbackFunctionForEvent] |
add esp,1*4 |
} |
;CreateButton(gui_button_data_t *info_for_control) |
macro CreateButton info_for_control |
{ |
pushd info_for_control |
call [imp_CreateButton] |
add esp,1*4 |
} |
;CreateButtonWithText(gui_button_data_t *info,char *txt) |
macro CreateButtonWithText info,txt |
{ |
pushd txt |
pushd info |
call [imp_CreateButtonWithText] |
add esp,2*4 |
} |
;CreateProgressBar(gui_progress_bar_data_t *info_for_control) |
macro CreateProgressBar info_for_control |
{ |
pushd info_for_control |
call [imp_CreateProgressBar] |
add esp,1*4 |
} |
;SetProgressBarPulse)(gui_progress_bar_t *ProgressBar,int time_update) |
macro SetProgressBarPulse ProgressBar,time_update |
{ |
pushd time_update |
pushd ProgressBar |
call [imp_SetProgressBarPulse] |
add esp,2*4 |
} |
;ProgressBarSetText(gui_progress_bar_t *pbar,char *txt) |
macro ProgressBarSetText pbar,txt |
{ |
pushd txt |
pushd pbar |
call [imp_ProgressBarSetText] |
add esp,2*4 |
} |
;ProgressBarGetText(gui_progress_bar_t *pbar) |
macro ProgressBarGetText pbar |
{ |
pushd pbar |
call [imp_ProgressBarGetText] |
add esp,1*4 |
} |
;CreateHorizontalScrollBar(gui_scroll_bar_data_t *info_for_control) |
macro CreateHorizontalScrollBar info_for_control |
{ |
pushd info_for_control |
call [imp_CreateHorizontalScrollBar] |
add esp,1*4 |
} |
;CreateVerticalScrollBar(gui_scroll_bar_data_t *info_for_control) |
macro CreateVerticalScrollBar info_for_control |
{ |
pushd info_for_control |
call [imp_CreateVerticalScrollBar] |
add esp,1*4 |
} |
;CreateScrolledWindow)(gui_scrolled_window_data_t *info_for_control) |
macro CreateScrolledWindow info_for_control |
{ |
pushd info_for_control |
call [imp_CreateScrolledWindow] |
add esp,1*4 |
} |
;ScrolledWindowPackControls(gui_scrolled_window_t *parent,void *Control) |
macro ScrolledWindowPackControls parent,Control |
{ |
pushd Control |
pushd parent |
call [imp_ScrolledWindowPackControls] |
add esp,2*4 |
} |
;CreateImage(gui_image_data_t *info_for_control) |
macro CreateImage info_for_control |
{ |
pushd info_for_control |
call [imp_CreateImage] |
add esp,1*4 |
} |
;CreateText(gui_text_data_t *info_for_control) |
macro CreateText info_for_control |
{ |
pushd info_for_control |
call [imp_CreateText] |
add esp,1*4 |
} |
;TextBackgroundOn(gui_text_t *Text) |
macro TextBackgroundOn Txt |
{ |
pushd Txt |
call [imp_TextBackgroundOn] |
add esp,1*4 |
} |
;TextBackgroundOff(gui_text_t *Text) |
macro TextBackgroundOff Txt |
{ |
pushd Txt |
call [imp_TextBackgroundOff] |
add esp,1*4 |
} |
;LoadFont(char *fullfontname) |
macro LoadFont fullfontname |
{ |
pushd fullfontname |
call [imp_LoadFont] |
add esp,1*4 |
} |
;FreeFont(font_t *font) |
macro FreeFont font |
{ |
pushd font |
call [imp_FreeFont] |
add esp,1*4 |
} |
;---------------------------------------------------------------- |
;----------------------debug output------------------------------ |
;---------------------------------------------------------------- |
;IN |
;esi=stirng |
align 4 |
gui_ksys_debug_out_str: |
pushad |
mov eax,63 |
mov ebx,1 |
next_simbol_print: |
xor edx,edx |
mov dl,[esi] |
test dl,dl |
jz exit_print_str |
cmp dl,10 |
jne no_new_line |
mov ecx,13 |
int 0x40 |
no_new_line: |
xor ecx,ecx |
mov cl, dl |
int 0x40 |
add esi,1 |
jmp next_simbol_print |
exit_print_str: |
popad |
ret |
;------------------------------------------------------------------- |
;-------------------get proc from export table---------------------- |
;------------------------------------------------------------------- |
;INPUT |
;ebx=pointer to export table |
;esi=pointer to function name |
;OUTPUT |
;eax=pointer to function |
align 4 |
gui_ksys_cofflib_getproc: |
next_name_check: |
mov ecx,[ebx] |
test ecx,ecx |
jz end_export |
push esi |
;cmp export string with name |
next_simbol_check: |
xor eax,eax |
mov al,[ecx];load byte of func name from export |
xor edx,edx |
mov dl,[esi] |
cmp al,dl |
jne exit_check_simbol |
test al,al |
jne no_end_string |
mov eax,[ebx+4] |
pop esi |
jmp end_export |
no_end_string: |
add ecx,1 |
add esi,1 |
jmp next_simbol_check |
exit_check_simbol: |
pop esi |
add ebx,8 |
jmp next_name_check |
end_export: |
ret |
;------------------------------------------------------------------- |
;-----------------------Link libGUI--------------------------------- |
;------------------------------------------------------------------- |
link_libGUI: |
mov edi,eax;save export table pointer |
mov esi,libGUI_imp |
next_libGUI_func_link: |
push esi |
mov eax,esi |
mov esi,[eax] |
mov ebx,edi;pointer to export table |
call gui_ksys_cofflib_getproc |
pop esi |
mov [esi],eax ;func proc |
add esi,4 |
cmp [esi],dword 0 |
jne next_libGUI_func_link |
ret |
;//////////////////////////////////////////////////////////////// |
;// Load libGUI |
;//////////////////////////////////////////////////////////////// |
;IN |
;pointer to path or |
LoadLibGUI: |
push eax |
push ebx |
push ecx |
push edx |
push esi |
push edi |
mov ecx,[esp+28];path |
test ecx,ecx |
jnz have_other_path |
mov ecx,sys_libGUI_path |
have_other_path: |
;try to load libGUI library |
mov eax,68 |
mov ebx,19 |
int 0x40 |
test eax,eax |
jnz libGUI_loaded_successfully |
mov esi,message_cant_load_lib |
call gui_ksys_debug_out_str |
xor eax,eax |
dec eax |
int 0x40;system exit program |
libGUI_loaded_successfully: |
call link_libGUI |
mov eax,68 |
mov ebx,11 |
int 0x40 |
InitLibGUI |
test eax,eax |
jz libGUI_initialized_successfully |
mov esi,message_cant_initialize_lib |
call gui_ksys_debug_out_str |
xor eax,eax |
dec eax |
int 0x40;system exit program |
libGUI_initialized_successfully: |
pop edi |
pop esi |
pop edx |
pop ecx |
pop ebx |
pop eax |
ret 4 |
;//////////////////////////////////////////////////////////////// |
;// font type structure |
;//////////////////////////////////////////////////////////////// |
struc font_t |
{ |
.fnt_draw rd 1;pointer |
.fnt_unpacker rd 1;pointer |
.fnt_fd rd 1;pointer |
.fnt_bk rd 1;pointer |
.sizex rd 1; |
.sizey rd 1; |
.size rd 1; |
.encoding_type rd 1; |
.font rd 1;pointer |
.fnt_name rd 1;pointer |
.type rd 1; |
.flags rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// header of parent of control |
;//////////////////////////////////////////////////////////////// |
struc parent_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
.control_for_callback_function rd 1;array of pointers |
.callback_for_control_callback rd 1;array of pointers |
.number_callbacks rd 1; |
.global_active_control_for_keys rd 1;pointer |
.message rd 1;pointer |
.timer_bk rd 1;pointer |
.timer_fd rd 1;pointer |
.number_timers_for_controls rd 1; |
.calev_bk rd 1;pointer |
.calev_fd rd 1;pointer |
.IDL_func rd 1;pointer |
.IDL_func_data rd 1;pointer |
} |
;//////////////////////////////////////////////////////////////// |
;// header of control |
;//////////////////////////////////////////////////////////////// |
struc header_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// callback structure for callback function of control |
;//////////////////////////////////////////////////////////////// |
struc gui_callback_t |
{ |
.clb_bk rd 1;pointer |
.clb_fd rd 1;pointer |
.clb_control rd 1;pointer |
.func rd 1;pointer |
.func_data rd 1;pointer |
.connect_event rd 1; |
.flags rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// timer |
;//////////////////////////////////////////////////////////////// |
struc gui_timer_t |
{ |
.tmr_bk rd 1;pointer |
.tmr_fd rd 1;pointer |
.tmr_parent rd 1;pointer |
.func rd 1;pointer |
.func_data rd 1;pointer |
.last_time rd 1; |
.time_tick rd 1; |
.flags rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// structure for callback events |
;//////////////////////////////////////////////////////////////// |
struc gui_callbackevent_t |
{ |
.calev_bk rd 1;pointer |
.calev_fd rd 1;pointer |
.calev_parent rd 1;pointer |
.func rd 1;pointer |
.func_data rd 1;pointer |
.event_type rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// type of data - structure message |
;//////////////////////////////////////////////////////////////// |
struc gui_message_t |
{ |
.type rd 1; |
.arg1 rd 1; |
.arg2 rd 1; |
.arg3 rd 1; |
.arg4 rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// button |
;//////////////////////////////////////////////////////////////// |
struc gui_button_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
.btn_flags rb 1; |
} |
;information for creating control Button |
struc gui_button_data_t |
{ |
.x rd 1; |
.y rd 1; |
.wight rd 1; |
.height rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// scroll bar |
;//////////////////////////////////////////////////////////////// |
struc gui_scroll_bar_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
.ruller_size rd 1;float |
.ruller_pos rd 1;float |
.ruller_step rd 1;float |
.scb_flags rb 1; |
} |
struc gui_scroll_bar_data_t |
{ |
.x rd 1; |
.y rd 1; |
.wight rd 1; |
.height rd 1; |
.ruller_size rd 1;float |
.ruller_pos rd 1;float |
.ruller_step rd 1;float |
} |
;//////////////////////////////////////////////////////////////// |
;// progressbar |
;//////////////////////////////////////////////////////////////// |
struc gui_progress_bar_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
.progress rd 1;float |
.prb_flags rb 1; |
} |
struc gui_progress_bar_data_t |
{ |
.x rd 1; |
.y rd 1; |
.wight rd 1; |
.height rd 1; |
.progress rd 1;float |
} |
;//////////////////////////////////////////////////////////////// |
;// scrolled window |
;//////////////////////////////////////////////////////////////// |
struc gui_scrolled_window_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
.virtual_x rd 1; |
.virtual_y rd 1; |
.virtual_sizex rd 1; |
.virtual_sizey rd 1; |
.virtual_controls_x rd 1;pointer |
.virtual_controls_y rd 1;pointer |
.number_virtual_controls rd 1; |
.scroll_arrea_sizex rd 1; |
.scroll_arrea_sizey rd 1; |
.horizontal_scroll rd 1;pointer |
.vertical_scroll rd 1;pointer |
.scw_flags rb 1; |
} |
struc gui_scrolled_window_data_t |
{ |
.x rd 1; |
.y rd 1; |
.wight rd 1; |
.height rd 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// image |
;//////////////////////////////////////////////////////////////// |
struc gui_image_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
.bits_per_pixel rb 1; |
.bytes_per_pixel rb 1; |
.img rd 1;pointer |
} |
struc gui_image_data_t |
{ |
.x rd 1; |
.y rd 1; |
.wight rd 1; |
.height rd 1; |
.bits_per_pixel rb 1; |
} |
;//////////////////////////////////////////////////////////////// |
;// text |
;//////////////////////////////////////////////////////////////// |
struc gui_text_t |
{ |
.ctrl_proc rd 1;pointer |
.ctrl_fd rd 1;pointer |
.ctrl_bk rd 1;pointer |
.child_fd rd 1;pointer |
.child_bk rd 1;pointer |
.parent rd 1;pointer |
.main_parent rd 1;pointer |
.ctrl_x rd 1; |
.ctrl_y rd 1; |
.ctrl_sizex rd 1; |
.ctrl_sizey rd 1; |
.ctrl_ID rd 1; |
.active_control_for_keys rd 1;pointer |
.active_control_for_mouse rd 1;pointer |
.callback rd 1;pointer |
.finition rd 1;pointer |
.timer rd 1;pointer |
.flags rd 1; |
.font rd 1;pointer |
.color rd 1; |
.background_color rd 1; |
.text rd 1;pointer |
.txt_flags rb 1; |
} |
struc gui_text_data_t |
{ |
.x rd 1; |
.y rd 1; |
.font rd 1;pointer |
.color rd 1; |
.background_color rd 1; |
.background rb 1; |
.text rd 1;pointer |
} |
;//********************************************************************** |
;// libGUI service functions |
;//********************************************************************** |
;default system path to libGUI |
sys_libGUI_path db '/sys/lib/libGUI.obj',0 |
message_cant_load_lib db 'cant load lib',13,10,0 |
message_cant_initialize_lib db 'cant initialize libGUI',13,10,0 |
szLibGUIversion db 'LibGUIversion',0 |
szInitLibGUI db 'InitLibGUI',0 |
szLibGUImain db 'LibGUImain',0 |
szQuitLibGUI db 'QuitLibGUI',0 |
szCreateWindow db 'CreateWindow',0 |
szSetWindowSizeRequest db 'SetWindowSizeRequest',0 |
szPackControls db 'PackControls',0 |
szDestroyControl db 'DestroyControl',0 |
szSetControlSizeRequest db 'SetControlSizeRequest',0 |
szGetControlSizeX db 'GetControlSizeX',0 |
szGetControlSizeY db 'GetControlSizeY',0 |
szSetControlNewPosition db 'SetControlNewPosition',0 |
szGetControlPositionX db 'GetControlPositionX',0 |
szGetControlPositionY db 'GetControlPositionY',0 |
szSetFocuse db 'SetFocuse',0 |
szRedrawControl db 'RedrawControl',0 |
szSpecialRedrawControl db 'SpecialRedrawControl',0 |
szSetCallbackFunction db 'SetCallbackFunction',0 |
szBlockCallbackFunction db 'BlockCallbackFunction',0 |
szUnblockCallbackFunction db 'UnblockCallbackFunction',0 |
szSetIDL_Function db 'SetIDL_Function',0 |
szDestroyIDL_Function db 'DestroyIDL_Function',0 |
szSetTimerCallbackForFunction db 'SetTimerCallbackForFunction',0 |
szDestroyTimerCallbackForFunction db 'DestroyTimerCallbackForFunction',0 |
szSetCallbackFunctionForEvent db 'SetCallbackFunctionForEvent',0 |
szDestroyCallbackFunctionForEvent db 'DestroyCallbackFunctionForEvent',0 |
szCreateButton db 'CreateButton',0 |
szCreateButtonWithText db 'CreateButtonWithText',0 |
szCreateProgressBar db 'CreateProgressBar',0 |
szSetProgressBarPulse db 'SetProgressBarPulse',0 |
szProgressBarSetText db 'ProgressBarSetText',0 |
szProgressBarGetText db 'ProgressBarGetText',0 |
szCreateHorizontalScrollBar db 'CreateHorizontalScrollBar',0 |
szCreateVerticalScrollBar db 'CreateVerticalScrollBar',0 |
szCreateScrolledWindow db 'CreateScrolledWindow',0 |
szScrolledWindowPackControls db 'ScrolledWindowPackControls',0 |
szCreateImage db 'CreateImage',0 |
szCreateText db 'CreateText',0 |
szTextBackgroundOn db 'TextBackgroundOn',0 |
szTextBackgroundOff db 'TextBackgroundOff',0 |
szLoadFont db 'LoadFont',0 |
szFreeFont db 'FreeFont',0 |
libGUI_imp: |
imp_LibGUIversion dd szLibGUIversion |
imp_InitLibGUI dd szInitLibGUI |
imp_LibGUImain dd szLibGUImain |
imp_QuitLibGUI dd szQuitLibGUI |
imp_CreateWindow dd szCreateWindow |
imp_SetWindowSizeRequest dd szSetWindowSizeRequest |
imp_PackControls dd szPackControls |
imp_DestroyControl dd szDestroyControl |
imp_SetControlSizeRequest dd szSetControlSizeRequest |
imp_GetControlSizeX dd szGetControlSizeX |
imp_GetControlSizeY dd szGetControlSizeY |
imp_SetControlNewPosition dd szSetControlNewPosition |
imp_GetControlPositionX dd szGetControlPositionX |
imp_GetControlPositionY dd szGetControlPositionY |
imp_SetFocuse dd szSetFocuse |
imp_RedrawControl dd szRedrawControl |
imp_SpecialRedrawControl dd szSpecialRedrawControl |
imp_SetCallbackFunction dd szSetCallbackFunction |
imp_BlockCallbackFunction dd szBlockCallbackFunction |
imp_UnblockCallbackFunction dd szUnblockCallbackFunction |
imp_SetIDL_Function dd szSetIDL_Function |
imp_DestroyIDL_Function dd szDestroyIDL_Function |
imp_SetTimerCallbackForFunction dd szSetTimerCallbackForFunction |
imp_DestroyTimerCallbackForFunction dd szDestroyTimerCallbackForFunction |
imp_SetCallbackFunctionForEvent dd szSetCallbackFunctionForEvent |
imp_DestroyCallbackFunctionForEvent dd szDestroyCallbackFunctionForEvent |
imp_CreateButton dd szCreateButton |
imp_CreateButtonWithText dd szCreateButtonWithText |
imp_CreateProgressBar dd szCreateProgressBar |
imp_SetProgressBarPulse dd szSetProgressBarPulse |
imp_ProgressBarSetText dd szProgressBarSetText |
imp_ProgressBarGetText dd szProgressBarGetText |
imp_CreateHorizontalScrollBar dd szCreateHorizontalScrollBar |
imp_CreateVerticalScrollBar dd szCreateVerticalScrollBar |
imp_CreateScrolledWindow dd szCreateScrolledWindow |
imp_ScrolledWindowPackControls dd szScrolledWindowPackControls |
imp_CreateImage dd szCreateImage |
imp_CreateText dd szCreateText |
imp_TextBackgroundOn dd szTextBackgroundOn |
imp_TextBackgroundOff dd szTextBackgroundOff |
imp_LoadFont dd szLoadFont |
imp_FreeFont dd szFreeFont |
dd 0 |
/programs/develop/sdk/trunk/libGUI/FASM |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |