00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _H_PG_CLI_C
00030 #define _H_PG_CLI_C
00031
00032 #include <stdio.h>
00033 #ifdef __NetBSD__
00034 #include <sys/types.h>
00035 #include <sys/time.h>
00036 #include <unistd.h>
00037 #endif
00038
00039 #ifdef __linux__
00040 #include <sys/types.h>
00041 #include <sys/time.h>
00042 #include <unistd.h>
00043 #endif
00044
00067
00068
00094 struct pgEvent {
00095 s16 type;
00096 pghandle from;
00097 void *extra;
00098
00100 union {
00101
00103 u32 param;
00104
00106 struct {
00107 s16 w;
00108 s16 h;
00109 } size;
00110
00112 struct {
00113 s16 mods;
00114
00118 s16 key;
00119 } kbd;
00120
00122 struct {
00123 s16 x,y;
00124 s16 btn;
00125 s16 chbtn;
00126 } pntr;
00127
00129 struct {
00130 u32 size;
00133 char *pointer;
00134
00136 union pg_client_trigger *trigger;
00137 } data;
00138
00139 } e;
00140 };
00141
00143 #define PGBIND_ANY -1
00144
00146 #define PGFONT_ANY 0
00147
00171 typedef u32 pgcolor;
00172
00193 #define PGDEFAULT 0
00194
00196 #define pgFraction(n,d) (((n)<<8)|(d))
00197
00204 typedef int (*pgevthandler)(struct pgEvent *evt);
00206 typedef void (*pgidlehandler)(void);
00207 #ifdef FD_SET
00208
00209 typedef int (*pgselecthandler)(int n, fd_set *readfds, fd_set *writefds,
00210 fd_set *exceptfds, struct timeval *timeout);
00211 typedef void (*pgselectbh)(int result, fd_set *readfds, fd_set *writefds,
00212 fd_set *exceptfds);
00213 #endif
00214
00215 typedef int (*pgfilter)(const char *string,const char *pattern);
00216
00217 #define PG_FILE_SAVEBTN (1<<0)
00218 #define PG_FILE_MUSTEXIST (1<<1)
00219 #define PG_FILE_MUSTWRITE (1<<2)
00220 #define PG_FILE_MUSTREAD (1<<3)
00221 #define PG_FILE_SHOWDOT (1<<4)
00222 #define PG_FILE_SHOWHIDDEN (1<<5)
00223 #define PG_FILE_SHOWBAK (1<<6)
00224 #define PG_FILE_SHOWDEV (1<<7)
00225 #define PG_FILE_FIELD (1<<8)
00226
00227
00228 #define PG_FILEOPEN PG_FILE_MUSTREAD
00229
00230 #define PG_FILESAVE (PG_FILE_SAVEBTN | PG_FILE_FIELD)
00231
00232
00233 #define PG_MSGBTN_OK 0x0001
00234 #define PG_MSGBTN_CANCEL 0x0002
00235 #define PG_MSGBTN_YES 0x0004
00236 #define PG_MSGBTN_NO 0x0008
00237 #define PG_MSGICON_ERROR 0x0010
00238 #define PG_MSGICON_MESSAGE 0x0020
00239 #define PG_MSGICON_QUESTION 0x0040
00240 #define PG_MSGICON_WARNING 0x0080
00241
00242 #define PG_MSGBTNMASK (PG_MSGBTN_OK|PG_MSGBTN_CANCEL|\
00243 PG_MSGBTN_YES|PG_MSGBTN_NO)
00244 #define PG_MSGICONMASK (PG_MSGICON_ERROR|PG_MSGICON_MESSAGE|\
00245 PG_MSGICON_QUESTION|PG_MSGICON_WARNING)
00246
00257 struct pgmemdata {
00258 void *pointer;
00259 u32 size;
00260 int flags;
00261 };
00262 #define PGMEMDAT_NEED_FREE 0x0001
00263 #define PGMEMDAT_NEED_UNMAP 0x0002
00264
00265
00266
00267
00268
00305 void pgInit(int argc, char **argv);
00306
00323 void pgSetErrorHandler(void (*handler)(u16 errortype,
00324 const char *msg));
00325
00333 pghandle pgLoadDriver(const char *name);
00334
00342 const char *pgErrortypeString(u16 errortype);
00343
00362 pgidlehandler pgSetIdle(s32 t, pgidlehandler handler);
00363
00375 void pgFlushRequests(void);
00376
00392 void pgUpdate(void);
00393
00408 void pgSubUpdate(pghandle widget);
00409
00428 void pgBind(pghandle widgetkey,s16 eventkey,
00429 pgevthandler handler,void *extra);
00430
00431 #ifdef FD_SET
00432
00455 void pgCustomizeSelect(pgselecthandler handler, pgselectbh bottomhalf);
00456 #endif
00457
00468 void pgRegisterOwner(int resource);
00469
00480 void pgUnregisterOwner(int resource);
00481
00508 void pgSetVideoMode(u16 xres,u16 yres,
00509 u16 bpp,u16 flagmode,
00510 u32 flags);
00511
00527 struct pgmodeinfo *pgGetVideoMode(void);
00528
00538 void pgDriverMessage(u32 message, u32 param);
00539
00549 void pgAppMessage(pghandle dest, struct pgmemdata data);
00550
00574 void * pgSyncAppMessage (pghandle dest, struct pgmemdata data);
00575
00594 pghandle pgEvalRequest(s16 reqtype, void *data, u32 datasize);
00595
00607 void pgSetInactivity(u32 time);
00608
00619 u32 pgGetInactivity(void);
00620
00626 pghandle pgGetServerRes(u32 id);
00627
00629
00630
00631
00648 void pgDelete(pghandle object);
00649
00662 pghandle pgDup(pghandle object);
00663
00685 void pgChangeContext(pghandle object, s16 delta);
00686
00688 void pgFocus(pghandle widget);
00689
00718 pghandle pgRegisterApp(s16 type,const char *name, ...);
00719
00736 pghandle pgNewWidget(s16 type,s16 rship,
00737 pghandle parent);
00738
00750 pghandle pgCreateWidget(s16 type);
00751
00765 void pgAttachWidget(pghandle parent, s16 rship, pghandle widget);
00766
00782 pghandle pgTraverseWidget(pghandle widget, int direction, int count);
00783
00797 pghandle pgNewPopup(int width,int height);
00798
00805 pghandle pgNewCursor(void);
00806
00818 pghandle pgNewInFilter(pghandle insert_after, u32 accept_trigs, u32 absorb_trigs);
00819
00827 void pgInFilterSend(union pg_client_trigger *trig);
00828
00846 pghandle pgNewPopupAt(int x,int y,int width,int height);
00847
00865 void pgSetWidget(pghandle widget, ...);
00866
00877 s32 pgGetWidget(pghandle widget,s16 property);
00878
00887 pghandle pgNewBitmap(struct pgmemdata obj);
00888
00898 pghandle pgCreateBitmap(s16 width, s16 height);
00899
00911 struct pgshmbitmap *pgMakeSHMBitmap(pghandle bitmap);
00912
00921 pghandle pgNewString(const char *str);
00922
00931 pghandle pgNewArray(const s32* dat, u16 size);
00932
00944 char *pgGetString(pghandle string);
00945
00964 void pgReplaceText(pghandle widget,const char *str);
00965
00973 void pgReplaceTextFmt(pghandle widget,const char *fmt, ...);
00974
00995 pghandle pgNewFont(const char *name,s16 size,u32 style);
00996
01035 int pgGetFontStyle(s16 index, char *name, u16 *size,
01036 u16 *fontrep, u32 *flags);
01037
01070 void pgSizeText(int *w,int *h,pghandle font,pghandle text);
01071
01081 void pgSizeBitmap(int *w, int *h, pghandle bitmap);
01082
01094 pghandle pgLoadTheme(struct pgmemdata obj);
01095
01107 pghandle pgLoadWidgetTemplate(struct pgmemdata obj);
01108
01122 int pgFindThemeObject(const char *key);
01123
01136 pghandle pgDataString(struct pgmemdata obj);
01137
01148 u32 pgThemeLookup(s16 object, s16 property);
01149
01168 void pgSetPayload(pghandle object,u32 payload);
01169
01180 u32 pgGetPayload(pghandle object);
01181
01194 void pgWriteData(pghandle widget,struct pgmemdata data);
01195
01209 void pgWriteCmd(pghandle widget,s32 command,s16 numparams, ...);
01210
01221 void pgRender(pghandle bitmap,s16 groptype, ...);
01222
01237 pghandle pgFindWidget(const char *key);
01238
01240
01241
01242
01266 struct pgmemdata pgFromMemory(void *data,u32 length);
01267
01280 struct pgmemdata pgFromTempMemory(void *data,u32 length);
01281
01282
01293 struct pgmemdata pgFromFile(const char *file);
01294
01308 struct pgmemdata pgFromStream(FILE *f, u32 length);
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01323
01324
01325
01350 void pgEventLoop(void);
01351
01360 void pgExitEventLoop(void);
01361
01397 struct pgEvent *pgGetEvent(void);
01398
01418 int pgCheckEvent(void);
01419
01433 void pgDispatchEvent(struct pgEvent *evt);
01434
01448 void pgEventPoll(void);
01449
01475 int pgEnterContext(void);
01476
01486 void pgLeaveContext(void);
01487
01500 void pgDeleteHandleContext(int id);
01501
01507 void pgSetContext(int id);
01508
01509
01515 int pgGetContext(void);
01516
01518
01520
01521 #endif
01522