/* $Id$ */ /*! * %file Mw/LowLevel.h * %brief Low-level drawing API * %warning This is used internally */ #ifndef __MW_LOWLEVEL_H__ #define __MW_LOWLEVEL_H__ #include typedef struct _MwLLHandler* MwLLHandler; typedef struct _MwLLMouse MwLLMouse; #ifdef _MILSKO typedef struct _MwLL* MwLL; typedef struct _MwLLColor* MwLLColor; typedef struct _MwLLPixmap* MwLLPixmap; #else typedef void* MwLL; typedef void* MwLLColor; typedef void* MwLLPixmap; #endif #ifdef _MILSKO #ifdef USE_X11 #include "../../src/backend/x11.h" #endif #ifdef USE_GDI #include "../../src/backend/gdi.h" #endif #ifdef USE_DARWIN #include "../../src/backend/mac/mac.h" #endif #endif #include #define MwLLDispatch(x, y, z) \ if(x->handler != NULL && x->handler->y != NULL) x->handler->y(x, z) enum MwLLKeyEnum { MwLLKeyBackSpace = (1 << 31) | 1, MwLLKeyLeft, MwLLKeyRight, MwLLKeyUp, MwLLKeyDown }; enum MwLLMouseEnum { MwLLMouseLeft = 1, MwLLMouseMiddle, MwLLMouseRight, MwLLMouseWheelUp, MwLLMouseWheelDown }; struct _MwLLMouse { MwPoint point; int button; }; struct _MwLLHandler { void (*draw)(MwLL handle, void* data); void (*up)(MwLL handle, void* data); void (*down)(MwLL handle, void* data); void (*resize)(MwLL handle, void* data); void (*close)(MwLL handle, void* data); void (*move)(MwLL handle, void* data); void (*key)(MwLL handle, void* data); void (*key_released)(MwLL handle, void* data); }; #ifdef __cplusplus extern "C" { #endif /* lowlevel.c, common part */ MWDECL void MwLLCreateCommon(MwLL handle); MWDECL void MwLLDestroyCommon(MwLL handle); /* driver-specific */ MWDECL MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height); MWDECL void MwLLDestroy(MwLL handle); MWDECL void MwLLPolygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color); MWDECL void MwLLLine(MwLL handle, MwPoint* points, MwLLColor color); MWDECL MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b); MWDECL void MwLLFreeColor(MwLLColor color); MWDECL void MwLLGetXYWH(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h); MWDECL void MwLLSetXY(MwLL handle, int x, int y); MWDECL void MwLLSetWH(MwLL handle, int w, int h); MWDECL void MwLLSetTitle(MwLL handle, const char* title); MWDECL int MwLLPending(MwLL handle); MWDECL void MwLLNextEvent(MwLL handle); MWDECL void MwLLSleep(int ms); MWDECL MwLLPixmap MwLLCreatePixmap(MwLL handle, unsigned char* data, int width, int height); MWDECL void MwLLDestroyPixmap(MwLLPixmap pixmap); MWDECL void MwLLDrawPixmap(MwLL handle, MwRect* rect, MwLLPixmap pixmap); MWDECL void MwLLSetIcon(MwLL handle, MwLLPixmap pixmap); MWDECL void MwLLForceRender(MwLL handle); MWDECL void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask); MWDECL void MwLLDetach(MwLL handle, MwPoint* point); MWDECL void MwLLShow(MwLL handle, int show); MWDECL void MwLLMakePopup(MwLL handle, MwLL parent); MWDECL void MwLLSetSizeHints(MwLL handle, int minx, int miny, int maxx, int maxy); MWDECL void MwLLMakeBorderless(MwLL handle, int toggle); MWDECL long MwLLGetTick(void); MWDECL void MwLLSetBackground(MwLL handle, MwLLColor color); #ifdef __cplusplus } #endif #endif