client_c.h File Reference

Main Page Modules Alphabetical List Compound List File List Compound Members File Members

# /home/micah/picogui/pg1/client/c/include/picogui/client_c.h File Reference

C Client API Header. More...

`#include <stdio.h>`

Go to the source code of this file.

## Compounds
struct | pgEvent
| Generic PicoGUI event structure. More...
struct | pgmemdata
| A structure representing data, loaded or mapped into memory. More...
## Defines
#define | PGBIND_ANY -1
| A wildcard value for pgBind().
#define | PGFONT_ANY 0
| A wildcard value for pgNewFont.
#define | PGDEFAULT 0
| Refer to the default widget handle.
#define | pgFraction(n, d) (((n)<<8)|(d))
| For forming fractions, such as the size when PG_SZMODE_CNTFRACT is used.
#define | PG_FILE_SAVEBTN (1<<0)
| Use a 'save' button instead of 'open'.
#define | PG_FILE_MUSTEXIST (1<<1)
| The chosen file must already exist.
#define | PG_FILE_MUSTWRITE (1<<2)
| The file must be writeable.
#define | PG_FILE_MUSTREAD (1<<3)
| The file must be readable.
#define | PG_FILE_SHOWDOT (1<<4)
| Show . and .. directories.
#define | PG_FILE_SHOWHIDDEN (1<<5)
| Show hidden files.
#define | PG_FILE_SHOWBAK (1<<6)
| Show editor backups.
#define | PG_FILE_SHOWDEV (1<<7)
| Show device nodes (dangerous).
#define | PG_FILE_FIELD (1<<8)
| The user can enter filenames in a field.
#define | PG_FILEOPEN PG_FILE_MUSTREAD
| Default flags for a file open dialog box.
#define | PG_FILESAVE (PG_FILE_SAVEBTN | PG_FILE_FIELD)
| Default flags for a file save dialog box.
#define | PG_MSGBTN_OK 0x0001
#define | PG_MSGBTN_CANCEL 0x0002
#define | PG_MSGBTN_YES 0x0004
#define | PG_MSGBTN_NO 0x0008
#define | PG_MSGICON_ERROR 0x0010
#define | PG_MSGICON_MESSAGE 0x0020
#define | PG_MSGICON_QUESTION 0x0040
#define | PG_MSGICON_WARNING 0x0080
#define | PG_MSGBTNMASK
#define | PG_MSGICONMASK
#define | PGMEMDAT_NEED_FREE 0x0001
| pgmemdata should be free()'d when done
#define | PGMEMDAT_NEED_UNMAP 0x0002
| pgmemdata should be munmap()'d when done
## Typedefs
typedef u32 | pgcolor
| RGB hardware-independant color.
typedef int(* | pgevthandler )(struct pgEvent *evt)
| The event handler used in pgBind.
typedef void(* | pgidlehandler )(void)
| The event handler for pgSetIdle.
typedef int(* | pgfilter )(const char *string, const char *pattern)
| Filter function for pgFilePicker().
## Functions
void | pgInit (int argc, char **argv)
| Initialize PicoGUI.
void | pgSetErrorHandler (void(*handler)(u16 errortype, const char *msg))
| Replace the default error handler.
pghandle | pgLoadDriver (const char *name)
| Load an input driver by name and return a handle.
const char * | pgErrortypeString (u16 errortype)
| Convert a numerical errortype to a string.
pgidlehandler | pgSetIdle (s32 t, pgidlehandler handler)
| Set a handler to be called periodically.
void | pgFlushRequests (void)
| Flush all unsent request packets to the server.
void | pgUpdate (void)
| Update the screen.
void | pgSubUpdate (pghandle widget)
| Update a subsection of the screen.
void | pgBind (pghandle widgetkey, s16 eventkey, pgevthandler handler, void *extra)
| Attatch an event handler to a widget and/or event.
void | pgRegisterOwner (int resource)
| Register exclusive access to a resouce.
void | pgUnregisterOwner (int resource)
| Unregister exclusive access to a resouce.
void | pgSetVideoMode (u16 xres, u16 yres, u16 bpp, u16 flagmode, u32 flags)
| Change video mode at runtime.
pgmodeinfo * | pgGetVideoMode (void)
| Get information about the current video mode.
void | pgDriverMessage (u32 message, u32 param)
| Send a message to the drivers.
void | pgAppMessage (pghandle dest, struct pgmemdata data)
| Send a message to a widget owned by any application.
void * | pgSyncAppMessage (pghandle dest, struct pgmemdata data)
| Send a message to a widget owned by any application, and wait for an answer.
pghandle | pgEvalRequest (s16 reqtype, void *data, u32 datasize)
| Evaluate a PicoGUI request packet.
void | pgSetInactivity (u32 time)
| Set the inactivity timer.
u32 | pgGetInactivity (void)
| Get the inactivity timer.
pghandle | pgGetServerRes (u32 id)
| Get a server resource.
void | pgDelete (pghandle object)
| Delete any object that has a handle.
pghandle | pgDup (pghandle object)
| Duplicate an object that has a handle.
void | pgChangeContext (pghandle object, s16 delta)
| Change the handle context of an object.
void | pgFocus (pghandle widget)
| Give a widget the keyboard focus.
pghandle | pgRegisterApp (s16 type, const char *name,...)
| Register a new application.
pghandle | pgNewWidget (s16 type, s16 rship, pghandle parent)
| Create a new widget, derived from a parent widget.
pghandle | pgCreateWidget (s16 type)
| Create a new widget without a parent.
void | pgAttachWidget (pghandle parent, s16 rship, pghandle widget)
| Attach a widget to a new parent.
pghandle | pgTraverseWidget (pghandle widget, int direction, int count)
| Finds a widget in relation to another widget.
pghandle | pgNewPopup (int width, int height)
| Create a popup box, centered on the screen.
pghandle | pgNewCursor (void)
| Create a cursor that can be used for input filters.
pghandle | pgNewInFilter (pghandle insert_after, u32 accept_trigs, u32 absorb_trigs)
| Create a new client-side input filter.
void | pgInFilterSend (union pg_client_trigger *trig)
| Send an event back from a client-side input filter.
pghandle | pgNewPopupAt (int x, int y, int width, int height)
| Create a popup box at the specified position.
void | pgSetWidget (pghandle widget,...)
| Set widget properties.
s32 | pgGetWidget (pghandle widget, s16 property)
| Get a widget property.
pghandle | pgNewBitmap (struct pgmemdata obj)
| Create a new bitmap object from existing data.
pghandle | pgCreateBitmap (s16 width, s16 height)
| Create a new bitmap object.
pgshmbitmap * | pgMakeSHMBitmap (pghandle bitmap)
| Map a bitmap into a shared memory segment.
pghandle | pgNewString (const char *str)
| Create a new string object.
pghandle | pgNewArray (const s32 *dat, u16 size)
| Create a new array object.
char * | pgGetString (pghandle string)
| Get the contents of a string handle.
void | pgReplaceText (pghandle widget, const char *str)
| Change a widget's text.
void | pgReplaceTextFmt (pghandle widget, const char *fmt,...)
| Change a widget's text, with formatting.
pghandle | pgNewFont (const char *name, s16 size, u32 style)
| Create a new font object.
int | pgGetFontStyle (s16 index, char *name, u16 *size, u16 *fontrep, u32 *flags)
| Get information about a font style.
void | pgSizeText (int *w, int *h, pghandle font, pghandle text)
| Measure a string of text.
void | pgSizeBitmap (int *w, int *h, pghandle bitmap)
| Return the size of a bitmap object.
pghandle | pgLoadTheme (struct pgmemdata obj)
| Load a compiled theme.
pghandle | pgLoadWidgetTemplate (struct pgmemdata obj)
| Load a compiled Widget Template.
int | pgFindThemeObject (const char *key)
| Find a theme object's ID given its name.
pghandle | pgDataString (struct pgmemdata obj)
| Load memory into a string handle.
u32 | pgThemeLookup (s16 object, s16 property)
| Retrieve a theme property.
void | pgSetPayload (pghandle object, u32 payload)
| Set an object's payload.
u32 | pgGetPayload (pghandle object)
| Get an object's payload.
void | pgWriteData (pghandle widget, struct pgmemdata data)
| Write data to a widget.
void | pgWriteCmd (pghandle widget, s32 command, s16 numparams,...)
| Write a command to a widget.
void | pgRender (pghandle bitmap, s16 groptype,...)
| Render a gropnode to a bitmap.
pghandle | pgFindWidget (const char *key)
| Search for a widget by its PG_WP_NAME property.
pgmemdata | pgFromMemory (void *data, u32 length)
| Refer to data loaded into memory.
pgmemdata | pgFromTempMemory (void *data, u32 length)
| Refer to data loaded into memory, free when done.
pgmemdata | pgFromFile (const char *file)
| Refer to data in a file.
pgmemdata | pgFromStream (FILE *f, u32 length)
| Refer to data in an opened stream.
void | pgEventLoop (void)
| Event processing and dispatching loop.
void | pgExitEventLoop (void)
| Exit the current event loop.
pgEvent * | pgGetEvent (void)
| Wait for a single event.
int | pgCheckEvent (void)
| Check the number of pending events.
void | pgDispatchEvent (struct pgEvent *evt)
| Dispatch an event to registered handlers.
void | pgEventPoll (void)
| Get and dispatch new events if there are any.
int | pgEnterContext (void)
| Enter a new context.
void | pgLeaveContext (void)
| Leave a context.
void | pgDeleteHandleContext (int id)
| Delete all handles in one context.
void | pgSetContext (int id)
| Set the context ID used when creating new handles.
int | pgGetContext (void)
| Get the current context ID.

## Detailed Description

C Client API Header.

client_c.h contains declarations for all core PicoGUI API functions and structures. This does not include the PGFX graphics module, or the low-level canvas commands. All constants common to client and server are in constants.h, and the network interface between client and server is defined in network.h. Usually this file does not need to be included separately, it is included with `#include <picogui.h>`