Files
milsko/include/Mw/LowLevel.h
NishiOwO 1640c834b5 wip. work on clipboard
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@581 b9cfdab3-6d41-4d17-bbe4-086880011989
2025-11-03 19:05:33 +00:00

145 lines
3.7 KiB
C

/* $Id$ */
/*!
* @file Mw/LowLevel.h
* @brief Low-level drawing API
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_H__
#define __MW_LOWLEVEL_H__
#include <Mw/MachDep.h>
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 <Mw/TypeDefs.h>
#define MwLLDispatch(x, y, z) \
if(x->handler != NULL && x->handler->y != NULL) x->handler->y(x, z)
#define MwLLKeyMask (1 << 31)
enum MwLLKeyEnum {
MwLLKeyBackSpace = MwLLKeyMask | 1,
MwLLKeyLeft,
MwLLKeyRight,
MwLLKeyUp,
MwLLKeyDown,
MwLLKeyEnter,
MwLLKeyEscape,
MwLLKeyLeftShift,
MwLLKeyRightShift,
MwLLKeyAlt,
MwLLKeyControl
};
#define MwLLControlMask MwLLKeyMask | (1 << 30)
#define MwLLAltMask MwLLKeyMask | (1 << 29)
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);
void (*focus_in)(MwLL handle, void* data);
void (*focus_out)(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 MwLLColorUpdate(MwLL handle, MwLLColor c, 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 MwLLPixmapUpdate(MwLLPixmap pixmap);
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);
MWDECL void MwLLFocus(MwLL handle);
MWDECL void MwLLGrabPointer(MwLL handle, int toggle);
MWDECL void MwLLSetClipboard(MwLL handle, const char* text);
MWDECL char* MwLLGetClipboard(MwLL handle);
#ifdef __cplusplus
}
#endif
#endif