| version 1.1, 2005/11/25 22:41:26 |
version 1.2, 2005/11/26 12:26:58 |
|
|
| // Copyright (c) 2005 Michal Sudolsky |
/*
|
| // modified by Juraj Kolesár <koli@koli.sk> |
Name: share.h
|
| |
Author: Michal Sudolsky
|
| |
Date: 26.08.2005 17:43
|
| |
*/
|
| |
|
| #ifndef false |
#ifndef false |
| #define false 0 |
#define false 0 |
|
|
| |
|
| #define NOCHANGE 0x7FFFFFFF |
#define NOCHANGE 0x7FFFFFFF |
| |
|
| |
#define MAXLONG 0x7FFFFFFF |
| |
|
| #define CCOFFSET 32 |
#define CCOFFSET 32 |
| |
|
| #define KKOFFSET 256 |
#define KKOFFSET 256 |
|
|
| #define MDMASK 0xE000 |
#define MDMASK 0xE000 |
| |
|
| #define ST_VISIBLE 0x00010000 |
#define ST_VISIBLE 0x00010000 |
| |
#define ST_AUTOXSIZE 0x00020000 |
| |
#define ST_AUTOYSIZE 0x00040000 |
| |
#define ST_AL_LEFT 0x00080000 // ST_Ax_yyy s rovnakym x sa nesmu navzajom kombinovat |
| |
#define ST_AL_CENTER 0x00100000 |
| |
#define ST_AL_FIXED (ST_AL_LEFT|ST_AL_CENTER) |
| |
#define ST_AU_UP 0x00200000 |
| |
#define ST_AU_CENTER 0x00400000 |
| |
#define ST_AU_FIXED (ST_AU_UP|ST_AU_CENTER) |
| |
#define ST_AR_RIGHT 0x00800000 |
| |
#define ST_AR_CENTER 0x01000000 |
| |
#define ST_AR_FIXED (ST_AR_RIGHT|ST_AR_CENTER) |
| |
#define ST_AD_DOWN 0x02000000 |
| |
#define ST_AD_CENTER 0x04000000 |
| |
#define ST_AD_FIXED (ST_AD_DOWN|ST_AD_CENTER) |
| |
#define ST_A_HCENTER (ST_AL_CENTER|ST_AR_CENTER) |
| |
#define ST_A_VCENTER (ST_AU_CENTER|ST_AD_CENTER) |
| |
#define ST_A_CENTER (ST_A_HCENTER|ST_A_VCENTER) |
| |
#define ST_A_HCLIENT (ST_AL_LEFT|ST_AR_RIGHT) |
| |
#define ST_A_VCLIENT (ST_AU_UP|ST_AD_DOWN) |
| |
#define ST_A_CLIENT (ST_A_HCLIENT|ST_A_VCLIENT) |
| |
#define ST_A_TEMP 0x08000000 |
| |
|
| #define ST_TE_DOWNTEXT_COLORS 0x00000001 |
#define ST_TE_DOWNTEXT_COLORS 0x00000001 |
| |
|
| |
#define ST_CO_WITH_EDIT 0x00000001 |
| |
|
| #define ST_DI_HASMAXIMIZE 0x00000001 |
#define ST_DI_HASMAXIMIZE 0x00000001 |
| #define ST_DI_HASMINIMIZE 0x00000002 |
#define ST_DI_HASMINIMIZE 0x00000002 |
| #define ST_DI_SIZEABLE 0x00000004 |
#define ST_DI_SIZEABLE 0x00000004 |
|
|
| #define SV_MINIMIZED 2 |
#define SV_MINIMIZED 2 |
| #define SV_IN_MAXSTATE 2 |
#define SV_IN_MAXSTATE 2 |
| |
|
| |
#define ED_NORMAL 0 |
| |
#define ED_READONLY 1 |
| |
#define ED_PASSWORD 2 |
| |
|
| |
#define BT_NORMAL 0 |
| |
#define BT_CHECK1 1 |
| |
#define BT_CHECK2 2 |
| |
|
| #define PA_SOLID 0 |
#define PA_SOLID 0 |
| #define PA_PATTERN 1 |
#define PA_PATTERN 1 |
| #define PA_BORDER 2 |
#define PA_BORDER 2 |
| |
|
| |
#define MB_DEFAULT 0 |
| |
#define MB_OK 0x00000001 |
| |
#define MB_YES 0x00000002 |
| |
#define MB_NO 0x00000004 |
| |
#define MB_CANCEL 0x00000008 |
| |
|
| #define C_DEFAULT -1 |
#define C_DEFAULT -1 |
| #define C_BLACK 0 |
#define C_BLACK 0 |
| #define C_RED 1 |
#define C_RED 1 |
|
|
| #define TP_COMBO 4 |
#define TP_COMBO 4 |
| #define TP_LIST 5 |
#define TP_LIST 5 |
| #define TP_STATUS 6 |
#define TP_STATUS 6 |
| #define TP_TABLE 7 |
#define TP_PAINT 7 |
| #define TP_PAINT 8 |
#define TP_MENU 8 |
| #define TP_MENU 9 |
#define TP_DIALOG 9 |
| #define TP_DIALOG 10 |
|
| |
|
| #ifndef __WIN |
#ifndef __WIN |
| typedef void WIN; |
typedef void WIN; |
| Line 136 typedef struct _PTEXT{ |
|
| Line 177 typedef struct _PTEXT{ |
|
| |
|
| typedef struct _PEDIT{ |
typedef struct _PEDIT{ |
| char type; |
char type; |
| |
char style; // ED_xxx |
| long cback, |
long cback, |
| |
cbmask, |
| |
cfmask, |
| ctext; |
ctext; |
| void (*change)(); |
void (*change)(); // void change(WIN*) |
| }PEDIT; |
}PEDIT; |
| |
|
| typedef struct _PBUTTON{ |
typedef struct _PBUTTON{ |
| char type; |
char type; |
| char *text; |
char *text; |
| |
char style; // BT_xxx |
| |
bool checked; |
| long cback[3], |
long cback[3], |
| ctext[3], |
ctext[3], |
| cutext[3], |
cutext[3], |
| cfocus[3]; |
cfocus[3]; |
| bool hasfocus; |
bool hasfocus; |
| void (*push)(); |
void (*push)(); // void push(WIN*) |
| }PBUTTON; |
}PBUTTON; |
| |
|
| typedef struct _PSCROLL{ |
typedef struct _PSCROLL{ |
| Line 165 typedef struct _PSCROLL{ |
|
| Line 211 typedef struct _PSCROLL{ |
|
| carrowup, |
carrowup, |
| carrowdown; |
carrowdown; |
| bool vert; |
bool vert; |
| void (*change)(); |
void (*change)(); // void change(WIN*) |
| }PSCROLL; |
}PSCROLL; |
| |
|
| typedef struct _PCOMBO{ |
typedef struct _PCOMBO{ |
| Line 174 typedef struct _PCOMBO{ |
|
| Line 220 typedef struct _PCOMBO{ |
|
| cback, |
cback, |
| cbutback[2], |
cbutback[2], |
| cbutfront[2]; |
cbutfront[2]; |
| void (*change)(); |
void (*change)(); // void change(WIN*) |
| long lstvy; |
long lstvy; |
| long lstcback, |
long lstcback, |
| lstcborder, |
lstcborder, |
| Line 203 typedef struct _PLIST{ |
|
| Line 249 typedef struct _PLIST{ |
|
| cactivetext; |
cactivetext; |
| bool combotyp; |
bool combotyp; |
| GList *lines; |
GList *lines; |
| void (*change)(); |
void (*change)(); // void change(WIN*) |
| void (*dblclk)(); |
void (*dblclk)(); // void dblclk(WIN*) |
| long scrcback, |
long scrcback, |
| scrcmark, |
scrcmark, |
| scrcbar, |
scrcbar, |
| Line 225 typedef struct _PSTATUS{ |
|
| Line 271 typedef struct _PSTATUS{ |
|
| char *text; |
char *text; |
| }PSTATUS; |
}PSTATUS; |
| |
|
| typedef struct _PTABLE{ |
|
| char type; |
|
| long cback; |
|
| |
|
| |
|
| |
|
| |
|
| }PTABLE; |
|
| |
|
| typedef struct _PPAINT{ |
typedef struct _PPAINT{ |
| char type; |
char type; |
| char style; |
char style; // PA_xxx |
| long cback, |
long cback, |
| color; |
color; |
| }PPAINT; |
}PPAINT; |
| Line 251 typedef struct _PMENU{ |
|
| Line 288 typedef struct _PMENU{ |
|
| cactivetext, |
cactivetext, |
| cactiveutext; |
cactiveutext; |
| GList *lines; |
GList *lines; |
| void (*change)(); |
void (*change)(); // void change(WIN*) |
| void (*select)(); |
void (*select)(); // void change(WIN*,long) |
| bool vert; |
bool vert; |
| }PMENU; |
}PMENU; |
| |
|
| Line 266 typedef struct _PDIALOG{ |
|
| Line 303 typedef struct _PDIALOG{ |
|
| cbuttext[3]; |
cbuttext[3]; |
| bool modal; |
bool modal; |
| WIN *menu; |
WIN *menu; |
| void (*resize)(); |
void (*resize)(); // void resize(WIN*) |
| bool (*sizeok)(); |
bool (*sizeok)(); // bool sizeok(WIN *,long,long) |
| bool (*close)(); |
void (*close)(); // void close(WIN*) |
| }PDIALOG; |
}PDIALOG; |
| |
|
| typedef union _PUNION{ |
typedef union _PUNION{ |
| Line 280 typedef union _PUNION{ |
|
| Line 317 typedef union _PUNION{ |
|
| PCOMBO combo; |
PCOMBO combo; |
| PLIST list; |
PLIST list; |
| PSTATUS status; |
PSTATUS status; |
| PTABLE table; |
|
| PPAINT paint; |
PPAINT paint; |
| PMENU menu; |
PMENU menu; |
| PDIALOG dialog; |
PDIALOG dialog; |
| Line 290 typedef struct _PTIMER{ |
|
| Line 326 typedef struct _PTIMER{ |
|
| WIN *win; |
WIN *win; |
| long period; |
long period; |
| long prior; |
long prior; |
| void (*timer)(); |
void (*timer)(); // void timer(TIMER*) |
| }PTIMER; |
}PTIMER; |
| |
|
| #ifndef __TIMER |
#ifndef __TIMER |
| Line 298 typedef struct _PTIMER{ |
|
| Line 334 typedef struct _PTIMER{ |
|
| #define __TIMER |
#define __TIMER |
| #endif |
#endif |
| |
|
| |
// Exported functions |
| |
long color_box(WIN *parent,char *caption,long color); |
| |
long message_box(WIN *parent,char *caption,char *text,long style); // style=MB_xxx |
| |
void edit_copy(WIN *edit); |
| |
void edit_paste(WIN *edit); |
| |
void edit_delete(WIN *edit); |
| |
void edit_cut(WIN *edit); |
| |
void edit_select(WIN *edit,long sta,long end); |
| |
void edit_get_selection(WIN *edit,long *sta,long *end); |
| |
void set_clipboard(char *text); |
| |
char *get_clipboard(); |
| void track_popup_menu(WIN *menu,long x,long y); |
void track_popup_menu(WIN *menu,long x,long y); |
| WIN *create_menu(WIN *parent,PMENU *menu, |
WIN *create_menu(WIN *parent,PMENU *menu, |
| bool (*acel)(WIN *win,long x,long y,unsigned short key)); |
bool (*acel)(WIN *win,long x,long y,unsigned short key)); |
| Line 308 void ins_menu_item(WIN *menu,long pos,CM |
|
| Line 354 void ins_menu_item(WIN *menu,long pos,CM |
|
| void set_menu_item(WIN *menu,long pos,CMENU *cmenu); |
void set_menu_item(WIN *menu,long pos,CMENU *cmenu); |
| void get_menu_item(WIN *menu,long pos,CMENU *cmenu); |
void get_menu_item(WIN *menu,long pos,CMENU *cmenu); |
| void del_menu_item(WIN *menu,long pos); |
void del_menu_item(WIN *menu,long pos); |
| void exit_api(); |
void set_api_run(bool run); |
| |
bool is_api_run(); |
| void set_capture(WIN *win); |
void set_capture(WIN *win); |
| WIN *get_capture(); |
WIN *get_capture(); |
| bool set_focus(WIN *win); |
bool set_focus(WIN *win); |
| Line 317 void show_win(WIN *win,bool visible); |
|
| Line 364 void show_win(WIN *win,bool visible); |
|
| long get_tick(); |
long get_tick(); |
| void client_to_screen(WIN *p,long *x,long *y); |
void client_to_screen(WIN *p,long *x,long *y); |
| void screen_to_client(WIN *p,long *x,long *y); |
void screen_to_client(WIN *p,long *x,long *y); |
| |
bool get_menu_pos(WIN *win,long id,WIN **submenu,long *pos); |
| |
void set_user(WIN *win,void *user); |
| |
void *get_user(WIN *win); |
| |
void set_checked(WIN *win,long pos,bool status); |
| |
bool get_checked(WIN *win,long pos); |
| void set_text(WIN *win,char *text);
|
void set_text(WIN *win,char *text);
|
| char *get_text(WIN *win); |
char *get_text(WIN *win); |
| void set_pos(WIN *win,long pos); |
void set_pos(WIN *win,long pos); |
| Line 334 void *get_resize_proc(WIN *win); |
|
| Line 386 void *get_resize_proc(WIN *win); |
|
| void set_parent(WIN *win,WIN *parent); |
void set_parent(WIN *win,WIN *parent); |
| WIN *get_parent(WIN *win); |
WIN *get_parent(WIN *win); |
| long create_thread(void *(*proc)()); |
long create_thread(void *(*proc)()); |
| TIMER *set_timer(WIN *win,long msec,char prior,void (*timer)()); |
TIMER *set_timer(WIN *win,long msec,char prior,void (*timer)(TIMER*)); |
| void del_timer_for_win(WIN *win); |
void del_timer_for_win(WIN *win); |
| void del_timer(TIMER *timer); |
void del_timer(TIMER *timer); |
| long get_timer_clock(TIMER *timer); |
long get_timer_clock(TIMER *timer); |
| Line 350 WIN *create_win(WIN *parent,long x,long |
|
| Line 402 WIN *create_win(WIN *parent,long x,long |
|
| PUNION *extra,long style,bool (*acel)(WIN *win,long x,long y,unsigned short key)); |
PUNION *extra,long style,bool (*acel)(WIN *win,long x,long y,unsigned short key)); |
| void set_win_params(WIN *win,PUNION *params); |
void set_win_params(WIN *win,PUNION *params); |
| void get_win_params(WIN *win,PUNION *params); |
void get_win_params(WIN *win,PUNION *params); |
| |
void message_pump(); |
| |
|
| |
// Imported functions |
| int main_api(int argc,char *argv[]); |
int main_api(int argc,char *argv[]); |
| void init_api(); |
void init_api(); |
| void done_api(); |
void done_api(); |