generate pkgconfig file (don't commit yet i fucked it up)
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit

This commit is contained in:
IoI_xD 2026-07-15 17:32:53 -07:00
commit c705d2b98c
375 changed files with 203503 additions and 203476 deletions

View file

@ -1,22 +1,22 @@
/*!
* @file Mw/Abstract/CharSet.h
* @brief CharSet
*/
#ifndef __MW_ABSTRACT_CHARSET_H__
#define __MW_ABSTRACT_CHARSET_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
MWDECL char* MWAPI MwACPToUTF8(const char* input);
MWDECL char* MWAPI MwUTF8ToACP(const char* input);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Abstract/CharSet.h
* @brief CharSet
*/
#ifndef __MW_ABSTRACT_CHARSET_H__
#define __MW_ABSTRACT_CHARSET_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
MWDECL char* MWAPI MwACPToUTF8(const char* input);
MWDECL char* MWAPI MwUTF8ToACP(const char* input);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,59 +1,59 @@
/*!
* @file Mw/Abstract/Directory.h
* @brief Directory functions
*/
#ifndef __MW_ABSTRACT_DIRECTORY_H__
#define __MW_ABSTRACT_DIRECTORY_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Opens a directory
* @param path Path
* @return Handle
*/
MWDECL void* MWAPI MwDirectoryOpen(const char* path);
/*!
* @brief Closes a directory
* @param handle Handle
*/
MWDECL void MWAPI MwDirectoryClose(void* handle);
/*!
* @brief Reads a directory
* @param handle Handle
* @return Directory entry
*/
MWDECL MwDirectoryEntry* MWAPI MwDirectoryRead(void* handle);
/*!
* @brief Frees a directory entry
* @param entry Entry
*/
MWDECL void MWAPI MwDirectoryFreeEntry(MwDirectoryEntry* entry);
/*!
* @brief Gets a current directory
* @param Directory
*/
MWDECL char* MWAPI MwDirectoryCurrent(void);
/*!
* @brief Joins 2 paths
* @param a Path
* @param b Path
* @return Path
*/
MWDECL char* MWAPI MwDirectoryJoin(char* a, char* b);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Abstract/Directory.h
* @brief Directory functions
*/
#ifndef __MW_ABSTRACT_DIRECTORY_H__
#define __MW_ABSTRACT_DIRECTORY_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Opens a directory
* @param path Path
* @return Handle
*/
MWDECL void* MWAPI MwDirectoryOpen(const char* path);
/*!
* @brief Closes a directory
* @param handle Handle
*/
MWDECL void MWAPI MwDirectoryClose(void* handle);
/*!
* @brief Reads a directory
* @param handle Handle
* @return Directory entry
*/
MWDECL MwDirectoryEntry* MWAPI MwDirectoryRead(void* handle);
/*!
* @brief Frees a directory entry
* @param entry Entry
*/
MWDECL void MWAPI MwDirectoryFreeEntry(MwDirectoryEntry* entry);
/*!
* @brief Gets a current directory
* @param Directory
*/
MWDECL char* MWAPI MwDirectoryCurrent(void);
/*!
* @brief Joins 2 paths
* @param a Path
* @param b Path
* @return Path
*/
MWDECL char* MWAPI MwDirectoryJoin(char* a, char* b);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,38 +1,38 @@
/*!
* @file Mw/Abstract/Dynamic.h
* @brief Dynamic library
*/
#ifndef __MW_ABSTRACT_DYNAMIC_H__
#define __MW_ABSTRACT_DYNAMIC_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Opens a dynamic library
* @param path Path
* @return Handle
*/
MWDECL void* MWAPI MwDynamicOpen(const char* path);
/*!
* @brief Gets a symbol from the dynamic library
* @param handle Handle
* @param symbol Symbol
*/
MWDECL void* MWAPI MwDynamicSymbol(void* handle, const char* symbol);
/*!
* @brief Closes a dynamic library
* @param handle Handle
*/
MWDECL void MWAPI MwDynamicClose(void* handle);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Abstract/Dynamic.h
* @brief Dynamic library
*/
#ifndef __MW_ABSTRACT_DYNAMIC_H__
#define __MW_ABSTRACT_DYNAMIC_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Opens a dynamic library
* @param path Path
* @return Handle
*/
MWDECL void* MWAPI MwDynamicOpen(const char* path);
/*!
* @brief Gets a symbol from the dynamic library
* @param handle Handle
* @param symbol Symbol
*/
MWDECL void* MWAPI MwDynamicSymbol(void* handle, const char* symbol);
/*!
* @brief Closes a dynamic library
* @param handle Handle
*/
MWDECL void MWAPI MwDynamicClose(void* handle);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,30 +1,30 @@
/*!
* @file Mw/Abstract/Time.h
* @brief Time
*/
#ifndef __MW_ABSTRACT_TIME_H__
#define __MW_ABSTRACT_TIME_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Sleeps for milliseconds
* @param ms Milliseconds
*/
MWDECL void MWAPI MwTimeSleep(int ms);
/*!
* @brief Gets a monotonic time
* @return Monotonic time
*/
MWDECL long MWAPI MwTimeGetTick(void);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Abstract/Time.h
* @brief Time
*/
#ifndef __MW_ABSTRACT_TIME_H__
#define __MW_ABSTRACT_TIME_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Sleeps for milliseconds
* @param ms Milliseconds
*/
MWDECL void MWAPI MwTimeSleep(int ms);
/*!
* @brief Gets a monotonic time
* @return Monotonic time
*/
MWDECL long MWAPI MwTimeGetTick(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,113 +1,113 @@
/*!
* @file Mw/BaseTypes.h
* @brief Base type definitions
*/
#ifndef __MW_BASETYPES_H__
#define __MW_BASETYPES_H__
typedef struct _MwPoint MwPoint;
typedef struct _MwRect MwRect;
typedef struct _MwSizeHints MwSizeHints;
typedef struct _MwFont MwFont;
typedef struct _MwCursor MwCursor;
typedef struct _MwRGB MwRGB;
typedef unsigned char MwBool;
#define MwTRUE ((MwBool)1)
#define MwFALSE ((MwBool)0)
#if __STDC_VERSION__ >= 199901L
#include <stdint.h>
typedef int64_t MwI64;
typedef uint64_t MwU64;
typedef int32_t MwI32;
typedef uint32_t MwU32;
typedef int16_t MwI16;
typedef uint16_t MwU16;
typedef int8_t MwI8;
typedef uint8_t MwU8;
#define MW_OTHER_TYPES_DEFINED
#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) || defined(__clang__))
typedef long long MwI64;
typedef unsigned long long MwU64;
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
typedef __int64 MwI64;
typedef unsigned __int64 MwU64;
typedef __int32 MwI32;
typedef unsigned __int32 MwU32;
typedef __int16 MwI16;
typedef unsigned __int16 MwU16;
typedef __int8 MwI8;
typedef unsigned __int8 MwU8;
#define MW_OTHER_TYPES_DEFINED
#else
/* out of hope */
typedef long MwI64;
typedef unsigned long MwU64;
#endif
#ifdef MW_OTHER_TYPES_DEFINED
#undef MW_OTHER_TYPES_DEFINED
#else
typedef int MwI32;
typedef unsigned int MwU32;
typedef short MwI16;
typedef unsigned short MwU16;
typedef signed char MwI8;
typedef unsigned char MwU8;
#endif
typedef MwI64 MwOffset;
struct _MwPoint {
int x;
int y;
};
struct _MwRect {
int x;
int y;
int width;
int height;
};
struct _MwSizeHints {
int min_width;
int min_height;
int max_width;
int max_height;
};
#define MwCursorDataHeight 16
struct _MwCursor {
int width;
int height;
int x;
int y;
unsigned int data[MwCursorDataHeight];
};
struct _MwFont {
int left;
int top;
unsigned char data[16];
};
struct _MwRGB {
MwU16 red;
MwU16 green;
MwU16 blue;
};
#endif
/*!
* @file Mw/BaseTypes.h
* @brief Base type definitions
*/
#ifndef __MW_BASETYPES_H__
#define __MW_BASETYPES_H__
typedef struct _MwPoint MwPoint;
typedef struct _MwRect MwRect;
typedef struct _MwSizeHints MwSizeHints;
typedef struct _MwFont MwFont;
typedef struct _MwCursor MwCursor;
typedef struct _MwRGB MwRGB;
typedef unsigned char MwBool;
#define MwTRUE ((MwBool)1)
#define MwFALSE ((MwBool)0)
#if __STDC_VERSION__ >= 199901L
#include <stdint.h>
typedef int64_t MwI64;
typedef uint64_t MwU64;
typedef int32_t MwI32;
typedef uint32_t MwU32;
typedef int16_t MwI16;
typedef uint16_t MwU16;
typedef int8_t MwI8;
typedef uint8_t MwU8;
#define MW_OTHER_TYPES_DEFINED
#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) || defined(__clang__))
typedef long long MwI64;
typedef unsigned long long MwU64;
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
typedef __int64 MwI64;
typedef unsigned __int64 MwU64;
typedef __int32 MwI32;
typedef unsigned __int32 MwU32;
typedef __int16 MwI16;
typedef unsigned __int16 MwU16;
typedef __int8 MwI8;
typedef unsigned __int8 MwU8;
#define MW_OTHER_TYPES_DEFINED
#else
/* out of hope */
typedef long MwI64;
typedef unsigned long MwU64;
#endif
#ifdef MW_OTHER_TYPES_DEFINED
#undef MW_OTHER_TYPES_DEFINED
#else
typedef int MwI32;
typedef unsigned int MwU32;
typedef short MwI16;
typedef unsigned short MwU16;
typedef signed char MwI8;
typedef unsigned char MwU8;
#endif
typedef MwI64 MwOffset;
struct _MwPoint {
int x;
int y;
};
struct _MwRect {
int x;
int y;
int width;
int height;
};
struct _MwSizeHints {
int min_width;
int min_height;
int max_width;
int max_height;
};
#define MwCursorDataHeight 16
struct _MwCursor {
int width;
int height;
int x;
int y;
unsigned int data[MwCursorDataHeight];
};
struct _MwFont {
int left;
int top;
unsigned char data[16];
};
struct _MwRGB {
MwU16 red;
MwU16 green;
MwU16 blue;
};
#endif

View file

@ -1,142 +1,142 @@
/*!
* @file Mw/Constants.h
* @brief Constants
*/
#ifndef __MW_CONSTANTS_H__
#define __MW_CONSTANTS_H__
/*!
* @brief Direction enumeration
*/
enum MwDIRECTION {
MwNORTH = 0,
MwSOUTH,
MwEAST,
MwWEST
};
/*!
* @brief Orientation
*/
enum MwORIENTATION {
MwVERTICAL = 0,
MwHORIZONTAL
};
/*!
* @brief Alignment
*/
enum MwALIGNMENT {
MwALIGNMENT_CENTER = 0,
MwALIGNMENT_BEGINNING,
MwALIGNMENT_END
};
/*!
* @brief Default
*/
#define MwDEFAULT 0x0fffffff
/*!
* @brief Directory entry type
*/
enum MwDIRECTORY_TYPE {
MwDIRECTORY_FILE = 0,
MwDIRECTORY_DIRECTORY
};
/*!
* @brief Icon mask
*/
#define MwMB_ICONMASK 0xf
enum MwMB_ICON {
MwMB_ICONWARNING = 0x1,
MwMB_ICONINFO,
MwMB_ICONNOTE,
MwMB_ICONNEWS,
MwMB_ICONERROR,
MwMB_ICONCLOCK
};
/*!
* @brief Button mask
*/
#define MwMB_BUTTONMASK 0xf0
/*!
* @brief OK button
*/
#define MwMB_BUTTONOK 0x10
/*!
* @brief Cancel button
*/
#define MwMB_BUTTONCANCEL 0x20
/*!
* @brief Yes button
*/
#define MwMB_BUTTONYES 0x40
/*!
* @brief No button
*/
#define MwMB_BUTTONNO 0x80
/*!
* @brief Ok and Cancel button
*/
#define MwMB_BUTTONOKCANCEL (MwMB_BUTTONCANCEL | MwMB_BUTTONOK)
/*!
* @brief Yes and No button
*/
#define MwMB_BUTTONYESNO (MwMB_BUTTONYES | MwMB_BUTTONNO)
/*!
* @brief Yes, No and Cancel button
*/
#define MwMB_BUTTONYESNOCANCEL (MwMB_BUTTONYES | MwMB_BUTTONNO | MwMB_BUTTONCANCEL)
/* Whether or not GetXY/SetXY works with global or local coordinates */
enum MwCOORDINATE {
MwCOORDINATE_GLOBAL = 0,
MwCOORDINATE_LOCAL,
};
/* The clipboard type that MwGetClipboard should return */
enum MwCLIPBOARD {
/* the clipboard that is present on every platform that supports it */
MwCLIPBOARD_MAIN = 0,
/* the "primary" clipboard that Wayland stores to emulate X11's behavior. */
MwCLIPBOARD_PRIMARY,
};
enum MwMOUSE {
MwMOUSE_LEFT = 1,
MwMOUSE_MIDDLE,
MwMOUSE_RIGHT,
MwMOUSE_WHEELUP,
MwMOUSE_WHEELDOWN
};
#define MwKEY_FLAG 0x80000000
#define MwKEY_CONTROL_FLAG MwKEY_FLAG | 0x40000000
#define MwKEY_ALT_FLAG MwKEY_FLAG | 0x20000000
enum MwKEY {
MwKEY_BACKSPACE = MwKEY_FLAG | 1,
MwKEY_LEFT,
MwKEY_RIGHT,
MwKEY_UP,
MwKEY_DOWN,
MwKEY_ENTER,
MwKEY_ESCAPE,
MwKEY_LEFTSHIFT,
MwKEY_RIGHTSHIFT,
MwKEY_ALT,
MwKEY_CONTROL
};
#endif
/*!
* @file Mw/Constants.h
* @brief Constants
*/
#ifndef __MW_CONSTANTS_H__
#define __MW_CONSTANTS_H__
/*!
* @brief Direction enumeration
*/
enum MwDIRECTION {
MwNORTH = 0,
MwSOUTH,
MwEAST,
MwWEST
};
/*!
* @brief Orientation
*/
enum MwORIENTATION {
MwVERTICAL = 0,
MwHORIZONTAL
};
/*!
* @brief Alignment
*/
enum MwALIGNMENT {
MwALIGNMENT_CENTER = 0,
MwALIGNMENT_BEGINNING,
MwALIGNMENT_END
};
/*!
* @brief Default
*/
#define MwDEFAULT 0x0fffffff
/*!
* @brief Directory entry type
*/
enum MwDIRECTORY_TYPE {
MwDIRECTORY_FILE = 0,
MwDIRECTORY_DIRECTORY
};
/*!
* @brief Icon mask
*/
#define MwMB_ICONMASK 0xf
enum MwMB_ICON {
MwMB_ICONWARNING = 0x1,
MwMB_ICONINFO,
MwMB_ICONNOTE,
MwMB_ICONNEWS,
MwMB_ICONERROR,
MwMB_ICONCLOCK
};
/*!
* @brief Button mask
*/
#define MwMB_BUTTONMASK 0xf0
/*!
* @brief OK button
*/
#define MwMB_BUTTONOK 0x10
/*!
* @brief Cancel button
*/
#define MwMB_BUTTONCANCEL 0x20
/*!
* @brief Yes button
*/
#define MwMB_BUTTONYES 0x40
/*!
* @brief No button
*/
#define MwMB_BUTTONNO 0x80
/*!
* @brief Ok and Cancel button
*/
#define MwMB_BUTTONOKCANCEL (MwMB_BUTTONCANCEL | MwMB_BUTTONOK)
/*!
* @brief Yes and No button
*/
#define MwMB_BUTTONYESNO (MwMB_BUTTONYES | MwMB_BUTTONNO)
/*!
* @brief Yes, No and Cancel button
*/
#define MwMB_BUTTONYESNOCANCEL (MwMB_BUTTONYES | MwMB_BUTTONNO | MwMB_BUTTONCANCEL)
/* Whether or not GetXY/SetXY works with global or local coordinates */
enum MwCOORDINATE {
MwCOORDINATE_GLOBAL = 0,
MwCOORDINATE_LOCAL,
};
/* The clipboard type that MwGetClipboard should return */
enum MwCLIPBOARD {
/* the clipboard that is present on every platform that supports it */
MwCLIPBOARD_MAIN = 0,
/* the "primary" clipboard that Wayland stores to emulate X11's behavior. */
MwCLIPBOARD_PRIMARY,
};
enum MwMOUSE {
MwMOUSE_LEFT = 1,
MwMOUSE_MIDDLE,
MwMOUSE_RIGHT,
MwMOUSE_WHEELUP,
MwMOUSE_WHEELDOWN
};
#define MwKEY_FLAG 0x80000000
#define MwKEY_CONTROL_FLAG MwKEY_FLAG | 0x40000000
#define MwKEY_ALT_FLAG MwKEY_FLAG | 0x20000000
enum MwKEY {
MwKEY_BACKSPACE = MwKEY_FLAG | 1,
MwKEY_LEFT,
MwKEY_RIGHT,
MwKEY_UP,
MwKEY_DOWN,
MwKEY_ENTER,
MwKEY_ESCAPE,
MwKEY_LEFTSHIFT,
MwKEY_RIGHTSHIFT,
MwKEY_ALT,
MwKEY_CONTROL
};
#endif

View file

@ -1,405 +1,405 @@
/*!
* @file Mw/Core.h
* @brief Core
*/
#ifndef __MW_CORE_H__
#define __MW_CORE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
*/
#define MwDispatch(x, y) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x)
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
* @return `0` for success, otherwise failed
*/
#define MwDispatch2(x, y) \
((!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) ? x->widget_class->y(x) : 0)
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
* @param z Argument
*/
#define MwDispatch3(x, y, z) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x, z)
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
* @param z Argument
* @param w Argument
*/
#define MwDispatch4(x, y, z, w) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x, z, w)
#define MwWaitMS 30
#define MwDoubleClickTimeout 250
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Initializes the Milsko Toolkit
* @return `0` if successful
*/
MWDECL int MWAPI MwLibraryInit(void);
/*!
* @brief Creates a widget
* @param widget_class Widget class
* @param name Widget name
* @param parent Parent widget or `NULL`
* @param x X
* @param y Y
* @param width Width
* @param height Height
* @return Widget
*/
MWDECL MwWidget MWAPI MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height);
/*!
* @brief Creates a widget
* @param widget_class Widget class
* @param name Widget name
* @param parent Parent widget or `NULL`
* @param x X
* @param y Y
* @param width Width
* @param height Height
* @param ... Same with MwVaApply
* @return Widget
*/
MWDECL MwWidget MWAPI MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...);
/*!
* @brief Creates a widget
* @param widget_class Widget class
* @param name Widget name
* @param parent Parent widget or `NULL`
* @param x X
* @param y Y
* @param width Width
* @param height Height
* @param va Same with MwVaListApply
* @return Widget
*/
MWDECL MwWidget MWAPI MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va);
/*!
* @brief Destroys the widget and its child widgets
* @param handle Widget
*/
MWDECL void MWAPI MwDestroyWidget(MwWidget handle);
/*!
* @brief Executes a method specific to the widget (varadic version).
* @warning Prefer using corresponding functions for better code clarity and type safety.
* @param handle Widget
* @param ... Widget function arguments.
*/
MWDECL void MWAPI MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, ...);
/*!
* @brief Executes a method specific to the widget (va_list version).
* @warning Prefer using corresponding functions for better code clarity and type safety.
* @param handle Widget
* @param va Widget function arguments.
*/
MWDECL void MWAPI MwVaListWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va);
/*!
* @brief Runs the main loop
* @param handle Widget
*/
MWDECL void MWAPI MwLoop(MwWidget handle);
/*!
* @brief Runs the single step
* @param handle Widget
* @return `0` if successful
*/
MWDECL int MWAPI MwStep(MwWidget handle);
/*!
* @brief Check if any event is pending
* @param handle Widget
* @return `1` if any event is pending
*/
MWDECL int MWAPI MwPending(MwWidget handle);
/*!
* @brief Sets an integer property
* @param handle Widget
* @param key Key
* @param n Value
*/
MWDECL void MWAPI MwSetInteger(MwWidget handle, const char* key, int n);
/*!
* @brief Sets a text property
* @param handle Widget
* @param key Key
* @param value Value
*/
MWDECL void MWAPI MwSetText(MwWidget handle, const char* key, const char* value);
/*!
* @brief Sets a void pointer property
* @param handle Widget
* @param key Key
* @param value Value
*/
MWDECL void MWAPI MwSetVoid(MwWidget handle, const char* key, void* value);
/*!
* @brief Gets the integer property
* @param handle Widget
* @param key Key
* @return Value
*/
MWDECL int MWAPI MwGetInteger(MwWidget handle, const char* key);
/*!
* @brief Gets the text property
* @param handle Widget
* @param key Key
* @return Value
*/
MWDECL const char* MWAPI MwGetText(MwWidget handle, const char* key);
/*!
* @brief Gets the void pointer property
* @param handle Widget
* @param key Key
* @return Value
*/
MWDECL void* MWAPI MwGetVoid(MwWidget handle, const char* key);
/*!
* @brief Sets the default property
* @param handle Widget
* @warning This is called when widget is created
*/
MWDECL void MWAPI MwSetDefault(MwWidget handle);
/*!
* @brief Sets the properties
* @param handle Widget
* @param ... Properties
*/
MWDECL void MWAPI MwVaApply(MwWidget handle, ...);
/*!
* @brief Sets properties
* @param handle Widget
* @param va Properties
*/
MWDECL void MWAPI MwVaListApply(MwWidget handle, va_list va);
/*!
* @brief Sets a user handler
* @param handle Widget
* @param key Key
* @param handler Handler
* @param user_data User data passed to handler
*/
MWDECL void MWAPI MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data);
/*!
* @brief Dispatches the user handler
* @param handle Widget
* @param key Key
* @param handler_data Handler data passed to handler
*/
MWDECL void MWAPI MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data);
/*!
* @brief Sets an error handler
* @param handle Widget
* @param handler Handler
* @param user_data User data passed to handler
*/
MWDECL void MWAPI MwSetErrorHandler(MwErrorHandler handler, void* user_data);
/*!
* @brief Dispatches the error handler
* @param code Error code
* @param message Error message
*/
MWDECL void MWAPI MwDispatchError(int code, const char* message);
/*!
* @brief Forcefully makes widget render
* @param handle Widget
*/
MWDECL void MWAPI MwForceRender(MwWidget handle);
/*!
* @brief Forcefully makes widget render
* @param handle Widget
* @param ptr Ignored
*/
MWDECL void MWAPI MwForceRender2(MwWidget handle, void* ptr);
/*!
* @brief Adds an widget to tick handler list
* @param handle Widget
*/
MWDECL void MWAPI MwAddTickList(MwWidget handle);
/*!
* @brief Focus the widget
* @param handle Widget
*/
MWDECL void MWAPI MwFocus(MwWidget handle);
/*!
* @brief Grabs the pointer
* @param handle Widget
* @param toggle Toggle
*/
MWDECL void MWAPI MwGrabPointer(MwWidget handle, int toggle);
/*!
* @brief Hides the cursor
* @param handle Widget
*/
MWDECL void MWAPI MwHideCursor(MwWidget handle);
/*!
* @brief Toggles the dark theme
* @param handle Widget
* @param toggle Toggle
* @deprecated Use MwNdarkTheme instead
*/
MWDECL void MWAPI MwSetDarkTheme(MwWidget handle, int toggle);
/*!
* @brief Gets the parent widget
* @param handle Widget
* @return Parent widget
*/
MWDECL MwWidget MWAPI MwGetParent(MwWidget handle);
/*!
* @brief Show widget
* @param handle Widget
* @param toggle Toggle
*/
MWDECL void MWAPI MwShow(MwWidget handle, int toggle);
/*!
* @brief Reparents widget
* @param handle Widget
* @param new_parent New parent
*/
MWDECL void MWAPI MwReparent(MwWidget handle, MwWidget new_parent);
/*!
* @brief Gets class of widget
* @param handle Widget
* @return Class
*/
MWDECL MwClass MWAPI MwGetClass(MwWidget handle);
/*!
* @brief Gets name of widget
* @param handle Widget
* @return Name
*/
MWDECL const char* MWAPI MwGetName(MwWidget handle);
/*!
* @brief Gets children of widget
* @param handle Widget
* @return Children (NULL-terminated array)
*/
MWDECL MwWidget* MWAPI MwGetChildren(MwWidget handle);
/*!
* @brief Gets the cursor coordinate
* @param handle Widget
* @param point Point
*/
MWDECL void MWAPI MwGetCursorCoord(MwWidget handle, MwPoint* point);
/*!
* @brief Gets the screen size
* @param handle Widget
* @param rect Rectangle
*/
MWDECL void MWAPI MwGetScreenSize(MwWidget handle, MwRect* rect);
/*!
* @brief Reports whether a widget reports global or local coordinates upon GetXY/SetXY. Anything with a parent reports local, and most backends report global coordinates being supported for top level windows, but some (Wayland) do not.
* @param handle Widget
*/
MWDECL int MWAPI MwGetCoordinateType(MwWidget handle);
/*!
* @brief Queue to get clipboard content
* @param handle Widget
* @param clipboard_type The Clipboard Type to get. See MwClipboardType. This is ignored on backends that aren't X11/Wayland, so if you're unsure, just use MwClipboardMain
*/
MWDECL void MWAPI MwGetClipboard(MwWidget handle, int clipboard_type);
/*!
* @brief Set user pointer
* @param handle Widget
* @param user User pointer
*/
MWDECL void MWAPI MwSetUser(MwWidget handle, void* user);
/*!
* @brief Get user pointer
* @param handle Widget
* @return User pointer
*/
MWDECL void* MWAPI MwGetUser(MwWidget handle);
/*!
* @brief Free the widget
* @param handle Widget
* @warning This is used internally!
* @note You can call this on toplevel widget safely if you're sure no event loops will be ran, e.g. after `MwLoop`.
*/
MWDECL void MWAPI MwFreeWidget(MwWidget handle);
/*!
* @brief Gets the frame of the widget
* @param handle Widget
* @param rect Frame
*/
MWDECL void MWAPI MwGetFrame(MwWidget handle, MwRect* rect);
#ifdef _MILSKO
MWDECL void MwForceRender_Internal(MwWidget handle);
MWDECL void MwForceRender2_Internal(MwWidget handle, void* ptr);
#define MwForceRender MwForceRender_Internal
#define MwForceRender2 MwForceRender2_Internal
#endif
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Core.h
* @brief Core
*/
#ifndef __MW_CORE_H__
#define __MW_CORE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
*/
#define MwDispatch(x, y) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x)
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
* @return `0` for success, otherwise failed
*/
#define MwDispatch2(x, y) \
((!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) ? x->widget_class->y(x) : 0)
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
* @param z Argument
*/
#define MwDispatch3(x, y, z) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x, z)
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
* @param z Argument
* @param w Argument
*/
#define MwDispatch4(x, y, z, w) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x, z, w)
#define MwWaitMS 30
#define MwDoubleClickTimeout 250
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Initializes the Milsko Toolkit
* @return `0` if successful
*/
MWDECL int MWAPI MwLibraryInit(void);
/*!
* @brief Creates a widget
* @param widget_class Widget class
* @param name Widget name
* @param parent Parent widget or `NULL`
* @param x X
* @param y Y
* @param width Width
* @param height Height
* @return Widget
*/
MWDECL MwWidget MWAPI MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height);
/*!
* @brief Creates a widget
* @param widget_class Widget class
* @param name Widget name
* @param parent Parent widget or `NULL`
* @param x X
* @param y Y
* @param width Width
* @param height Height
* @param ... Same with MwVaApply
* @return Widget
*/
MWDECL MwWidget MWAPI MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...);
/*!
* @brief Creates a widget
* @param widget_class Widget class
* @param name Widget name
* @param parent Parent widget or `NULL`
* @param x X
* @param y Y
* @param width Width
* @param height Height
* @param va Same with MwVaListApply
* @return Widget
*/
MWDECL MwWidget MWAPI MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va);
/*!
* @brief Destroys the widget and its child widgets
* @param handle Widget
*/
MWDECL void MWAPI MwDestroyWidget(MwWidget handle);
/*!
* @brief Executes a method specific to the widget (varadic version).
* @warning Prefer using corresponding functions for better code clarity and type safety.
* @param handle Widget
* @param ... Widget function arguments.
*/
MWDECL void MWAPI MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, ...);
/*!
* @brief Executes a method specific to the widget (va_list version).
* @warning Prefer using corresponding functions for better code clarity and type safety.
* @param handle Widget
* @param va Widget function arguments.
*/
MWDECL void MWAPI MwVaListWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va);
/*!
* @brief Runs the main loop
* @param handle Widget
*/
MWDECL void MWAPI MwLoop(MwWidget handle);
/*!
* @brief Runs the single step
* @param handle Widget
* @return `0` if successful
*/
MWDECL int MWAPI MwStep(MwWidget handle);
/*!
* @brief Check if any event is pending
* @param handle Widget
* @return `1` if any event is pending
*/
MWDECL int MWAPI MwPending(MwWidget handle);
/*!
* @brief Sets an integer property
* @param handle Widget
* @param key Key
* @param n Value
*/
MWDECL void MWAPI MwSetInteger(MwWidget handle, const char* key, int n);
/*!
* @brief Sets a text property
* @param handle Widget
* @param key Key
* @param value Value
*/
MWDECL void MWAPI MwSetText(MwWidget handle, const char* key, const char* value);
/*!
* @brief Sets a void pointer property
* @param handle Widget
* @param key Key
* @param value Value
*/
MWDECL void MWAPI MwSetVoid(MwWidget handle, const char* key, void* value);
/*!
* @brief Gets the integer property
* @param handle Widget
* @param key Key
* @return Value
*/
MWDECL int MWAPI MwGetInteger(MwWidget handle, const char* key);
/*!
* @brief Gets the text property
* @param handle Widget
* @param key Key
* @return Value
*/
MWDECL const char* MWAPI MwGetText(MwWidget handle, const char* key);
/*!
* @brief Gets the void pointer property
* @param handle Widget
* @param key Key
* @return Value
*/
MWDECL void* MWAPI MwGetVoid(MwWidget handle, const char* key);
/*!
* @brief Sets the default property
* @param handle Widget
* @warning This is called when widget is created
*/
MWDECL void MWAPI MwSetDefault(MwWidget handle);
/*!
* @brief Sets the properties
* @param handle Widget
* @param ... Properties
*/
MWDECL void MWAPI MwVaApply(MwWidget handle, ...);
/*!
* @brief Sets properties
* @param handle Widget
* @param va Properties
*/
MWDECL void MWAPI MwVaListApply(MwWidget handle, va_list va);
/*!
* @brief Sets a user handler
* @param handle Widget
* @param key Key
* @param handler Handler
* @param user_data User data passed to handler
*/
MWDECL void MWAPI MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data);
/*!
* @brief Dispatches the user handler
* @param handle Widget
* @param key Key
* @param handler_data Handler data passed to handler
*/
MWDECL void MWAPI MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data);
/*!
* @brief Sets an error handler
* @param handle Widget
* @param handler Handler
* @param user_data User data passed to handler
*/
MWDECL void MWAPI MwSetErrorHandler(MwErrorHandler handler, void* user_data);
/*!
* @brief Dispatches the error handler
* @param code Error code
* @param message Error message
*/
MWDECL void MWAPI MwDispatchError(int code, const char* message);
/*!
* @brief Forcefully makes widget render
* @param handle Widget
*/
MWDECL void MWAPI MwForceRender(MwWidget handle);
/*!
* @brief Forcefully makes widget render
* @param handle Widget
* @param ptr Ignored
*/
MWDECL void MWAPI MwForceRender2(MwWidget handle, void* ptr);
/*!
* @brief Adds an widget to tick handler list
* @param handle Widget
*/
MWDECL void MWAPI MwAddTickList(MwWidget handle);
/*!
* @brief Focus the widget
* @param handle Widget
*/
MWDECL void MWAPI MwFocus(MwWidget handle);
/*!
* @brief Grabs the pointer
* @param handle Widget
* @param toggle Toggle
*/
MWDECL void MWAPI MwGrabPointer(MwWidget handle, int toggle);
/*!
* @brief Hides the cursor
* @param handle Widget
*/
MWDECL void MWAPI MwHideCursor(MwWidget handle);
/*!
* @brief Toggles the dark theme
* @param handle Widget
* @param toggle Toggle
* @deprecated Use MwNdarkTheme instead
*/
MWDECL void MWAPI MwSetDarkTheme(MwWidget handle, int toggle);
/*!
* @brief Gets the parent widget
* @param handle Widget
* @return Parent widget
*/
MWDECL MwWidget MWAPI MwGetParent(MwWidget handle);
/*!
* @brief Show widget
* @param handle Widget
* @param toggle Toggle
*/
MWDECL void MWAPI MwShow(MwWidget handle, int toggle);
/*!
* @brief Reparents widget
* @param handle Widget
* @param new_parent New parent
*/
MWDECL void MWAPI MwReparent(MwWidget handle, MwWidget new_parent);
/*!
* @brief Gets class of widget
* @param handle Widget
* @return Class
*/
MWDECL MwClass MWAPI MwGetClass(MwWidget handle);
/*!
* @brief Gets name of widget
* @param handle Widget
* @return Name
*/
MWDECL const char* MWAPI MwGetName(MwWidget handle);
/*!
* @brief Gets children of widget
* @param handle Widget
* @return Children (NULL-terminated array)
*/
MWDECL MwWidget* MWAPI MwGetChildren(MwWidget handle);
/*!
* @brief Gets the cursor coordinate
* @param handle Widget
* @param point Point
*/
MWDECL void MWAPI MwGetCursorCoord(MwWidget handle, MwPoint* point);
/*!
* @brief Gets the screen size
* @param handle Widget
* @param rect Rectangle
*/
MWDECL void MWAPI MwGetScreenSize(MwWidget handle, MwRect* rect);
/*!
* @brief Reports whether a widget reports global or local coordinates upon GetXY/SetXY. Anything with a parent reports local, and most backends report global coordinates being supported for top level windows, but some (Wayland) do not.
* @param handle Widget
*/
MWDECL int MWAPI MwGetCoordinateType(MwWidget handle);
/*!
* @brief Queue to get clipboard content
* @param handle Widget
* @param clipboard_type The Clipboard Type to get. See MwClipboardType. This is ignored on backends that aren't X11/Wayland, so if you're unsure, just use MwClipboardMain
*/
MWDECL void MWAPI MwGetClipboard(MwWidget handle, int clipboard_type);
/*!
* @brief Set user pointer
* @param handle Widget
* @param user User pointer
*/
MWDECL void MWAPI MwSetUser(MwWidget handle, void* user);
/*!
* @brief Get user pointer
* @param handle Widget
* @return User pointer
*/
MWDECL void* MWAPI MwGetUser(MwWidget handle);
/*!
* @brief Free the widget
* @param handle Widget
* @warning This is used internally!
* @note You can call this on toplevel widget safely if you're sure no event loops will be ran, e.g. after `MwLoop`.
*/
MWDECL void MWAPI MwFreeWidget(MwWidget handle);
/*!
* @brief Gets the frame of the widget
* @param handle Widget
* @param rect Frame
*/
MWDECL void MWAPI MwGetFrame(MwWidget handle, MwRect* rect);
#ifdef _MILSKO
MWDECL void MwForceRender_Internal(MwWidget handle);
MWDECL void MwForceRender2_Internal(MwWidget handle, void* ptr);
#define MwForceRender MwForceRender_Internal
#define MwForceRender2 MwForceRender2_Internal
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,96 +1,96 @@
/*!
* @file Mw/Default.h
* @brief Default properties
*/
#ifndef __MW_DEFAULT_H__
#define __MW_DEFAULT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Default background color
*/
MWDECL const char* MwDefaultBackground;
/*!
* @brief Default foreground color
*/
MWDECL const char* MwDefaultForeground;
/*!
* @brief Default sub background color
*/
MWDECL const char* MwDefaultSubBackground;
/*!
* @brief Default sub foreground color
*/
MWDECL const char* MwDefaultSubForeground;
/*!
* @brief Default title background color
*/
MWDECL const char* MwDefaultTitleBackground;
/*!
* @brief Default title foreground color
*/
MWDECL const char* MwDefaultTitleForeground;
/*!
* @brief Default dark theme background color
*/
MWDECL const char* MwDefaultDarkBackground;
/*!
* @brief Default dark theme foreground color
*/
MWDECL const char* MwDefaultDarkForeground;
/*!
* @brief Default dark theme sub background color
*/
MWDECL const char* MwDefaultDarkSubBackground;
/*!
* @brief Default dark theme sub foreground color
*/
MWDECL const char* MwDefaultDarkSubForeground;
/*!
* @brief Default dark theme title background color
*/
MWDECL const char* MwDefaultDarkTitleBackground;
/*!
* @brief Default dark theme title foreground color
*/
MWDECL const char* MwDefaultDarkTitleForeground;
/*!
* @brief Default shadow difference
*/
MWDECL const int MwDefaultShadow;
/*!
* @brief Gets default border width
* @param handle Widget
*/
MWDECL int MWAPI MwDefaultBorderWidth(MwWidget handle);
/*!
* @brief Gets default thin border width
* @param handle Widget
*/
MWDECL int MwDefaultThinBorderWidth(MwWidget handle);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Default.h
* @brief Default properties
*/
#ifndef __MW_DEFAULT_H__
#define __MW_DEFAULT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Default background color
*/
MWDECL const char* MwDefaultBackground;
/*!
* @brief Default foreground color
*/
MWDECL const char* MwDefaultForeground;
/*!
* @brief Default sub background color
*/
MWDECL const char* MwDefaultSubBackground;
/*!
* @brief Default sub foreground color
*/
MWDECL const char* MwDefaultSubForeground;
/*!
* @brief Default title background color
*/
MWDECL const char* MwDefaultTitleBackground;
/*!
* @brief Default title foreground color
*/
MWDECL const char* MwDefaultTitleForeground;
/*!
* @brief Default dark theme background color
*/
MWDECL const char* MwDefaultDarkBackground;
/*!
* @brief Default dark theme foreground color
*/
MWDECL const char* MwDefaultDarkForeground;
/*!
* @brief Default dark theme sub background color
*/
MWDECL const char* MwDefaultDarkSubBackground;
/*!
* @brief Default dark theme sub foreground color
*/
MWDECL const char* MwDefaultDarkSubForeground;
/*!
* @brief Default dark theme title background color
*/
MWDECL const char* MwDefaultDarkTitleBackground;
/*!
* @brief Default dark theme title foreground color
*/
MWDECL const char* MwDefaultDarkTitleForeground;
/*!
* @brief Default shadow difference
*/
MWDECL const int MwDefaultShadow;
/*!
* @brief Gets default border width
* @param handle Widget
*/
MWDECL int MWAPI MwDefaultBorderWidth(MwWidget handle);
/*!
* @brief Gets default thin border width
* @param handle Widget
*/
MWDECL int MwDefaultThinBorderWidth(MwWidget handle);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,27 +1,27 @@
/*!
* @file Mw/Dialog/ColorPicker.h
* @brief Color picker
*/
#ifndef __MW_COLORPICKER_H__
#define __MW_COLORPICKER_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a color picker
* @param handle Widget
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MWAPI MwColorPicker(MwWidget handle, const char* title);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Dialog/ColorPicker.h
* @brief Color picker
*/
#ifndef __MW_COLORPICKER_H__
#define __MW_COLORPICKER_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a color picker
* @param handle Widget
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MWAPI MwColorPicker(MwWidget handle, const char* title);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,27 +1,27 @@
/*!
* @file Mw/Dialog/DirectoryChooser.h
* @brief Directory chooser
*/
#ifndef __MW_DIRECTORYCHOOSER_H__
#define __MW_DIRECTORYCHOOSER_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a directory chooser
* @param handle Widget
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MWAPI MwDirectoryChooser(MwWidget handle, const char* title);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Dialog/DirectoryChooser.h
* @brief Directory chooser
*/
#ifndef __MW_DIRECTORYCHOOSER_H__
#define __MW_DIRECTORYCHOOSER_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a directory chooser
* @param handle Widget
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MWAPI MwDirectoryChooser(MwWidget handle, const char* title);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,36 +1,36 @@
/*!
* @file Mw/Dialog/FileChooser.h
* @brief File chooser
*/
#ifndef __MW_FILECHOOSER_H__
#define __MW_FILECHOOSER_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a file chooser
* @param handle Widget
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MWAPI MwFileChooser(MwWidget handle, const char* title);
/*!
* @brief Creates a file chooser
* @param handle Widget
* @param title Title text
* @param dir Show directory only or not
* @return Widget
*/
MWDECL MwWidget MWAPI MwFileChooserEx(MwWidget handle, const char* title, int dir);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Dialog/FileChooser.h
* @brief File chooser
*/
#ifndef __MW_FILECHOOSER_H__
#define __MW_FILECHOOSER_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a file chooser
* @param handle Widget
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MWAPI MwFileChooser(MwWidget handle, const char* title);
/*!
* @brief Creates a file chooser
* @param handle Widget
* @param title Title text
* @param dir Show directory only or not
* @return Widget
*/
MWDECL MwWidget MWAPI MwFileChooserEx(MwWidget handle, const char* title, int dir);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,36 +1,36 @@
/*!
* @file Mw/Dialog/MessageBox.h
* @brief Message box
*/
#ifndef __MW_MESSAGEBOX_H__
#define __MW_MESSAGEBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a message box
* @param handle Widget
* @param text Text
* @param title Title text
* @param flag Flag
* @return Widget
*/
MWDECL MwWidget MWAPI MwMessageBox(MwWidget handle, const char* text, const char* title, unsigned int flag);
/*!
* @brief Gets a child of the message box
* @param handle Widget
* @param child Child
*/
MWDECL MwWidget MWAPI MwMessageBoxGetChild(MwWidget handle, int child);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Dialog/MessageBox.h
* @brief Message box
*/
#ifndef __MW_MESSAGEBOX_H__
#define __MW_MESSAGEBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Creates a message box
* @param handle Widget
* @param text Text
* @param title Title text
* @param flag Flag
* @return Widget
*/
MWDECL MwWidget MWAPI MwMessageBox(MwWidget handle, const char* text, const char* title, unsigned int flag);
/*!
* @brief Gets a child of the message box
* @param handle Widget
* @param child Child
*/
MWDECL MwWidget MWAPI MwMessageBoxGetChild(MwWidget handle, int child);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,242 +1,242 @@
/*!
* @file Mw/Draw.h
* @brief Common drawing API
*/
#ifndef __MW_DRAW_H__
#define __MW_DRAW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Parses a color text
* @param handle Widget
* @param text Color text
* @return Color
*/
MWDECL MwLLColor MWAPI MwParseColor(MwWidget handle, const char* text);
/*!
* @brief Parses a color text
* @param text Color text
* @param rgb RGB
*/
MWDECL void MWAPI MwParseColorNoAllocate(const char* text, MwRGB* rgb);
/*!
* @brief Initialize color table
* @warning This is called in MwLibraryInit - you do not have to call this
*/
MWDECL void MWAPI MwColorTableInit(void);
/*!
* @brief Lighten a color
* @param handle Widget
* @param color Color
* @param r Red
* @param g Green
* @param b Blue
* @return Color
*/
MWDECL MwLLColor MWAPI MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b);
/*!
* @brief Draws a filled rectangle
* @param handle Widget
* @param rect Rectangle area
* @param color Color
*/
MWDECL void MWAPI MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
/*!
* @brief Draws a filled rectangle that fades to a darker color
* @param handle Widget
* @param rect Rectangle area
* @param color Color
*/
MWDECL void MWAPI MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color);
/*!
* @brief Draws a frame
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
/*!
* @brief Draws a frame
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @param border Border
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
/*!
* @brief Does the DrawFrame/DrawRect combo used for drawing widget.
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
/*!
* @brief Draws a triangle
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
*/
MWDECL void MWAPI MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction);
/*!
* @brief Draws a frame with specified border width
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @param border Border width
* @param diff Difference (set this to 0 if you don't know what this does)
* @param same Same as dark color
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same);
/*!
* @brief Creates a pixmap from image
* @param handle Widget
* @param path Path
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadImage(MwWidget handle, const char* path);
/*!
* @brief Get color components
* @param color Color
* @param red Pointer to red color
* @param green Pointer to green color
* @param blue Pointer to blue color
*/
MWDECL void MWAPI MwColorGet(MwLLColor color, int* red, int* green, int* blue);
/*!
* @brief Creates a pixmap from raw data
* @param handle Widget
* @param rgb RGBA data
* @param width Width
* @param height Height
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
/*!
* @brief Updates a pixmap using raw data
* @param pixmap Pixmap to update
* @param rgb RGBA data
*/
MWDECL void MWAPI MwPixmapReloadRaw(MwLLPixmap pixmap, unsigned char* rgb);
/*!
* @brief Gets the raw data of pixmap
* @param pixmap Pixmap
* @return RGBA data
*/
MWDECL unsigned char* MWAPI MwPixmapGetRaw(MwLLPixmap pixmap);
/*!
* @brief Gets the size of pixmap
* @param pixmap Pixmap
* @param rect Size
*/
MWDECL void MWAPI MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect);
/*!
* @brief Creates a pixmap from XPM data
* @param handle Widget
* @param data Data
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadXPM(MwWidget handle, char** data);
/*!
* @brief Creates a pixmap from icon data
* @param handle Widget
* @param data Data
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadIcon(MwWidget handle, MwU32* data);
/*!
* @brief Draws a diamond
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
*/
MWDECL void MWAPI MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
/* text.c */
/*!
* @brief Draws a text
* @param handle Widget
* @param ttf TTF, NULLable
* @param point Center point of the text
* @param text Text
* @param align Align
* @param color Color
*/
MWDECL void MWAPI MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color);
/*!
* @brief Calculates a text width
* @param handle Widget
* @param text Text
* @param font Font, NULLable
* @return Text width
*/
MWDECL int MWAPI MwTextWidth(MwWidget handle, MwFLFont font, const char* text);
/*!
* @brief Calculates a text height
* @param handle Widget
* @param text Text
* @param font Font, NULLable
* @return Text height
*/
MWDECL int MWAPI MwTextHeight(MwWidget handle, MwFLFont font, const char* text);
/* color.c */
/*!
* @brief Parses a color name
* @param handle Widget
* @param color Color name
* @return Color
*/
MWDECL MwLLColor MWAPI MwParseColorName(MwWidget handle, const char* color);
/*!
* @brief Parses a color name
* @param color Color name
* @param rgb RGB
*/
MWDECL void MWAPI MwParseColorNameNoAllocate(const char* color, MwRGB* rgb);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Draw.h
* @brief Common drawing API
*/
#ifndef __MW_DRAW_H__
#define __MW_DRAW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Parses a color text
* @param handle Widget
* @param text Color text
* @return Color
*/
MWDECL MwLLColor MWAPI MwParseColor(MwWidget handle, const char* text);
/*!
* @brief Parses a color text
* @param text Color text
* @param rgb RGB
*/
MWDECL void MWAPI MwParseColorNoAllocate(const char* text, MwRGB* rgb);
/*!
* @brief Initialize color table
* @warning This is called in MwLibraryInit - you do not have to call this
*/
MWDECL void MWAPI MwColorTableInit(void);
/*!
* @brief Lighten a color
* @param handle Widget
* @param color Color
* @param r Red
* @param g Green
* @param b Blue
* @return Color
*/
MWDECL MwLLColor MWAPI MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b);
/*!
* @brief Draws a filled rectangle
* @param handle Widget
* @param rect Rectangle area
* @param color Color
*/
MWDECL void MWAPI MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
/*!
* @brief Draws a filled rectangle that fades to a darker color
* @param handle Widget
* @param rect Rectangle area
* @param color Color
*/
MWDECL void MWAPI MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color);
/*!
* @brief Draws a frame
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
/*!
* @brief Draws a frame
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @param border Border
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
/*!
* @brief Does the DrawFrame/DrawRect combo used for drawing widget.
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
/*!
* @brief Draws a triangle
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
*/
MWDECL void MWAPI MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction);
/*!
* @brief Draws a frame with specified border width
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @param border Border width
* @param diff Difference (set this to 0 if you don't know what this does)
* @param same Same as dark color
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same);
/*!
* @brief Creates a pixmap from image
* @param handle Widget
* @param path Path
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadImage(MwWidget handle, const char* path);
/*!
* @brief Get color components
* @param color Color
* @param red Pointer to red color
* @param green Pointer to green color
* @param blue Pointer to blue color
*/
MWDECL void MWAPI MwColorGet(MwLLColor color, int* red, int* green, int* blue);
/*!
* @brief Creates a pixmap from raw data
* @param handle Widget
* @param rgb RGBA data
* @param width Width
* @param height Height
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
/*!
* @brief Updates a pixmap using raw data
* @param pixmap Pixmap to update
* @param rgb RGBA data
*/
MWDECL void MWAPI MwPixmapReloadRaw(MwLLPixmap pixmap, unsigned char* rgb);
/*!
* @brief Gets the raw data of pixmap
* @param pixmap Pixmap
* @return RGBA data
*/
MWDECL unsigned char* MWAPI MwPixmapGetRaw(MwLLPixmap pixmap);
/*!
* @brief Gets the size of pixmap
* @param pixmap Pixmap
* @param rect Size
*/
MWDECL void MWAPI MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect);
/*!
* @brief Creates a pixmap from XPM data
* @param handle Widget
* @param data Data
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadXPM(MwWidget handle, char** data);
/*!
* @brief Creates a pixmap from icon data
* @param handle Widget
* @param data Data
* @return Pixmap
*/
MWDECL MwLLPixmap MWAPI MwLoadIcon(MwWidget handle, MwU32* data);
/*!
* @brief Draws a diamond
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
*/
MWDECL void MWAPI MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
/* text.c */
/*!
* @brief Draws a text
* @param handle Widget
* @param ttf TTF, NULLable
* @param point Center point of the text
* @param text Text
* @param align Align
* @param color Color
*/
MWDECL void MWAPI MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color);
/*!
* @brief Calculates a text width
* @param handle Widget
* @param text Text
* @param font Font, NULLable
* @return Text width
*/
MWDECL int MWAPI MwTextWidth(MwWidget handle, MwFLFont font, const char* text);
/*!
* @brief Calculates a text height
* @param handle Widget
* @param text Text
* @param font Font, NULLable
* @return Text height
*/
MWDECL int MWAPI MwTextHeight(MwWidget handle, MwFLFont font, const char* text);
/* color.c */
/*!
* @brief Parses a color name
* @param handle Widget
* @param color Color name
* @return Color
*/
MWDECL MwLLColor MWAPI MwParseColorName(MwWidget handle, const char* color);
/*!
* @brief Parses a color name
* @param color Color name
* @param rgb RGB
*/
MWDECL void MWAPI MwParseColorNameNoAllocate(const char* color, MwRGB* rgb);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,33 +1,33 @@
/*!
* @file Mw/Font.h
* @brief Font
*/
#ifndef __MW_FONT_H__
#define __MW_FONT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Loads a TTF Font
* @param data Data
* @param size Data size
* @return Font handle
*/
MWDECL void* MWAPI MwFontLoad(unsigned char* data, unsigned int size);
/*!
* @brief Frees a font handle
* @param handle Handle
*/
MWDECL void MWAPI MwFontFree(void* handle);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Font.h
* @brief Font
*/
#ifndef __MW_FONT_H__
#define __MW_FONT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Loads a TTF Font
* @param data Data
* @param size Data size
* @return Font handle
*/
MWDECL void* MWAPI MwFontLoad(unsigned char* data, unsigned int size);
/*!
* @brief Frees a font handle
* @param handle Handle
*/
MWDECL void MWAPI MwFontFree(void* handle);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,358 +1,358 @@
/*!
* @file Mw/LowLevel.h
* @brief Low-level drawing API
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_H__
#define __MW_LOWLEVEL_H__
#include <Mw/BaseTypes.h>
#include <Mw/MachDep.h>
typedef struct _MwLLHandler* MwLLHandler;
typedef struct _MwLLCommon* MwLLCommon;
typedef struct _MwLLCommonColor* MwLLCommonColor;
typedef struct _MwLLCommonPixmap* MwLLCommonPixmap;
#ifdef _MILSKO
typedef union _MwLL* MwLL;
typedef union _MwLLColor* MwLLColor;
typedef union _MwLLPixmap* MwLLPixmap;
typedef struct _MwFLFont* MwFLFont;
#else
typedef void* MwLL;
typedef void* MwLLColor;
typedef void* MwLLPixmap;
typedef void* MwFLFont;
#endif
enum MwLLBackends {
MwLLBackendX11 = 0,
MwLLBackendGDI,
MwLLBackendWayland,
MwLLBackendCocoa,
MwLLBackendHaiku
};
struct _MwLLCommon {
void* user;
int copy_buffer;
int type;
int coordinate_type;
MwBool supports_transparency;
MwLLHandler handler;
};
struct _MwLLCommonColor {
MwU8 red;
MwU8 green;
MwU8 blue;
};
struct _MwLLCommonPixmap {
int width;
int height;
unsigned char* raw;
void* user;
};
#ifdef USE_DBUS
typedef struct _MwLLDBusFuncTable {
void* lib;
void (*dbus_error_init)(DBusError* error);
DBusConnection* (*dbus_bus_get)(DBusBusType type, DBusError* error);
dbus_bool_t (*dbus_error_is_set)(const DBusError* error);
void (*dbus_error_free)(DBusError* error);
DBusMessage* (*dbus_message_new_method_call)(const char* bus_name, const char* path, const char* iface, const char* method);
void (*dbus_message_iter_init_append)(DBusMessage* message, DBusMessageIter* iter);
dbus_bool_t (*dbus_message_iter_append_basic)(DBusMessageIter* iter, int type, const void* value);
void (*dbus_connection_flush)(DBusConnection* connection);
dbus_bool_t (*dbus_connection_read_write)(DBusConnection* connection, int timeout_milliseconds);
DBusMessage* (*dbus_connection_send_with_reply_and_block)(DBusConnection* connection, DBusMessage* message, int timeout_milliseconds, DBusError* error);
DBusMessage* (*dbus_connection_pop_message)(DBusConnection* connection);
void (*dbus_bus_add_match)(DBusConnection* connection, const char* rule, DBusError* error);
void (*dbus_message_unref)(DBusMessage* message);
dbus_bool_t (*dbus_message_iter_init)(DBusMessage* message, DBusMessageIter* iter);
dbus_bool_t (*dbus_message_is_signal)(DBusMessage* message, const char* iface, const char* signal_name);
int (*dbus_message_iter_get_arg_type)(DBusMessageIter* iter);
void (*dbus_message_iter_recurse)(DBusMessageIter* iter, DBusMessageIter* sub);
void (*dbus_message_iter_next)(DBusMessageIter* iter);
void (*dbus_connection_unref)(DBusConnection* connection);
void (*dbus_message_iter_get_basic)(DBusMessageIter* iter, void* value);
} MwLLDBusFuncTable;
typedef struct _MwLLDBusContext {
DBusConnection* dbus_conn;
DBusError dbus_err;
DBusMessage* dbus_msg;
DBusMessage* dbus_reply;
} MwLLDBusContext;
typedef void (*MwLLDBusPortalPollListener)(MwLL handle, MwU32 new_value);
/* setup the dbus func table. Returns false and prints a warning if dbus couldn't be found. */
MWDECL MwBool MwLLDBusFuncSetup(MwLLDBusFuncTable* tbl);
MWDECL MwBool MwLLDBusNewContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
MWDECL MwBool MwLLDBusPortalGet(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, const char* portal, const char* namespace, const char* key, void* out);
MWDECL MwBool MwLLDBusPortalWatch(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, const char* portal);
MWDECL MwBool MwLLDBusPortalPoll(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, MwLL handle, const char* portal, const char* namespace, const char* key, MwLLDBusPortalPollListener);
MWDECL void MwLLDBusFreeContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
#endif
#ifdef _MILSKO
#ifdef USE_X11
#include <Mw/LowLevel/X11.h>
#endif
#ifdef USE_GDI
#include <Mw/LowLevel/GDI.h>
#endif
#ifdef USE_WAYLAND
#include <Mw/LowLevel/Wayland.h>
#endif
#ifdef USE_COCOA
#include <Mw/LowLevel/Cocoa.h>
#endif
#ifdef CLASSIC_MAC_OS
#include <Mw/LowLevel/ClassicMacOS.h>
#endif
#ifdef USE_HAIKU
#include <Mw/LowLevel/Haiku.h>
#endif
union _MwLL {
struct _MwLLCommon common;
#ifdef USE_X11
struct _MwLLX11 x11;
#endif
#ifdef USE_GDI
struct _MwLLGDI gdi;
#endif
#ifdef USE_WAYLAND
struct _MwLLWayland wayland;
struct _MwLLCairo cairo;
#endif
#ifdef USE_COCOA
struct _MwLLCocoa cocoa;
#endif
#ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOS cmacos;
#endif
#ifdef USE_HAIKU
struct _MwLLHaiku haiku;
#endif
};
union _MwLLColor {
struct _MwLLCommonColor common;
#ifdef USE_X11
struct _MwLLX11Color x11;
#endif
#ifdef USE_GDI
struct _MwLLGDIColor gdi;
#endif
#ifdef USE_WAYLAND
struct _MwLLCairoColor wayland;
#endif
#ifdef USE_COCOA
struct _MwLLCocoaColor cocoa;
#endif
#ifdef USE_HAIKU
struct _MwLLHaikuColor haiku;
#endif
};
union _MwLLPixmap {
struct _MwLLCommonPixmap common;
#ifdef USE_X11
struct _MwLLX11Pixmap x11;
#endif
#ifdef USE_GDI
struct _MwLLGDIPixmap gdi;
#endif
#ifdef USE_WAYLAND
struct _MwLLWaylandPixmap wayland;
struct _MwLLCairoPixmap cairo; /* same structure but we do this for code clarity */
#endif
#ifdef USE_COCOA
struct _MwLLCocoaPixmap cocoa;
#endif
#ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOSPixmap cmacos;
#endif
#ifdef USE_HAIKU
struct _MwLLHaikuPixmap haiku;
#endif
};
#endif
#include <Mw/TypeDefs.h>
#define MwLLDispatch(x, y, z) \
if(x->common.handler != NULL && x->common.handler->y != NULL) x->common.handler->y(x, z)
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);
void (*clipboard)(MwLL handle, void* data);
void (*dark_theme)(MwLL handle, void* data);
};
struct _MwLLTextDispatchTable {
int (*drawText)(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color);
int (*textWidth)(MwWidget handle, const char* text);
int (*textHeight)(MwWidget handle, int count);
void* (*fontLoad)(unsigned char* data, unsigned int size);
void (*fontFree)(void* handle);
};
#define MwFLFlagMonospace (1 << 0)
#define MwFLFlagBold (1 << 1)
#define MwFLFlagBitmap (1 << 2)
#define MwFLBuildFont(x) ((MwFLFont)(void*)(size_t)(x))
#ifdef __cplusplus
extern "C" {
#endif
/* lowlevel.c, common part */
MWDECL void MwLLCreateCommon(MwLL handle);
MWDECL void MwLLDestroyCommon(MwLL handle);
/* driver-specific, these get assigned by backend */
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);
/*!
* @brief Begin drawing sequence
* @param handle Handle
*/
MWDECL void (*MwLLBeginDraw)(MwLL handle);
/*!
* @brief End drawing sequence
* @param handle Handle
*/
MWDECL void (*MwLLEndDraw)(MwLL handle);
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 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);
/*!
* @brief Detach handle and make it toplevel window
* @param handle Handle
* @param point Point to be detached at, relative from the parent handle
*/
MWDECL void (*MwLLDetach)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLShow)(MwLL handle, int show);
MWDECL void (*MwLLSetSizeHints)(MwLL handle, int minx, int miny, int maxx, int maxy);
MWDECL void (*MwLLMakeBorderless)(MwLL handle, int toggle);
/*!
* @brief Make handle "tool" window, e.g. Submenu, combobox menu, and etc.
* @param handle Handle
*/
MWDECL void (*MwLLMakeToolWindow)(MwLL handle);
MWDECL void (*MwLLMakePopup)(MwLL handle, MwLL parent);
/*!
* @brief Begin changing state (has to be called before `MwLLSetSizeHints`, `MwLLMakeBorderless`, `MwLLMakeToolWindow`, and `MwLLMakePopup`)
* @param handle Handle
*/
MWDECL void (*MwLLBeginStateChange)(MwLL handle);
/*!
* @brief End changing state
* @param handle Handle
*/
MWDECL void (*MwLLEndStateChange)(MwLL handle);
MWDECL void (*MwLLFocus)(MwLL handle);
/*!
* @brief Grab pointer, and keep moving pointer to center of handle
* @param handle Handle
* @param toggle Toggle
*/
MWDECL void (*MwLLGrabPointer)(MwLL handle, int toggle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text, int clipboard_type);
MWDECL void (*MwLLGetClipboard)(MwLL handle, int clipboard_type);
MWDECL void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);
/*!
* @brief Set any extra parameters for dark theme
* @param handle Handle
* @param toggle Toggle
* @warning Do not run `handle->common.handler->dark_theme` when this function gets called
* @warning This is for stuff like, i.e. setting the accent color on modern Windows. The user themselves sets dark theme with MwNdarkTheme.
*/
MWDECL void (*MwLLSetDarkTheme)(MwLL handle, int toggle);
/*!
* @brief Whether or not the platform should default to modern theme.
* @param handle Handle
* @return whether to default.
*/
MWDECL MwBool (*MwLLDoModern)(MwLL handle);
MWDECL void (*MwLLRaise)(MwLL handle);
MWDECL void (*MwLLClip)(MwLL handle, MwRect* rect);
/* font renderer */
MWDECL void MwFLSetup(void);
#ifdef USE_FREETYPE2
MWDECL int MWFL_FT2Setup(void);
#endif
#ifdef USE_STB_TRUETYPE
MWDECL int MwFL_STBTTSetup(void);
#endif
MWDECL int (*MwFLDrawText)(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color);
MWDECL int (*MwFLTextWidth)(MwFLFont ttf, const char* text);
MWDECL int (*MwFLTextHeight)(MwFLFont ttf, int count);
MWDECL void* (*MwFLFontLoad)(unsigned char* data, unsigned int size, int px);
MWDECL void (*MwFLFontFree)(void* handle);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/LowLevel.h
* @brief Low-level drawing API
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_H__
#define __MW_LOWLEVEL_H__
#include <Mw/BaseTypes.h>
#include <Mw/MachDep.h>
typedef struct _MwLLHandler* MwLLHandler;
typedef struct _MwLLCommon* MwLLCommon;
typedef struct _MwLLCommonColor* MwLLCommonColor;
typedef struct _MwLLCommonPixmap* MwLLCommonPixmap;
#ifdef _MILSKO
typedef union _MwLL* MwLL;
typedef union _MwLLColor* MwLLColor;
typedef union _MwLLPixmap* MwLLPixmap;
typedef struct _MwFLFont* MwFLFont;
#else
typedef void* MwLL;
typedef void* MwLLColor;
typedef void* MwLLPixmap;
typedef void* MwFLFont;
#endif
enum MwLLBackends {
MwLLBackendX11 = 0,
MwLLBackendGDI,
MwLLBackendWayland,
MwLLBackendCocoa,
MwLLBackendHaiku
};
struct _MwLLCommon {
void* user;
int copy_buffer;
int type;
int coordinate_type;
MwBool supports_transparency;
MwLLHandler handler;
};
struct _MwLLCommonColor {
MwU8 red;
MwU8 green;
MwU8 blue;
};
struct _MwLLCommonPixmap {
int width;
int height;
unsigned char* raw;
void* user;
};
#ifdef USE_DBUS
typedef struct _MwLLDBusFuncTable {
void* lib;
void (*dbus_error_init)(DBusError* error);
DBusConnection* (*dbus_bus_get)(DBusBusType type, DBusError* error);
dbus_bool_t (*dbus_error_is_set)(const DBusError* error);
void (*dbus_error_free)(DBusError* error);
DBusMessage* (*dbus_message_new_method_call)(const char* bus_name, const char* path, const char* iface, const char* method);
void (*dbus_message_iter_init_append)(DBusMessage* message, DBusMessageIter* iter);
dbus_bool_t (*dbus_message_iter_append_basic)(DBusMessageIter* iter, int type, const void* value);
void (*dbus_connection_flush)(DBusConnection* connection);
dbus_bool_t (*dbus_connection_read_write)(DBusConnection* connection, int timeout_milliseconds);
DBusMessage* (*dbus_connection_send_with_reply_and_block)(DBusConnection* connection, DBusMessage* message, int timeout_milliseconds, DBusError* error);
DBusMessage* (*dbus_connection_pop_message)(DBusConnection* connection);
void (*dbus_bus_add_match)(DBusConnection* connection, const char* rule, DBusError* error);
void (*dbus_message_unref)(DBusMessage* message);
dbus_bool_t (*dbus_message_iter_init)(DBusMessage* message, DBusMessageIter* iter);
dbus_bool_t (*dbus_message_is_signal)(DBusMessage* message, const char* iface, const char* signal_name);
int (*dbus_message_iter_get_arg_type)(DBusMessageIter* iter);
void (*dbus_message_iter_recurse)(DBusMessageIter* iter, DBusMessageIter* sub);
void (*dbus_message_iter_next)(DBusMessageIter* iter);
void (*dbus_connection_unref)(DBusConnection* connection);
void (*dbus_message_iter_get_basic)(DBusMessageIter* iter, void* value);
} MwLLDBusFuncTable;
typedef struct _MwLLDBusContext {
DBusConnection* dbus_conn;
DBusError dbus_err;
DBusMessage* dbus_msg;
DBusMessage* dbus_reply;
} MwLLDBusContext;
typedef void (*MwLLDBusPortalPollListener)(MwLL handle, MwU32 new_value);
/* setup the dbus func table. Returns false and prints a warning if dbus couldn't be found. */
MWDECL MwBool MwLLDBusFuncSetup(MwLLDBusFuncTable* tbl);
MWDECL MwBool MwLLDBusNewContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
MWDECL MwBool MwLLDBusPortalGet(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, const char* portal, const char* namespace, const char* key, void* out);
MWDECL MwBool MwLLDBusPortalWatch(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, const char* portal);
MWDECL MwBool MwLLDBusPortalPoll(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, MwLL handle, const char* portal, const char* namespace, const char* key, MwLLDBusPortalPollListener);
MWDECL void MwLLDBusFreeContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
#endif
#ifdef _MILSKO
#ifdef USE_X11
#include <Mw/LowLevel/X11.h>
#endif
#ifdef USE_GDI
#include <Mw/LowLevel/GDI.h>
#endif
#ifdef USE_WAYLAND
#include <Mw/LowLevel/Wayland.h>
#endif
#ifdef USE_COCOA
#include <Mw/LowLevel/Cocoa.h>
#endif
#ifdef CLASSIC_MAC_OS
#include <Mw/LowLevel/ClassicMacOS.h>
#endif
#ifdef USE_HAIKU
#include <Mw/LowLevel/Haiku.h>
#endif
union _MwLL {
struct _MwLLCommon common;
#ifdef USE_X11
struct _MwLLX11 x11;
#endif
#ifdef USE_GDI
struct _MwLLGDI gdi;
#endif
#ifdef USE_WAYLAND
struct _MwLLWayland wayland;
struct _MwLLCairo cairo;
#endif
#ifdef USE_COCOA
struct _MwLLCocoa cocoa;
#endif
#ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOS cmacos;
#endif
#ifdef USE_HAIKU
struct _MwLLHaiku haiku;
#endif
};
union _MwLLColor {
struct _MwLLCommonColor common;
#ifdef USE_X11
struct _MwLLX11Color x11;
#endif
#ifdef USE_GDI
struct _MwLLGDIColor gdi;
#endif
#ifdef USE_WAYLAND
struct _MwLLCairoColor wayland;
#endif
#ifdef USE_COCOA
struct _MwLLCocoaColor cocoa;
#endif
#ifdef USE_HAIKU
struct _MwLLHaikuColor haiku;
#endif
};
union _MwLLPixmap {
struct _MwLLCommonPixmap common;
#ifdef USE_X11
struct _MwLLX11Pixmap x11;
#endif
#ifdef USE_GDI
struct _MwLLGDIPixmap gdi;
#endif
#ifdef USE_WAYLAND
struct _MwLLWaylandPixmap wayland;
struct _MwLLCairoPixmap cairo; /* same structure but we do this for code clarity */
#endif
#ifdef USE_COCOA
struct _MwLLCocoaPixmap cocoa;
#endif
#ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOSPixmap cmacos;
#endif
#ifdef USE_HAIKU
struct _MwLLHaikuPixmap haiku;
#endif
};
#endif
#include <Mw/TypeDefs.h>
#define MwLLDispatch(x, y, z) \
if(x->common.handler != NULL && x->common.handler->y != NULL) x->common.handler->y(x, z)
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);
void (*clipboard)(MwLL handle, void* data);
void (*dark_theme)(MwLL handle, void* data);
};
struct _MwLLTextDispatchTable {
int (*drawText)(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color);
int (*textWidth)(MwWidget handle, const char* text);
int (*textHeight)(MwWidget handle, int count);
void* (*fontLoad)(unsigned char* data, unsigned int size);
void (*fontFree)(void* handle);
};
#define MwFLFlagMonospace (1 << 0)
#define MwFLFlagBold (1 << 1)
#define MwFLFlagBitmap (1 << 2)
#define MwFLBuildFont(x) ((MwFLFont)(void*)(size_t)(x))
#ifdef __cplusplus
extern "C" {
#endif
/* lowlevel.c, common part */
MWDECL void MwLLCreateCommon(MwLL handle);
MWDECL void MwLLDestroyCommon(MwLL handle);
/* driver-specific, these get assigned by backend */
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);
/*!
* @brief Begin drawing sequence
* @param handle Handle
*/
MWDECL void (*MwLLBeginDraw)(MwLL handle);
/*!
* @brief End drawing sequence
* @param handle Handle
*/
MWDECL void (*MwLLEndDraw)(MwLL handle);
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 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);
/*!
* @brief Detach handle and make it toplevel window
* @param handle Handle
* @param point Point to be detached at, relative from the parent handle
*/
MWDECL void (*MwLLDetach)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLShow)(MwLL handle, int show);
MWDECL void (*MwLLSetSizeHints)(MwLL handle, int minx, int miny, int maxx, int maxy);
MWDECL void (*MwLLMakeBorderless)(MwLL handle, int toggle);
/*!
* @brief Make handle "tool" window, e.g. Submenu, combobox menu, and etc.
* @param handle Handle
*/
MWDECL void (*MwLLMakeToolWindow)(MwLL handle);
MWDECL void (*MwLLMakePopup)(MwLL handle, MwLL parent);
/*!
* @brief Begin changing state (has to be called before `MwLLSetSizeHints`, `MwLLMakeBorderless`, `MwLLMakeToolWindow`, and `MwLLMakePopup`)
* @param handle Handle
*/
MWDECL void (*MwLLBeginStateChange)(MwLL handle);
/*!
* @brief End changing state
* @param handle Handle
*/
MWDECL void (*MwLLEndStateChange)(MwLL handle);
MWDECL void (*MwLLFocus)(MwLL handle);
/*!
* @brief Grab pointer, and keep moving pointer to center of handle
* @param handle Handle
* @param toggle Toggle
*/
MWDECL void (*MwLLGrabPointer)(MwLL handle, int toggle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text, int clipboard_type);
MWDECL void (*MwLLGetClipboard)(MwLL handle, int clipboard_type);
MWDECL void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);
/*!
* @brief Set any extra parameters for dark theme
* @param handle Handle
* @param toggle Toggle
* @warning Do not run `handle->common.handler->dark_theme` when this function gets called
* @warning This is for stuff like, i.e. setting the accent color on modern Windows. The user themselves sets dark theme with MwNdarkTheme.
*/
MWDECL void (*MwLLSetDarkTheme)(MwLL handle, int toggle);
/*!
* @brief Whether or not the platform should default to modern theme.
* @param handle Handle
* @return whether to default.
*/
MWDECL MwBool (*MwLLDoModern)(MwLL handle);
MWDECL void (*MwLLRaise)(MwLL handle);
MWDECL void (*MwLLClip)(MwLL handle, MwRect* rect);
/* font renderer */
MWDECL void MwFLSetup(void);
#ifdef USE_FREETYPE2
MWDECL int MWFL_FT2Setup(void);
#endif
#ifdef USE_STB_TRUETYPE
MWDECL int MwFL_STBTTSetup(void);
#endif
MWDECL int (*MwFLDrawText)(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color);
MWDECL int (*MwFLTextWidth)(MwFLFont ttf, const char* text);
MWDECL int (*MwFLTextHeight)(MwFLFont ttf, int count);
MWDECL void* (*MwFLFontLoad)(unsigned char* data, unsigned int size, int px);
MWDECL void (*MwFLFontFree)(void* handle);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,229 +1,229 @@
/*!
* @file Mw/LowLevel/Cairo.h
* @brief Cairo Backend
* @warning This is used MEGA internally.
*/
#ifndef __MW_LOWLEVEL_CAIRO_H__
#define __MW_LOWLEVEL_CAIRO_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#include <Mw/Abstract/Dynamic.h>
#include <cairo/cairo.h>
#ifdef __cplusplus
extern "C" {
#endif
MWDECL int MwLLCairoCallInit(void);
#ifdef __cplusplus
}
#endif
#define CSD_BORDER_FRAME_LEFT 5
#define CSD_BORDER_FRAME_RIGHT 5
#define CSD_BORDER_FRAME_TOP 23
#define CSD_BORDER_FRAME_BOTTOM 4
typedef struct cairo_call_table {
void* cairo_lib;
void (*cairo_set_line_width)(cairo_t* cr,
double width);
void (*cairo_scale)(cairo_t* cr,
double sx,
double sy);
cairo_t* (*cairo_create)(cairo_surface_t* target);
void (*cairo_move_to)(cairo_t* cr,
double x,
double y);
void (*cairo_rectangle)(cairo_t* cr,
double x,
double y,
double width,
double height);
void (*cairo_new_path)(cairo_t* cr);
void (*cairo_set_line_cap)(cairo_t* cr,
cairo_line_cap_t line_cap);
void (*cairo_set_source_rgba)(cairo_t* cr,
double red,
double green,
double blue,
double alpha);
void (*cairo_set_source_rgb)(cairo_t* cr,
double red,
double green,
double blue);
void (*cairo_reset_clip)(cairo_t* cr);
unsigned char* (*cairo_image_surface_get_data)(cairo_surface_t* surface);
void (*cairo_line_to)(cairo_t* cr,
double x,
double y);
cairo_status_t (*cairo_surface_write_to_png)(cairo_surface_t* surface, const char* filename);
void (*cairo_surface_destroy)(cairo_surface_t* surface);
cairo_surface_t* (*cairo_image_surface_create_for_data)(unsigned char* data,
cairo_format_t format,
int width,
int height,
int stride);
cairo_surface_t* (*cairo_image_surface_create)(cairo_format_t format,
int width,
int height);
void (*cairo_destroy)(cairo_t* cr);
cairo_pattern_t* (*cairo_get_source)(cairo_t* cr);
void (*cairo_close_path)(cairo_t* cr);
void (*cairo_paint)(cairo_t* cr);
void (*cairo_surface_flush)(cairo_surface_t* surface);
void (*cairo_clip)(cairo_t* cr);
void (*cairo_save)(cairo_t* cr);
void (*cairo_restore)(cairo_t* cr);
void (*cairo_surface_mark_dirty)(cairo_surface_t* surface);
void (*cairo_stroke)(cairo_t* cr);
void (*cairo_set_source_surface)(cairo_t* cr,
cairo_surface_t* surface,
double x,
double y);
void (*cairo_fill)(cairo_t* cr);
void (*cairo_pattern_set_filter)(cairo_pattern_t* pattern,
cairo_filter_t filter);
void (*cairo_set_antialias)(cairo_t*, cairo_antialias_t);
void (*cairo_set_operator)(cairo_t* cr, cairo_operator_t op);
} cairo_call_table_t;
extern cairo_call_table_t cairo_call_tbl;
/* defined inline right here so that it doesn't conflict with the other macros */
MwInline int cairo_load_funcs() {
#ifdef __APPLE__
cairo_call_tbl.cairo_lib = MwDynamicOpen("libcairo.dylib");
#else
cairo_call_tbl.cairo_lib = MwDynamicOpen("libcairo.so");
#endif
if(!cairo_call_tbl.cairo_lib) {
printf("(libcairo not found, cannot use Wayland or Cairo backend.)\n");
return 1;
}
#define CAIRO_FUNC(x) \
cairo_call_tbl.x = MwDynamicSymbol(cairo_call_tbl.cairo_lib, #x); \
if(!cairo_call_tbl.x) { \
printf("WARNING: Could use Wayland/Cairo backend if " #x " was not found. Do you have libcairo?\n"); \
return 1; \
};
CAIRO_FUNC(cairo_set_line_width);
CAIRO_FUNC(cairo_scale);
CAIRO_FUNC(cairo_create);
CAIRO_FUNC(cairo_move_to);
CAIRO_FUNC(cairo_rectangle);
CAIRO_FUNC(cairo_new_path);
CAIRO_FUNC(cairo_set_line_cap);
CAIRO_FUNC(cairo_set_antialias);
CAIRO_FUNC(cairo_set_source_rgba);
CAIRO_FUNC(cairo_set_source_rgb);
CAIRO_FUNC(cairo_reset_clip);
CAIRO_FUNC(cairo_image_surface_get_data);
CAIRO_FUNC(cairo_line_to);
CAIRO_FUNC(cairo_surface_write_to_png);
CAIRO_FUNC(cairo_surface_destroy);
CAIRO_FUNC(cairo_image_surface_create_for_data);
CAIRO_FUNC(cairo_image_surface_create);
CAIRO_FUNC(cairo_destroy);
CAIRO_FUNC(cairo_get_source);
CAIRO_FUNC(cairo_close_path);
CAIRO_FUNC(cairo_paint);
CAIRO_FUNC(cairo_surface_flush);
CAIRO_FUNC(cairo_clip);
CAIRO_FUNC(cairo_save);
CAIRO_FUNC(cairo_restore);
CAIRO_FUNC(cairo_surface_mark_dirty);
CAIRO_FUNC(cairo_stroke);
CAIRO_FUNC(cairo_set_source_surface);
CAIRO_FUNC(cairo_fill);
CAIRO_FUNC(cairo_set_operator);
CAIRO_FUNC(cairo_pattern_set_filter);
#undef CAIRO_FUNC
return 0;
}
#define cairo_set_line_width cairo_call_tbl.cairo_set_line_width
#define cairo_scale cairo_call_tbl.cairo_scale
#define cairo_create cairo_call_tbl.cairo_create
#define cairo_move_to cairo_call_tbl.cairo_move_to
#define cairo_rectangle cairo_call_tbl.cairo_rectangle
#define cairo_new_path cairo_call_tbl.cairo_new_path
#define cairo_set_line_cap cairo_call_tbl.cairo_set_line_cap
#define cairo_set_antialias cairo_call_tbl.cairo_set_antialias
#define cairo_set_source_rgba cairo_call_tbl.cairo_set_source_rgba
#define cairo_set_source_rgb cairo_call_tbl.cairo_set_source_rgb
#define cairo_reset_clip cairo_call_tbl.cairo_reset_clip
#define cairo_image_surface_get_data cairo_call_tbl.cairo_image_surface_get_data
#define cairo_line_to cairo_call_tbl.cairo_line_to
#define cairo_surface_write_to_png cairo_call_tbl.cairo_surface_write_to_png
#define cairo_surface_destroy cairo_call_tbl.cairo_surface_destroy
#define cairo_image_surface_create_for_data cairo_call_tbl.cairo_image_surface_create_for_data
#define cairo_image_surface_create cairo_call_tbl.cairo_image_surface_create
#define cairo_destroy cairo_call_tbl.cairo_destroy
#define cairo_get_source cairo_call_tbl.cairo_get_source
#define cairo_close_path cairo_call_tbl.cairo_close_path
#define cairo_paint cairo_call_tbl.cairo_paint
#define cairo_surface_flush cairo_call_tbl.cairo_surface_flush
#define cairo_clip cairo_call_tbl.cairo_clip
#define cairo_save cairo_call_tbl.cairo_save
#define cairo_restore cairo_call_tbl.cairo_restore
#define cairo_surface_mark_dirty cairo_call_tbl.cairo_surface_mark_dirty
#define cairo_stroke cairo_call_tbl.cairo_stroke
#define cairo_set_source_surface cairo_call_tbl.cairo_set_source_surface
#define cairo_fill cairo_call_tbl.cairo_fill
#define cairo_set_operator cairo_call_tbl.cairo_set_operator
#define cairo_pattern_set_filter cairo_call_tbl.cairo_pattern_set_filter
struct _MwLLCairo {
struct _MwLLCommon common;
cairo_surface_t* front_cs;
cairo_surface_t* back_cs;
cairo_t* front_cairo;
cairo_t* back_cairo;
/* The cairo to actually use for draw operations. Typically is front_cairo, but wayland's MwLLBeginDraw can change this to the back_cairo so it can be used to draw window decorations. */
cairo_t* selected_cairo;
int x;
int y;
int width;
int height;
MwBool toplevel;
MwLL parent;
};
struct _MwLLCairoColor {
struct _MwLLCommonColor common;
};
struct _MwLLCairoPixmap {
struct _MwLLCommonPixmap common;
cairo_surface_t* cs;
};
void MwLLCairoFrontSetup(struct _MwLLCairo* cairo, MwU8* data, MwU32 width, MwU32 height);
void MwLLCairoBackSetup(struct _MwLLCairo* cairo, MwU8* data, MwU32 width, MwU32 height);
void MwLLCairoFrontDestroy(struct _MwLLCairo* cairo);
void MwLLCairoBackDestroy(struct _MwLLCairo* cairo);
void MwLLCairoPolygon(struct _MwLLCairo handle, MwPoint* points, int points_count, MwLLColor color);
void MwLLCairoLine(struct _MwLLCairo handle, MwPoint* points, MwLLColor color);
MwLLPixmap MwLLCairoCreatePixmap(struct _MwLLCairo handle, unsigned char* data, int width, int height);
void MwLLCairoPixmapUpdate(MwLLPixmap handle);
void MwLLCairoDestroyPixmap(MwLLPixmap pixmap);
void MwLLCairoDrawPixmap(struct _MwLLCairo handle, MwRect* rect, MwLLPixmap pixmap);
void MwLLCairoDestroy(struct _MwLLCairo handle);
#endif
/*!
* @file Mw/LowLevel/Cairo.h
* @brief Cairo Backend
* @warning This is used MEGA internally.
*/
#ifndef __MW_LOWLEVEL_CAIRO_H__
#define __MW_LOWLEVEL_CAIRO_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#include <Mw/Abstract/Dynamic.h>
#include <cairo/cairo.h>
#ifdef __cplusplus
extern "C" {
#endif
MWDECL int MwLLCairoCallInit(void);
#ifdef __cplusplus
}
#endif
#define CSD_BORDER_FRAME_LEFT 5
#define CSD_BORDER_FRAME_RIGHT 5
#define CSD_BORDER_FRAME_TOP 23
#define CSD_BORDER_FRAME_BOTTOM 4
typedef struct cairo_call_table {
void* cairo_lib;
void (*cairo_set_line_width)(cairo_t* cr,
double width);
void (*cairo_scale)(cairo_t* cr,
double sx,
double sy);
cairo_t* (*cairo_create)(cairo_surface_t* target);
void (*cairo_move_to)(cairo_t* cr,
double x,
double y);
void (*cairo_rectangle)(cairo_t* cr,
double x,
double y,
double width,
double height);
void (*cairo_new_path)(cairo_t* cr);
void (*cairo_set_line_cap)(cairo_t* cr,
cairo_line_cap_t line_cap);
void (*cairo_set_source_rgba)(cairo_t* cr,
double red,
double green,
double blue,
double alpha);
void (*cairo_set_source_rgb)(cairo_t* cr,
double red,
double green,
double blue);
void (*cairo_reset_clip)(cairo_t* cr);
unsigned char* (*cairo_image_surface_get_data)(cairo_surface_t* surface);
void (*cairo_line_to)(cairo_t* cr,
double x,
double y);
cairo_status_t (*cairo_surface_write_to_png)(cairo_surface_t* surface, const char* filename);
void (*cairo_surface_destroy)(cairo_surface_t* surface);
cairo_surface_t* (*cairo_image_surface_create_for_data)(unsigned char* data,
cairo_format_t format,
int width,
int height,
int stride);
cairo_surface_t* (*cairo_image_surface_create)(cairo_format_t format,
int width,
int height);
void (*cairo_destroy)(cairo_t* cr);
cairo_pattern_t* (*cairo_get_source)(cairo_t* cr);
void (*cairo_close_path)(cairo_t* cr);
void (*cairo_paint)(cairo_t* cr);
void (*cairo_surface_flush)(cairo_surface_t* surface);
void (*cairo_clip)(cairo_t* cr);
void (*cairo_save)(cairo_t* cr);
void (*cairo_restore)(cairo_t* cr);
void (*cairo_surface_mark_dirty)(cairo_surface_t* surface);
void (*cairo_stroke)(cairo_t* cr);
void (*cairo_set_source_surface)(cairo_t* cr,
cairo_surface_t* surface,
double x,
double y);
void (*cairo_fill)(cairo_t* cr);
void (*cairo_pattern_set_filter)(cairo_pattern_t* pattern,
cairo_filter_t filter);
void (*cairo_set_antialias)(cairo_t*, cairo_antialias_t);
void (*cairo_set_operator)(cairo_t* cr, cairo_operator_t op);
} cairo_call_table_t;
extern cairo_call_table_t cairo_call_tbl;
/* defined inline right here so that it doesn't conflict with the other macros */
MwInline int cairo_load_funcs() {
#ifdef __APPLE__
cairo_call_tbl.cairo_lib = MwDynamicOpen("libcairo.dylib");
#else
cairo_call_tbl.cairo_lib = MwDynamicOpen("libcairo.so");
#endif
if(!cairo_call_tbl.cairo_lib) {
printf("(libcairo not found, cannot use Wayland or Cairo backend.)\n");
return 1;
}
#define CAIRO_FUNC(x) \
cairo_call_tbl.x = MwDynamicSymbol(cairo_call_tbl.cairo_lib, #x); \
if(!cairo_call_tbl.x) { \
printf("WARNING: Could use Wayland/Cairo backend if " #x " was not found. Do you have libcairo?\n"); \
return 1; \
};
CAIRO_FUNC(cairo_set_line_width);
CAIRO_FUNC(cairo_scale);
CAIRO_FUNC(cairo_create);
CAIRO_FUNC(cairo_move_to);
CAIRO_FUNC(cairo_rectangle);
CAIRO_FUNC(cairo_new_path);
CAIRO_FUNC(cairo_set_line_cap);
CAIRO_FUNC(cairo_set_antialias);
CAIRO_FUNC(cairo_set_source_rgba);
CAIRO_FUNC(cairo_set_source_rgb);
CAIRO_FUNC(cairo_reset_clip);
CAIRO_FUNC(cairo_image_surface_get_data);
CAIRO_FUNC(cairo_line_to);
CAIRO_FUNC(cairo_surface_write_to_png);
CAIRO_FUNC(cairo_surface_destroy);
CAIRO_FUNC(cairo_image_surface_create_for_data);
CAIRO_FUNC(cairo_image_surface_create);
CAIRO_FUNC(cairo_destroy);
CAIRO_FUNC(cairo_get_source);
CAIRO_FUNC(cairo_close_path);
CAIRO_FUNC(cairo_paint);
CAIRO_FUNC(cairo_surface_flush);
CAIRO_FUNC(cairo_clip);
CAIRO_FUNC(cairo_save);
CAIRO_FUNC(cairo_restore);
CAIRO_FUNC(cairo_surface_mark_dirty);
CAIRO_FUNC(cairo_stroke);
CAIRO_FUNC(cairo_set_source_surface);
CAIRO_FUNC(cairo_fill);
CAIRO_FUNC(cairo_set_operator);
CAIRO_FUNC(cairo_pattern_set_filter);
#undef CAIRO_FUNC
return 0;
}
#define cairo_set_line_width cairo_call_tbl.cairo_set_line_width
#define cairo_scale cairo_call_tbl.cairo_scale
#define cairo_create cairo_call_tbl.cairo_create
#define cairo_move_to cairo_call_tbl.cairo_move_to
#define cairo_rectangle cairo_call_tbl.cairo_rectangle
#define cairo_new_path cairo_call_tbl.cairo_new_path
#define cairo_set_line_cap cairo_call_tbl.cairo_set_line_cap
#define cairo_set_antialias cairo_call_tbl.cairo_set_antialias
#define cairo_set_source_rgba cairo_call_tbl.cairo_set_source_rgba
#define cairo_set_source_rgb cairo_call_tbl.cairo_set_source_rgb
#define cairo_reset_clip cairo_call_tbl.cairo_reset_clip
#define cairo_image_surface_get_data cairo_call_tbl.cairo_image_surface_get_data
#define cairo_line_to cairo_call_tbl.cairo_line_to
#define cairo_surface_write_to_png cairo_call_tbl.cairo_surface_write_to_png
#define cairo_surface_destroy cairo_call_tbl.cairo_surface_destroy
#define cairo_image_surface_create_for_data cairo_call_tbl.cairo_image_surface_create_for_data
#define cairo_image_surface_create cairo_call_tbl.cairo_image_surface_create
#define cairo_destroy cairo_call_tbl.cairo_destroy
#define cairo_get_source cairo_call_tbl.cairo_get_source
#define cairo_close_path cairo_call_tbl.cairo_close_path
#define cairo_paint cairo_call_tbl.cairo_paint
#define cairo_surface_flush cairo_call_tbl.cairo_surface_flush
#define cairo_clip cairo_call_tbl.cairo_clip
#define cairo_save cairo_call_tbl.cairo_save
#define cairo_restore cairo_call_tbl.cairo_restore
#define cairo_surface_mark_dirty cairo_call_tbl.cairo_surface_mark_dirty
#define cairo_stroke cairo_call_tbl.cairo_stroke
#define cairo_set_source_surface cairo_call_tbl.cairo_set_source_surface
#define cairo_fill cairo_call_tbl.cairo_fill
#define cairo_set_operator cairo_call_tbl.cairo_set_operator
#define cairo_pattern_set_filter cairo_call_tbl.cairo_pattern_set_filter
struct _MwLLCairo {
struct _MwLLCommon common;
cairo_surface_t* front_cs;
cairo_surface_t* back_cs;
cairo_t* front_cairo;
cairo_t* back_cairo;
/* The cairo to actually use for draw operations. Typically is front_cairo, but wayland's MwLLBeginDraw can change this to the back_cairo so it can be used to draw window decorations. */
cairo_t* selected_cairo;
int x;
int y;
int width;
int height;
MwBool toplevel;
MwLL parent;
};
struct _MwLLCairoColor {
struct _MwLLCommonColor common;
};
struct _MwLLCairoPixmap {
struct _MwLLCommonPixmap common;
cairo_surface_t* cs;
};
void MwLLCairoFrontSetup(struct _MwLLCairo* cairo, MwU8* data, MwU32 width, MwU32 height);
void MwLLCairoBackSetup(struct _MwLLCairo* cairo, MwU8* data, MwU32 width, MwU32 height);
void MwLLCairoFrontDestroy(struct _MwLLCairo* cairo);
void MwLLCairoBackDestroy(struct _MwLLCairo* cairo);
void MwLLCairoPolygon(struct _MwLLCairo handle, MwPoint* points, int points_count, MwLLColor color);
void MwLLCairoLine(struct _MwLLCairo handle, MwPoint* points, MwLLColor color);
MwLLPixmap MwLLCairoCreatePixmap(struct _MwLLCairo handle, unsigned char* data, int width, int height);
void MwLLCairoPixmapUpdate(MwLLPixmap handle);
void MwLLCairoDestroyPixmap(MwLLPixmap pixmap);
void MwLLCairoDrawPixmap(struct _MwLLCairo handle, MwRect* rect, MwLLPixmap pixmap);
void MwLLCairoDestroy(struct _MwLLCairo handle);
#endif

View file

@ -1,43 +1,43 @@
/*!
* @file Mw/LowLevel/ClassicMacOS.h
* @brief ClassicMacOS Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_ClassicMacOS_H__
#define __MW_LOWLEVEL_ClassicMacOS_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLClassicMacOS {
struct _MwLLCommon common;
MwLL parent;
WindowRef window;
ControlHandle control;
EventRecord event;
Rect winRect;
};
struct _MwLLClassicMacOSColor {
struct _MwLLCommonColor common;
};
struct _MwLLClassicMacOSPixmap {
struct _MwLLCommonPixmap common;
BitMap bmp;
};
MWDECL int MwLLClassicMacOSCallInit(void);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/LowLevel/ClassicMacOS.h
* @brief ClassicMacOS Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_ClassicMacOS_H__
#define __MW_LOWLEVEL_ClassicMacOS_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLClassicMacOS {
struct _MwLLCommon common;
MwLL parent;
WindowRef window;
ControlHandle control;
EventRecord event;
Rect winRect;
};
struct _MwLLClassicMacOSColor {
struct _MwLLCommonColor common;
};
struct _MwLLClassicMacOSPixmap {
struct _MwLLCommonPixmap common;
BitMap bmp;
};
MWDECL int MwLLClassicMacOSCallInit(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,189 +1,189 @@
/*!
* @file Mw/LowLevel/Cocoa.h
* @brief Work in progress Cocoa Backend
* @warning This is used internally.
*/
#ifndef __MW_LOWLEVEL_COCOA_H__
#define __MW_LOWLEVEL_COCOA_H__
#include <Mw/LowLevel.h>
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
typedef struct {
enum {
COCOA_DRAW_COMMAND_POLY = 0,
COCOA_DRAW_COMMAND_LINES,
COCOA_DRAW_COMMAND_PIXMAP,
} type;
union {
struct {
MwPoint* points;
int points_count;
struct _MwLLCommonColor color;
} poly;
struct {
MwPoint* points;
struct _MwLLCommonColor color;
} lines;
struct {
MwRect rect;
MwLLPixmap pixmap;
} pixmap;
};
} draw_command;
#ifdef __OBJC__
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
#import <Foundation/NSGeometry.h>
@interface MilskoCocoaApplication : NSApplication {
MwBool doPending;
}
- (MwBool)pending;
@end
// Note: implements NSApplicationDelegate
@interface MilskoCocoaApplicationDelegate : NSObject {
MilskoCocoaApplication* appl;
}
- (MilskoCocoaApplicationDelegate*)initWithAppl:(MilskoCocoaApplication*)appl;
@end
@interface MilskoCocoaWindow : NSWindow {
}
@end
// Note: implements NSWindowDelegate
@interface MilskoCocoaWindowDelegate : NSObject {
NSWindow* w;
}
- (MilskoCocoaWindowDelegate*)initWithWin:(NSWindow*)win;
@end
/*
So we want to associate each NSWindow with its corresponding MwLL handle. The
conventional way of doing this is through "associative pointers", however
this is a feature that Apple added in 10.6 (marketted back then as "Objective
C 2" iirc). For 10.4 compatibility, we have to do a bit of an ugly hack that
might seem like horrifically undefined behavior, but I've tested this on
both 10.4 and modern Mac OS and as long as we're careful there's no
problems: we override NSView, use NSView's "frame" property to store the
pointer, and then override functions appropriately so that this frame is never
actually used. This can then be attached to an NSWindow with addSubview and
retrieved appropriately.
*/
@interface MilskoFakePointer : NSView {
void* ptr;
}
- (void)setPointer:(void*)ptr;
- (void*)pointer;
@end
@interface MilskoCocoaPixmap : NSObject {
@public
MwBool valid;
int width;
int height;
unsigned char* buf;
NSImage* image;
NSBitmapImageRep* rep;
}
+ (MilskoCocoaPixmap*)newWithWidth:(int)width height:(int)height;
- (void)updateWithData:(unsigned char*)data;
- (void)destroy;
/* using @property to create instance variables fucks up 10.4 gcc for some
* reason? */
- (NSImage*)image;
@end
@interface MilskoCocoaView : NSView {
MwBool _child;
@public
draw_command* commands;
}
- (void)destroy;
- (void)setChild;
@end
@interface MilskoCocoaSubView : MilskoCocoaView {
}
@end
@interface MilskoCocoa : NSObject {
@public
MilskoCocoaApplication* application;
MwBool _forceRender;
MwBool _eventsPending;
MwBool isClosing;
NSWindow* window;
NSRect rect;
MilskoCocoaView* view;
MwLL parent;
MilskoFakePointer* handle;
unsigned int strHash;
NSEvent* lastEvent;
MilskoCocoaPixmap* cursorPixmap;
NSCursor* cursor;
NSModalSession modalSession;
MwBool pointerLocked;
MwBool mouseMoved;
MwBool rejectFirstTest;
}
- (void)destroy;
- (void)sendClipboardEvent;
- (MwLL)getParent;
- (NSView*)getView;
- (NSWindow*)getWindow;
- (void)nudge;
- (void)pushCursor;
- (void)popCursor;
- (MilskoFakePointer*)getHandle;
@end
#define OBJC(x) x
#else
#define OBJC(x) void*
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLCocoa {
struct _MwLLCommon common;
OBJC(MilskoCocoa*)
real;
};
struct _MwLLCocoaColor {
struct _MwLLCommonColor common;
};
struct _MwLLCocoaPixmap {
struct _MwLLCommonPixmap common;
OBJC(MilskoCocoaPixmap*)
real;
};
MWDECL int MwLLCocoaCallInit(void);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/LowLevel/Cocoa.h
* @brief Work in progress Cocoa Backend
* @warning This is used internally.
*/
#ifndef __MW_LOWLEVEL_COCOA_H__
#define __MW_LOWLEVEL_COCOA_H__
#include <Mw/LowLevel.h>
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
typedef struct {
enum {
COCOA_DRAW_COMMAND_POLY = 0,
COCOA_DRAW_COMMAND_LINES,
COCOA_DRAW_COMMAND_PIXMAP,
} type;
union {
struct {
MwPoint* points;
int points_count;
struct _MwLLCommonColor color;
} poly;
struct {
MwPoint* points;
struct _MwLLCommonColor color;
} lines;
struct {
MwRect rect;
MwLLPixmap pixmap;
} pixmap;
};
} draw_command;
#ifdef __OBJC__
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
#import <Foundation/NSGeometry.h>
@interface MilskoCocoaApplication : NSApplication {
MwBool doPending;
}
- (MwBool)pending;
@end
// Note: implements NSApplicationDelegate
@interface MilskoCocoaApplicationDelegate : NSObject {
MilskoCocoaApplication* appl;
}
- (MilskoCocoaApplicationDelegate*)initWithAppl:(MilskoCocoaApplication*)appl;
@end
@interface MilskoCocoaWindow : NSWindow {
}
@end
// Note: implements NSWindowDelegate
@interface MilskoCocoaWindowDelegate : NSObject {
NSWindow* w;
}
- (MilskoCocoaWindowDelegate*)initWithWin:(NSWindow*)win;
@end
/*
So we want to associate each NSWindow with its corresponding MwLL handle. The
conventional way of doing this is through "associative pointers", however
this is a feature that Apple added in 10.6 (marketted back then as "Objective
C 2" iirc). For 10.4 compatibility, we have to do a bit of an ugly hack that
might seem like horrifically undefined behavior, but I've tested this on
both 10.4 and modern Mac OS and as long as we're careful there's no
problems: we override NSView, use NSView's "frame" property to store the
pointer, and then override functions appropriately so that this frame is never
actually used. This can then be attached to an NSWindow with addSubview and
retrieved appropriately.
*/
@interface MilskoFakePointer : NSView {
void* ptr;
}
- (void)setPointer:(void*)ptr;
- (void*)pointer;
@end
@interface MilskoCocoaPixmap : NSObject {
@public
MwBool valid;
int width;
int height;
unsigned char* buf;
NSImage* image;
NSBitmapImageRep* rep;
}
+ (MilskoCocoaPixmap*)newWithWidth:(int)width height:(int)height;
- (void)updateWithData:(unsigned char*)data;
- (void)destroy;
/* using @property to create instance variables fucks up 10.4 gcc for some
* reason? */
- (NSImage*)image;
@end
@interface MilskoCocoaView : NSView {
MwBool _child;
@public
draw_command* commands;
}
- (void)destroy;
- (void)setChild;
@end
@interface MilskoCocoaSubView : MilskoCocoaView {
}
@end
@interface MilskoCocoa : NSObject {
@public
MilskoCocoaApplication* application;
MwBool _forceRender;
MwBool _eventsPending;
MwBool isClosing;
NSWindow* window;
NSRect rect;
MilskoCocoaView* view;
MwLL parent;
MilskoFakePointer* handle;
unsigned int strHash;
NSEvent* lastEvent;
MilskoCocoaPixmap* cursorPixmap;
NSCursor* cursor;
NSModalSession modalSession;
MwBool pointerLocked;
MwBool mouseMoved;
MwBool rejectFirstTest;
}
- (void)destroy;
- (void)sendClipboardEvent;
- (MwLL)getParent;
- (NSView*)getView;
- (NSWindow*)getWindow;
- (void)nudge;
- (void)pushCursor;
- (void)popCursor;
- (MilskoFakePointer*)getHandle;
@end
#define OBJC(x) x
#else
#define OBJC(x) void*
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLCocoa {
struct _MwLLCommon common;
OBJC(MilskoCocoa*)
real;
};
struct _MwLLCocoaColor {
struct _MwLLCommonColor common;
};
struct _MwLLCocoaPixmap {
struct _MwLLCommonPixmap common;
OBJC(MilskoCocoaPixmap*)
real;
};
MWDECL int MwLLCocoaCallInit(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,56 +1,56 @@
/*!
* @file Mw/LowLevel/GDI.h
* @brief GDI Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_GDI_H__
#define __MW_LOWLEVEL_GDI_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLGDI {
struct _MwLLCommon common;
HINSTANCE hInstance;
HWND hWnd;
HDC hDC;
HCURSOR cursor;
HICON icon;
HRGN clip;
int grabbed;
int force_render;
int get_clipboard;
int get_darktheme;
};
struct _MwLLGDIColor {
struct _MwLLCommonColor common;
HBRUSH brush;
};
struct _MwLLGDIPixmap {
struct _MwLLCommonPixmap common;
RGBQUAD* quad;
HBITMAP hBitmap;
HBITMAP hMask;
HBITMAP hMask2;
};
MWDECL int MwLLGDICallInit(void);
MWDECL HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/LowLevel/GDI.h
* @brief GDI Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_GDI_H__
#define __MW_LOWLEVEL_GDI_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLGDI {
struct _MwLLCommon common;
HINSTANCE hInstance;
HWND hWnd;
HDC hDC;
HCURSOR cursor;
HICON icon;
HRGN clip;
int grabbed;
int force_render;
int get_clipboard;
int get_darktheme;
};
struct _MwLLGDIColor {
struct _MwLLCommonColor common;
HBRUSH brush;
};
struct _MwLLGDIPixmap {
struct _MwLLCommonPixmap common;
RGBQUAD* quad;
HBITMAP hBitmap;
HBITMAP hMask;
HBITMAP hMask2;
};
MWDECL int MwLLGDICallInit(void);
MWDECL HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,173 +1,173 @@
/*!
* @file Mw/LowLevel/Haiku.h
* @brief Haiku Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_HAIKU_H__
#define __MW_LOWLEVEL_HAIKU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
class MwApplication;
class MwView;
class MwWindow;
class MwApplication : public BApplication {
public:
MwApplication(MwRect rc, MwLL handle);
~MwApplication();
void MessageReceived(BMessage* message);
};
class MwView : public BView {
public:
MwLL handle;
BLocker* locker;
uint32 buttons;
BBitmap* bitmap;
MwView(MwLL handle, BRect rc, uint32 resizingMode, uint32 flags);
~MwView();
void MessageReceived(BMessage* message);
void PostMessage(BMessage* message);
void PostMessage(uint32 command);
status_t SendMessage(BMessage* message);
status_t SendMessage(uint32 command);
void Invalidate();
void AttachedToWindow();
void Draw(BRect updateRect);
void FrameResized(float width, float height);
void MouseDown(BPoint point);
void MouseUp(BPoint point);
void MouseMoved(BPoint point, uint32 transit, const BMessage* message);
void SetColor(MwLLColor color);
};
class MwWindow : public BWindow {
public:
MwWindow(BRect rc, window_type type, uint32 flags);
void MessageReceived(BMessage* message);
void FrameMoved(BPoint newLocation);
bool QuitRequested();
};
typedef BBitmap MwBBitmap;
#else
typedef void MwApplication;
typedef void MwView;
typedef void MwWindow;
typedef void MwBBitmap;
#endif
typedef union _MwLLHaikuEvent MwLLHaikuEvent;
enum BAPP_MW_WHAT {
BAPP_MW_DESTROY = 0
};
enum BVIEW_MW_WHAT {
BVIEW_MW_DESTROY = 0,
BVIEW_MW_DETACH,
BVIEW_MW_RESIZE,
BVIEW_MW_MOVE,
BVIEW_MW_SHOW,
BVIEW_MW_HIDE,
BVIEW_MW_SET_COLOR,
BVIEW_MW_POLYGON,
BVIEW_MW_LINE,
BVIEW_MW_BITMAP,
BVIEW_MW_RENDER,
BVIEW_MW_RAISE,
BVIEW_MW_GET_MOUSE
};
enum BWIN_MW_WHAT {
BWIN_MW_DESTROY = 0,
BWIN_MW_SET_TITLE,
BWIN_MW_SET_TYPE
};
enum MwLLHAIKU_EVENT {
MwLLHAIKU_EVENT_DRAW = 0,
MwLLHAIKU_EVENT_CLOSE,
MwLLHAIKU_EVENT_FRAMERESIZED,
MwLLHAIKU_EVENT_FRAMEMOVED,
MwLLHAIKU_EVENT_MOUSEDOWN,
MwLLHAIKU_EVENT_MOUSEUP,
MwLLHAIKU_EVENT_MOUSEMOVED
};
struct _MwLLHaikuEventMouse {
int type;
MwPoint point;
int button;
};
struct _MwLLHaikuEventFrameResized {
int type;
float width;
float height;
};
struct _MwLLHaikuEventFrameMoved {
int type;
MwPoint point;
};
union _MwLLHaikuEvent {
int type;
struct _MwLLHaikuEventMouse mouse;
struct _MwLLHaikuEventFrameResized frame_resized;
struct _MwLLHaikuEventFrameMoved frame_moved;
};
struct _MwLLHaiku {
struct _MwLLCommon common;
int type;
int x;
int y;
int width;
int height;
MwLL parent;
MwApplication* app;
MwWindow* window;
MwView* view;
thread_id app_thread;
int force_render;
MwLLHaikuEvent* events;
};
struct _MwLLHaikuColor {
struct _MwLLCommonColor common;
};
struct _MwLLHaikuPixmap {
struct _MwLLCommonPixmap common;
MwBBitmap* bitmap;
};
MWDECL int MwLLHaikuCallInit(void);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/LowLevel/Haiku.h
* @brief Haiku Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_HAIKU_H__
#define __MW_LOWLEVEL_HAIKU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
class MwApplication;
class MwView;
class MwWindow;
class MwApplication : public BApplication {
public:
MwApplication(MwRect rc, MwLL handle);
~MwApplication();
void MessageReceived(BMessage* message);
};
class MwView : public BView {
public:
MwLL handle;
BLocker* locker;
uint32 buttons;
BBitmap* bitmap;
MwView(MwLL handle, BRect rc, uint32 resizingMode, uint32 flags);
~MwView();
void MessageReceived(BMessage* message);
void PostMessage(BMessage* message);
void PostMessage(uint32 command);
status_t SendMessage(BMessage* message);
status_t SendMessage(uint32 command);
void Invalidate();
void AttachedToWindow();
void Draw(BRect updateRect);
void FrameResized(float width, float height);
void MouseDown(BPoint point);
void MouseUp(BPoint point);
void MouseMoved(BPoint point, uint32 transit, const BMessage* message);
void SetColor(MwLLColor color);
};
class MwWindow : public BWindow {
public:
MwWindow(BRect rc, window_type type, uint32 flags);
void MessageReceived(BMessage* message);
void FrameMoved(BPoint newLocation);
bool QuitRequested();
};
typedef BBitmap MwBBitmap;
#else
typedef void MwApplication;
typedef void MwView;
typedef void MwWindow;
typedef void MwBBitmap;
#endif
typedef union _MwLLHaikuEvent MwLLHaikuEvent;
enum BAPP_MW_WHAT {
BAPP_MW_DESTROY = 0
};
enum BVIEW_MW_WHAT {
BVIEW_MW_DESTROY = 0,
BVIEW_MW_DETACH,
BVIEW_MW_RESIZE,
BVIEW_MW_MOVE,
BVIEW_MW_SHOW,
BVIEW_MW_HIDE,
BVIEW_MW_SET_COLOR,
BVIEW_MW_POLYGON,
BVIEW_MW_LINE,
BVIEW_MW_BITMAP,
BVIEW_MW_RENDER,
BVIEW_MW_RAISE,
BVIEW_MW_GET_MOUSE
};
enum BWIN_MW_WHAT {
BWIN_MW_DESTROY = 0,
BWIN_MW_SET_TITLE,
BWIN_MW_SET_TYPE
};
enum MwLLHAIKU_EVENT {
MwLLHAIKU_EVENT_DRAW = 0,
MwLLHAIKU_EVENT_CLOSE,
MwLLHAIKU_EVENT_FRAMERESIZED,
MwLLHAIKU_EVENT_FRAMEMOVED,
MwLLHAIKU_EVENT_MOUSEDOWN,
MwLLHAIKU_EVENT_MOUSEUP,
MwLLHAIKU_EVENT_MOUSEMOVED
};
struct _MwLLHaikuEventMouse {
int type;
MwPoint point;
int button;
};
struct _MwLLHaikuEventFrameResized {
int type;
float width;
float height;
};
struct _MwLLHaikuEventFrameMoved {
int type;
MwPoint point;
};
union _MwLLHaikuEvent {
int type;
struct _MwLLHaikuEventMouse mouse;
struct _MwLLHaikuEventFrameResized frame_resized;
struct _MwLLHaikuEventFrameMoved frame_moved;
};
struct _MwLLHaiku {
struct _MwLLCommon common;
int type;
int x;
int y;
int width;
int height;
MwLL parent;
MwApplication* app;
MwWindow* window;
MwView* view;
thread_id app_thread;
int force_render;
MwLLHaikuEvent* events;
};
struct _MwLLHaikuColor {
struct _MwLLCommonColor common;
};
struct _MwLLHaikuPixmap {
struct _MwLLCommonPixmap common;
MwBBitmap* bitmap;
};
MWDECL int MwLLHaikuCallInit(void);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
*protocol.h
*protocol.h

View file

@ -1 +1 @@
Folder for wayland-scanner to place any of its files.
Folder for wayland-scanner to place any of its files.

View file

@ -1,97 +1,97 @@
/*!
* @file Mw/LowLevel/X11.h
* @brief X11 Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_X11_H__
#define __MW_LOWLEVEL_X11_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#ifdef USE_XRENDER
#include <X11/extensions/Xrender.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLX11 {
struct _MwLLCommon common;
unsigned int width;
unsigned int height;
Display* display;
Window window;
Pixmap pixmap;
GC gc;
Colormap colormap;
Atom wm_delete;
Atom wm_protocols;
Atom utf8_string;
Atom compound_text;
Atom text;
Atom clipboard;
Atom selection;
XIM xim;
XIC xic;
long clipboard_time;
int clipboard_pending; /* 1 if UTF8_STRING, 2 if COMPOUND_TEXT, 3 if TEXT, 4 if STRING, otherwise 0 */
int top;
int toplevel;
int grabbed;
int force_render;
unsigned long red_mask;
unsigned long red_max;
unsigned long red_shift;
unsigned long green_mask;
unsigned long green_max;
unsigned long green_shift;
unsigned long blue_mask;
unsigned long blue_max;
unsigned long blue_shift;
#ifdef USE_DBUS
MwLLDBusContext dbus;
#endif
MwBool dark_theme_detection;
};
struct _MwLLX11Color {
struct _MwLLCommonColor common;
unsigned long pixel;
};
struct _MwLLX11Pixmap {
struct _MwLLCommonPixmap common;
int depth;
unsigned char* data;
MwLL handle;
int use_xrender;
Display* display;
XImage* image;
XImage* mask;
};
MWDECL int MwLLX11CallInit(void);
MWDECL Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/LowLevel/X11.h
* @brief X11 Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_X11_H__
#define __MW_LOWLEVEL_X11_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#ifdef USE_XRENDER
#include <X11/extensions/Xrender.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLX11 {
struct _MwLLCommon common;
unsigned int width;
unsigned int height;
Display* display;
Window window;
Pixmap pixmap;
GC gc;
Colormap colormap;
Atom wm_delete;
Atom wm_protocols;
Atom utf8_string;
Atom compound_text;
Atom text;
Atom clipboard;
Atom selection;
XIM xim;
XIC xic;
long clipboard_time;
int clipboard_pending; /* 1 if UTF8_STRING, 2 if COMPOUND_TEXT, 3 if TEXT, 4 if STRING, otherwise 0 */
int top;
int toplevel;
int grabbed;
int force_render;
unsigned long red_mask;
unsigned long red_max;
unsigned long red_shift;
unsigned long green_mask;
unsigned long green_max;
unsigned long green_shift;
unsigned long blue_mask;
unsigned long blue_max;
unsigned long blue_shift;
#ifdef USE_DBUS
MwLLDBusContext dbus;
#endif
MwBool dark_theme_detection;
};
struct _MwLLX11Color {
struct _MwLLCommonColor common;
unsigned long pixel;
};
struct _MwLLX11Pixmap {
struct _MwLLCommonPixmap common;
int depth;
unsigned char* data;
MwLL handle;
int use_xrender;
Display* display;
XImage* image;
XImage* mask;
};
MWDECL int MwLLX11CallInit(void);
MWDECL Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,122 +1,122 @@
/*!
* @file Mw/MachDep.h
* @brief Machine dependent headers and macros
*/
#ifndef __MW_MACHDEP_H__
#define __MW_MACHDEP_H__
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <assert.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L
#include <wchar.h>
#define MW_HAS_WCHAR
#endif
#ifdef _WIN32
#include <direct.h>
#ifdef _MILSKO
#include <windows.h>
#ifndef GWLP_USERDATA
#define GWLP_USERDATA GWL_USERDATA
#define GWLP_WNDPROC GWL_WNDPROC
#define GCLP_HICON GCL_HICON
#define GCLP_HCURSOR GCL_HCURSOR
#define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong
#define SetClassLongPtr SetClassLong
#define GetClassLongPtr GetClassLong
#endif
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020a
#define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x))
#endif
#endif
#elif defined(CLASSIC_MAC_OS)
#include <unistd.h>
#include <MacTypes.h>
#include <CFBundle.h>
#include <CodeFragments.h>
#include <Timer.h>
#include <MacWindows.h>
#include <TextEdit.h>
#include <Dialogs.h>
#else
#include <unistd.h>
#include <pwd.h>
#include <signal.h>
#include <fcntl.h>
#include <limits.h>
#endif
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#include <dirent.h>
#include <dlfcn.h>
#endif
#ifdef __HAIKU__
#ifdef __cplusplus
#include <Window.h>
#include <View.h>
#include <Screen.h>
#include <Application.h>
#include <Locker.h>
#include <Picture.h>
#include <Bitmap.h>
#endif
#include <OS.h>
#endif
#ifdef __APPLE__
#include <mach/clock.h>
#include <mach/mach.h>
#endif
#ifdef USE_DBUS
#include <dbus/dbus.h>
#endif
#ifndef M_PI
#define M_PI 3.14159265
#endif
/* Windows */
#if defined(_MILSKO) && defined(_MILSKO_BUILD) && defined(_WIN32)
#define MWDECL extern __declspec(dllexport)
#elif defined(_WIN32)
#define MWDECL extern __declspec(dllimport)
/* GCC/Clang */
/* First check if we have __has_attribute and can check for the existence of visibility */
#elif defined(__has_attribute)
#if __has_attribute(visibility)
#define MWDECL extern __attribute__((visibility("default")))
#else
#define MWDECL extern
#endif
/* It might be that we're on an old version of GCC (like the one Apple ships with older versions of Mac OS).
* If we're on gcc 3 or above, assume it's there
*/
#elif __GNUC__ >= 3
#define MWDECL extern __attribute__((visibility("default")))
#else
/* all else fails */
#define MWDECL extern
#endif
#if defined(_WIN32)
#define MWAPI __cdecl
#else
#define MWAPI
#endif
#define MwInline static __inline
#endif
/*!
* @file Mw/MachDep.h
* @brief Machine dependent headers and macros
*/
#ifndef __MW_MACHDEP_H__
#define __MW_MACHDEP_H__
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <assert.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L
#include <wchar.h>
#define MW_HAS_WCHAR
#endif
#ifdef _WIN32
#include <direct.h>
#ifdef _MILSKO
#include <windows.h>
#ifndef GWLP_USERDATA
#define GWLP_USERDATA GWL_USERDATA
#define GWLP_WNDPROC GWL_WNDPROC
#define GCLP_HICON GCL_HICON
#define GCLP_HCURSOR GCL_HCURSOR
#define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong
#define SetClassLongPtr SetClassLong
#define GetClassLongPtr GetClassLong
#endif
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020a
#define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x))
#endif
#endif
#elif defined(CLASSIC_MAC_OS)
#include <unistd.h>
#include <MacTypes.h>
#include <CFBundle.h>
#include <CodeFragments.h>
#include <Timer.h>
#include <MacWindows.h>
#include <TextEdit.h>
#include <Dialogs.h>
#else
#include <unistd.h>
#include <pwd.h>
#include <signal.h>
#include <fcntl.h>
#include <limits.h>
#endif
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#include <dirent.h>
#include <dlfcn.h>
#endif
#ifdef __HAIKU__
#ifdef __cplusplus
#include <Window.h>
#include <View.h>
#include <Screen.h>
#include <Application.h>
#include <Locker.h>
#include <Picture.h>
#include <Bitmap.h>
#endif
#include <OS.h>
#endif
#ifdef __APPLE__
#include <mach/clock.h>
#include <mach/mach.h>
#endif
#ifdef USE_DBUS
#include <dbus/dbus.h>
#endif
#ifndef M_PI
#define M_PI 3.14159265
#endif
/* Windows */
#if defined(_MILSKO) && defined(_MILSKO_BUILD) && defined(_WIN32)
#define MWDECL extern __declspec(dllexport)
#elif defined(_WIN32)
#define MWDECL extern __declspec(dllimport)
/* GCC/Clang */
/* First check if we have __has_attribute and can check for the existence of visibility */
#elif defined(__has_attribute)
#if __has_attribute(visibility)
#define MWDECL extern __attribute__((visibility("default")))
#else
#define MWDECL extern
#endif
/* It might be that we're on an old version of GCC (like the one Apple ships with older versions of Mac OS).
* If we're on gcc 3 or above, assume it's there
*/
#elif __GNUC__ >= 3
#define MWDECL extern __attribute__((visibility("default")))
#else
/* all else fails */
#define MWDECL extern
#endif
#if defined(_WIN32)
#define MWAPI __cdecl
#else
#define MWAPI
#endif
#define MwInline static __inline
#endif

View file

@ -1,59 +1,59 @@
/*!
* @file Mw/Milsko.h
* @brief Includes all headers
*/
#ifndef __MW_MILSKO_H__
#define __MW_MILSKO_H__
#include <Mw/MachDep.h>
#include <Mw/LowLevel.h>
#include <Mw/StringDefs.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#include <Mw/Default.h>
#include <Mw/Font.h>
#include <Mw/Constants.h>
#include <Mw/Unicode.h>
#include <Mw/String.h>
#include <Mw/Draw.h>
#include <Mw/Version.h>
#include <Mw/Abstract/Dynamic.h>
#include <Mw/Abstract/Directory.h>
#include <Mw/Abstract/Time.h>
#include <Mw/Abstract/CharSet.h>
#include <Mw/Resource/Icon.h>
#include <Mw/Resource/Cursor.h>
#include <Mw/Resource/Font.h>
#include <Mw/Dialog/MessageBox.h>
#include <Mw/Dialog/FileChooser.h>
#include <Mw/Dialog/DirectoryChooser.h>
#include <Mw/Dialog/ColorPicker.h>
#include <Mw/Widget/Box.h>
#include <Mw/Widget/Button.h>
#include <Mw/Widget/Calendar.h>
#include <Mw/Widget/CheckBox.h>
#include <Mw/Widget/ComboBox.h>
#include <Mw/Widget/Entry.h>
#include <Mw/Widget/Frame.h>
#include <Mw/Widget/Image.h>
#include <Mw/Widget/Label.h>
#include <Mw/Widget/ListBox.h>
#include <Mw/Widget/Menu.h>
#include <Mw/Widget/NumberEntry.h>
#include <Mw/Widget/ProgressBar.h>
#include <Mw/Widget/RadioBox.h>
#include <Mw/Widget/ScrollBar.h>
#include <Mw/Widget/Separator.h>
#include <Mw/Widget/SubMenu.h>
#include <Mw/Widget/SubWindow.h>
#include <Mw/Widget/Tab.h>
#include <Mw/Widget/Table.h>
#include <Mw/Widget/TreeView.h>
#include <Mw/Widget/Viewport.h>
#include <Mw/Widget/Window.h>
#endif
/*!
* @file Mw/Milsko.h
* @brief Includes all headers
*/
#ifndef __MW_MILSKO_H__
#define __MW_MILSKO_H__
#include <Mw/MachDep.h>
#include <Mw/LowLevel.h>
#include <Mw/StringDefs.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#include <Mw/Default.h>
#include <Mw/Font.h>
#include <Mw/Constants.h>
#include <Mw/Unicode.h>
#include <Mw/String.h>
#include <Mw/Draw.h>
#include <Mw/Version.h>
#include <Mw/Abstract/Dynamic.h>
#include <Mw/Abstract/Directory.h>
#include <Mw/Abstract/Time.h>
#include <Mw/Abstract/CharSet.h>
#include <Mw/Resource/Icon.h>
#include <Mw/Resource/Cursor.h>
#include <Mw/Resource/Font.h>
#include <Mw/Dialog/MessageBox.h>
#include <Mw/Dialog/FileChooser.h>
#include <Mw/Dialog/DirectoryChooser.h>
#include <Mw/Dialog/ColorPicker.h>
#include <Mw/Widget/Box.h>
#include <Mw/Widget/Button.h>
#include <Mw/Widget/Calendar.h>
#include <Mw/Widget/CheckBox.h>
#include <Mw/Widget/ComboBox.h>
#include <Mw/Widget/Entry.h>
#include <Mw/Widget/Frame.h>
#include <Mw/Widget/Image.h>
#include <Mw/Widget/Label.h>
#include <Mw/Widget/ListBox.h>
#include <Mw/Widget/Menu.h>
#include <Mw/Widget/NumberEntry.h>
#include <Mw/Widget/ProgressBar.h>
#include <Mw/Widget/RadioBox.h>
#include <Mw/Widget/ScrollBar.h>
#include <Mw/Widget/Separator.h>
#include <Mw/Widget/SubMenu.h>
#include <Mw/Widget/SubWindow.h>
#include <Mw/Widget/Tab.h>
#include <Mw/Widget/Table.h>
#include <Mw/Widget/TreeView.h>
#include <Mw/Widget/Viewport.h>
#include <Mw/Widget/Window.h>
#endif

View file

@ -1,70 +1,70 @@
/*!
* @file Mw/Resource/Cursor.h
* @brief Cursor externs
*/
#ifndef __MW_RESOURCE_CURSOR_H__
#define __MW_RESOURCE_CURSOR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Default cursor
*/
MWDECL MwCursor MwCursorDefault;
/*!
* @brief Default cursor mask
*/
MWDECL MwCursor MwCursorDefaultMask;
/*!
* @brief Arrow cursor
*/
MWDECL MwCursor MwCursorArrow;
/*!
* @brief Arrow cursor mask
*/
MWDECL MwCursor MwCursorArrowMask;
/*!
* @brief Cross cursor
*/
MWDECL MwCursor MwCursorCross;
/*!
* @brief Cross cursor mask
*/
MWDECL MwCursor MwCursorCrossMask;
/*!
* @brief Text cursor
*/
MWDECL MwCursor MwCursorText;
/*!
* @brief Text cursor mask
*/
MWDECL MwCursor MwCursorTextMask;
/*!
* @brief Hidden cursor
*/
MWDECL MwCursor MwCursorHidden;
/*!
* @brief Hidden cursor mask
*/
MWDECL MwCursor MwCursorHiddenMask;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Resource/Cursor.h
* @brief Cursor externs
*/
#ifndef __MW_RESOURCE_CURSOR_H__
#define __MW_RESOURCE_CURSOR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Default cursor
*/
MWDECL MwCursor MwCursorDefault;
/*!
* @brief Default cursor mask
*/
MWDECL MwCursor MwCursorDefaultMask;
/*!
* @brief Arrow cursor
*/
MWDECL MwCursor MwCursorArrow;
/*!
* @brief Arrow cursor mask
*/
MWDECL MwCursor MwCursorArrowMask;
/*!
* @brief Cross cursor
*/
MWDECL MwCursor MwCursorCross;
/*!
* @brief Cross cursor mask
*/
MWDECL MwCursor MwCursorCrossMask;
/*!
* @brief Text cursor
*/
MWDECL MwCursor MwCursorText;
/*!
* @brief Text cursor mask
*/
MWDECL MwCursor MwCursorTextMask;
/*!
* @brief Hidden cursor
*/
MWDECL MwCursor MwCursorHidden;
/*!
* @brief Hidden cursor mask
*/
MWDECL MwCursor MwCursorHiddenMask;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,69 +1,69 @@
/*!
* @file Mw/Resource/Font.h
* @brief Default font resources
*/
#ifndef __MW_RESOURCE_FONT_H__
#define __MW_RESOURCE_FONT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Default font data
*/
MWDECL MwFont MwFontData[];
/*!
* @brief Default bold font data
*/
MWDECL MwFont MwBoldFontData[];
/*!
* @brief Default TTF font data
*/
MWDECL unsigned char MwTTFData[];
/*!
* @brief Default TTF font size
*/
MWDECL unsigned int MwTTFDataSize;
/*!
* @brief Default bold TTF font data
*/
MWDECL unsigned char MwBoldTTFData[];
/*!
* @brief Default bold TTF font size
*/
MWDECL unsigned int MwBoldTTFDataSize;
/*!
* @brief Default monospace TTF font data
*/
MWDECL unsigned char MwMonospaceTTFData[];
/*!
* @brief Default monospace TTF font size
*/
MWDECL unsigned int MwMonospaceTTFDataSize;
/*!
* @brief Default bold monospace TTF font data
*/
MWDECL unsigned char MwBoldMonospaceTTFData[];
/*!
* @brief Default bold monospace TTF font size
*/
MWDECL unsigned int MwBoldMonospaceTTFDataSize;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Resource/Font.h
* @brief Default font resources
*/
#ifndef __MW_RESOURCE_FONT_H__
#define __MW_RESOURCE_FONT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Default font data
*/
MWDECL MwFont MwFontData[];
/*!
* @brief Default bold font data
*/
MWDECL MwFont MwBoldFontData[];
/*!
* @brief Default TTF font data
*/
MWDECL unsigned char MwTTFData[];
/*!
* @brief Default TTF font size
*/
MWDECL unsigned int MwTTFDataSize;
/*!
* @brief Default bold TTF font data
*/
MWDECL unsigned char MwBoldTTFData[];
/*!
* @brief Default bold TTF font size
*/
MWDECL unsigned int MwBoldTTFDataSize;
/*!
* @brief Default monospace TTF font data
*/
MWDECL unsigned char MwMonospaceTTFData[];
/*!
* @brief Default monospace TTF font size
*/
MWDECL unsigned int MwMonospaceTTFDataSize;
/*!
* @brief Default bold monospace TTF font data
*/
MWDECL unsigned char MwBoldMonospaceTTFData[];
/*!
* @brief Default bold monospace TTF font size
*/
MWDECL unsigned int MwBoldMonospaceTTFDataSize;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,98 +1,98 @@
/*!
* @file Mw/Resource/Icon.h
* @brief Icon
*/
#ifndef __MW_RESOURCE_ICON_H__
#define __MW_RESOURCE_ICON_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Back icon
*/
MWDECL MwU32 MwIconBack[];
/*!
* @brief Clock icon
*/
MWDECL MwU32 MwIconClock[];
/*!
* @brief Computer icon
*/
MWDECL MwU32 MwIconComputer[];
/*!
* @brief Directory icon
*/
MWDECL MwU32 MwIconDirectory[];
/*!
* @brief Down icon
*/
MWDECL MwU32 MwIconDown[];
/*!
* @brief Error icon
*/
MWDECL MwU32 MwIconError[];
/*!
* @brief File icon
*/
MWDECL MwU32 MwIconFile[];
/*!
* @brief Forward icon
*/
MWDECL MwU32 MwIconForward[];
/*!
* @brief Info icon
*/
MWDECL MwU32 MwIconInfo[];
/*!
* @brief Left icon
*/
MWDECL MwU32 MwIconLeft[];
/*!
* @brief News icon
*/
MWDECL MwU32 MwIconNews[];
/*!
* @brief Note icon
*/
MWDECL MwU32 MwIconNote[];
/*!
* @brief Right icon
*/
MWDECL MwU32 MwIconRight[];
/*!
* @brief Search icon
*/
MWDECL MwU32 MwIconSearch[];
/*!
* @brief Up icon
*/
MWDECL MwU32 MwIconUp[];
/*!
* @brief Warning icon
*/
MWDECL MwU32 MwIconWarning[];
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Resource/Icon.h
* @brief Icon
*/
#ifndef __MW_RESOURCE_ICON_H__
#define __MW_RESOURCE_ICON_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Back icon
*/
MWDECL MwU32 MwIconBack[];
/*!
* @brief Clock icon
*/
MWDECL MwU32 MwIconClock[];
/*!
* @brief Computer icon
*/
MWDECL MwU32 MwIconComputer[];
/*!
* @brief Directory icon
*/
MWDECL MwU32 MwIconDirectory[];
/*!
* @brief Down icon
*/
MWDECL MwU32 MwIconDown[];
/*!
* @brief Error icon
*/
MWDECL MwU32 MwIconError[];
/*!
* @brief File icon
*/
MWDECL MwU32 MwIconFile[];
/*!
* @brief Forward icon
*/
MWDECL MwU32 MwIconForward[];
/*!
* @brief Info icon
*/
MWDECL MwU32 MwIconInfo[];
/*!
* @brief Left icon
*/
MWDECL MwU32 MwIconLeft[];
/*!
* @brief News icon
*/
MWDECL MwU32 MwIconNews[];
/*!
* @brief Note icon
*/
MWDECL MwU32 MwIconNote[];
/*!
* @brief Right icon
*/
MWDECL MwU32 MwIconRight[];
/*!
* @brief Search icon
*/
MWDECL MwU32 MwIconSearch[];
/*!
* @brief Up icon
*/
MWDECL MwU32 MwIconUp[];
/*!
* @brief Warning icon
*/
MWDECL MwU32 MwIconWarning[];
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,63 +1,63 @@
/*!
* @file Mw/String.h
* @brief String utilities
*/
#ifndef __MW_STRING_H__
#define __MW_STRING_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Duplicates a string
* @param str String
* @return String
*/
MWDECL char* MWAPI MwStringDuplicate(const char* str);
/*!
* @brief Concatenates 2 strings
* @param str1 String
* @param str2 String
* @return String
*/
MWDECL char* MWAPI MwStringConcat(const char* str1, const char* str2);
/*!
* @brief Converts size to string
* @param out Output
* @param size Size
*/
MWDECL void MWAPI MwStringSize(char* out, MwOffset size);
/*!
* @brief Converts time to string
* @param out Output
* @param t Time
*/
MWDECL void MWAPI MwStringTime(char* out, time_t t);
/*!
* @brief Prints up to n characters into a bufferMwStringPrintIntoBuffer.
* @note On compilers that support C99, this uses vsnprintf to safely print into a buffer; on compilers that don't, vsprintf is used.
* @param out Buffer
* @param size Max size
*/
MWDECL void MWAPI MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...);
/*!
* @brief Check if the given key is UTF8
* @param key Input
* @return whether its utf8
*/
MWDECL MwBool MWAPI MwStringIsKeyUTF8(MwU32 key);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/String.h
* @brief String utilities
*/
#ifndef __MW_STRING_H__
#define __MW_STRING_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Duplicates a string
* @param str String
* @return String
*/
MWDECL char* MWAPI MwStringDuplicate(const char* str);
/*!
* @brief Concatenates 2 strings
* @param str1 String
* @param str2 String
* @return String
*/
MWDECL char* MWAPI MwStringConcat(const char* str1, const char* str2);
/*!
* @brief Converts size to string
* @param out Output
* @param size Size
*/
MWDECL void MWAPI MwStringSize(char* out, MwOffset size);
/*!
* @brief Converts time to string
* @param out Output
* @param t Time
*/
MWDECL void MWAPI MwStringTime(char* out, time_t t);
/*!
* @brief Prints up to n characters into a bufferMwStringPrintIntoBuffer.
* @note On compilers that support C99, this uses vsnprintf to safely print into a buffer; on compilers that don't, vsprintf is used.
* @param out Buffer
* @param size Max size
*/
MWDECL void MWAPI MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...);
/*!
* @brief Check if the given key is UTF8
* @param key Input
* @return whether its utf8
*/
MWDECL MwBool MWAPI MwStringIsKeyUTF8(MwU32 key);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,102 +1,102 @@
/*!
* @file Mw/StringDefs.h
* @brief String definitions for property
*/
#ifndef __MW_STRINGDEFS_H__
#define __MW_STRINGDEFS_H__
#define MwNx "Ix"
#define MwNy "Iy"
#define MwNwidth "Iwidth"
#define MwNheight "Iheight"
#define MwNorientation "Iorientation"
#define MwNminValue "IminValue"
#define MwNmaxValue "ImaxValue"
#define MwNvalue "Ivalue"
#define MwNchangedBy "IchangedBy"
#define MwNareaShown "IareaShown"
#define MwNchecked "Ichecked"
#define MwNalignment "Ialignment"
#define MwNbold "Ibold"
#define MwNmain "Imain"
#define MwNleftPadding "IleftPadding"
#define MwNhasHeading "IhasHeading"
#define MwNhasBorder "IhasBorder"
#define MwNinverted "Iinverted"
#define MwNmodernLook "ImodernLook"
#define MwNwaitMS "IwaitMS"
#define MwNhideInput "IhideInput"
#define MwNsingleClickSelectable "IsingleClickSelectable"
#define MwNflat "Iflat"
#define MwNshowArrows "IshowArrows"
#define MwNpadding "Ipadding"
#define MwNborderWidth "IborderWidth"
#define MwNfillArea "IfillArea"
#define MwNratio "Iratio"
#define MwNfixedSize "IfixedSize"
#define MwNmargin "Imargin"
#define MwNbitmapFont "IbitmapFont"
#define MwNsevenSegment "IsevenSegment"
#define MwNlength "Ilength"
#define MwNforceInverted "IforceInverted"
#define MwNisRounded "IisRounded"
#define MwNdarkTheme "IdarkTheme"
#define MwNuseMonospace "IuseMonospace"
#define MwNdarkThemeAutomatic "IdarkThemeAutomatic"
#define MwNyear "Iyear"
#define MwNmonth "Imonth"
#define MwNdate "Idate"
#define MwNday "Iday"
#define MwNwaitLayout "IwaitLayout"
#define MwNscale "Iscale"
#define MwNcolumns "Icolumns"
#define MwNcolumnSpan "IcolumnSpan"
#define MwNrowSpan "IrowSpan"
#define MwNdisabled "Idisabled"
#define MwNtitle "Stitle"
#define MwNtext "Stext"
#define MwNbackground "Sbackground"
#define MwNsubBackground "SsubBackground"
#define MwNtitleBackground "StitleBackground"
#define MwNforeground "Sforeground"
#define MwNsubForeground "SsubForeground"
#define MwNtitleForeground "StitleForeground"
#define MwNvulkanExtension "SEvulkanExtension"
#define MwNvulkanLayer "SEvulkanLayer"
#define MwNvulkanConfig "VEvulkanConfig"
#define MwNpixmap "Vpixmap"
#define MwNiconPixmap "ViconPixmap"
#define MwNsizeHints "VsizeHints"
#define MwNfont "Vfont"
#define MwNboldFont "VboldFont"
#define MwNbackgroundPixmap "VbackgroundPixmap"
#define MwNmonospaceFont "VmonospaceFont"
#define MwNboldMonospaceFont "VboldMonospaceFont"
#define MwNactivateHandler "Cactivate"
#define MwNlistBoxActivateHandler "ClistBoxActivate"
#define MwNtreeViewActivateHandler "CtreeViewActivate"
#define MwNresizeHandler "Cresize"
#define MwNtickHandler "Ctick"
#define MwNmenuHandler "Cmenu"
#define MwNmouseDownHandler "CmouseDown"
#define MwNmouseUpHandler "CmouseUp"
#define MwNmouseMoveHandler "CmouseMove"
#define MwNchangedHandler "Cchanged"
#define MwNcomboBoxChangedHandler "CcomboBoxChanged"
#define MwNkeyHandler "Ckey"
#define MwNkeyReleaseHandler "CkeyRelease"
#define MwNcloseHandler "Cclose"
#define MwNfocusInHandler "CfocusIn"
#define MwNfocusOutHandler "CfocusOut"
#define MwNfileChosenHandler "CfileChosen"
#define MwNdirectoryChosenHandler "CdirectoryChosen"
#define MwNcolorChosenHandler "CcolorChosen"
#define MwNdrawHandler "Cdraw"
#define MwNclipboardHandler "Cclipboard"
#define MwNdarkThemeHandler "CdarkTheme"
#endif
/*!
* @file Mw/StringDefs.h
* @brief String definitions for property
*/
#ifndef __MW_STRINGDEFS_H__
#define __MW_STRINGDEFS_H__
#define MwNx "Ix"
#define MwNy "Iy"
#define MwNwidth "Iwidth"
#define MwNheight "Iheight"
#define MwNorientation "Iorientation"
#define MwNminValue "IminValue"
#define MwNmaxValue "ImaxValue"
#define MwNvalue "Ivalue"
#define MwNchangedBy "IchangedBy"
#define MwNareaShown "IareaShown"
#define MwNchecked "Ichecked"
#define MwNalignment "Ialignment"
#define MwNbold "Ibold"
#define MwNmain "Imain"
#define MwNleftPadding "IleftPadding"
#define MwNhasHeading "IhasHeading"
#define MwNhasBorder "IhasBorder"
#define MwNinverted "Iinverted"
#define MwNmodernLook "ImodernLook"
#define MwNwaitMS "IwaitMS"
#define MwNhideInput "IhideInput"
#define MwNsingleClickSelectable "IsingleClickSelectable"
#define MwNflat "Iflat"
#define MwNshowArrows "IshowArrows"
#define MwNpadding "Ipadding"
#define MwNborderWidth "IborderWidth"
#define MwNfillArea "IfillArea"
#define MwNratio "Iratio"
#define MwNfixedSize "IfixedSize"
#define MwNmargin "Imargin"
#define MwNbitmapFont "IbitmapFont"
#define MwNsevenSegment "IsevenSegment"
#define MwNlength "Ilength"
#define MwNforceInverted "IforceInverted"
#define MwNisRounded "IisRounded"
#define MwNdarkTheme "IdarkTheme"
#define MwNuseMonospace "IuseMonospace"
#define MwNdarkThemeAutomatic "IdarkThemeAutomatic"
#define MwNyear "Iyear"
#define MwNmonth "Imonth"
#define MwNdate "Idate"
#define MwNday "Iday"
#define MwNwaitLayout "IwaitLayout"
#define MwNscale "Iscale"
#define MwNcolumns "Icolumns"
#define MwNcolumnSpan "IcolumnSpan"
#define MwNrowSpan "IrowSpan"
#define MwNdisabled "Idisabled"
#define MwNtitle "Stitle"
#define MwNtext "Stext"
#define MwNbackground "Sbackground"
#define MwNsubBackground "SsubBackground"
#define MwNtitleBackground "StitleBackground"
#define MwNforeground "Sforeground"
#define MwNsubForeground "SsubForeground"
#define MwNtitleForeground "StitleForeground"
#define MwNvulkanExtension "SEvulkanExtension"
#define MwNvulkanLayer "SEvulkanLayer"
#define MwNvulkanConfig "VEvulkanConfig"
#define MwNpixmap "Vpixmap"
#define MwNiconPixmap "ViconPixmap"
#define MwNsizeHints "VsizeHints"
#define MwNfont "Vfont"
#define MwNboldFont "VboldFont"
#define MwNbackgroundPixmap "VbackgroundPixmap"
#define MwNmonospaceFont "VmonospaceFont"
#define MwNboldMonospaceFont "VboldMonospaceFont"
#define MwNactivateHandler "Cactivate"
#define MwNlistBoxActivateHandler "ClistBoxActivate"
#define MwNtreeViewActivateHandler "CtreeViewActivate"
#define MwNresizeHandler "Cresize"
#define MwNtickHandler "Ctick"
#define MwNmenuHandler "Cmenu"
#define MwNmouseDownHandler "CmouseDown"
#define MwNmouseUpHandler "CmouseUp"
#define MwNmouseMoveHandler "CmouseMove"
#define MwNchangedHandler "Cchanged"
#define MwNcomboBoxChangedHandler "CcomboBoxChanged"
#define MwNkeyHandler "Ckey"
#define MwNkeyReleaseHandler "CkeyRelease"
#define MwNcloseHandler "Cclose"
#define MwNfocusInHandler "CfocusIn"
#define MwNfocusOutHandler "CfocusOut"
#define MwNfileChosenHandler "CfileChosen"
#define MwNdirectoryChosenHandler "CdirectoryChosen"
#define MwNcolorChosenHandler "CcolorChosen"
#define MwNdrawHandler "Cdraw"
#define MwNclipboardHandler "Cclipboard"
#define MwNdarkThemeHandler "CdarkTheme"
#endif

View file

@ -1,273 +1,273 @@
/*!
* @file Mw/TypeDefs.h
* @brief Type definitions
*/
#ifndef __MW_TYPEDEFS_H__
#define __MW_TYPEDEFS_H__
#include <Mw/MachDep.h>
#include <Mw/BaseTypes.h>
typedef struct _MwClass * MwClass, MwClassRec;
typedef struct _MwIntegerKeyValue MwIntegerKeyValue;
typedef struct _MwTextKeyValue MwTextKeyValue;
typedef struct _MwUserHandlerArray MwUserHandlerArray;
typedef struct _MwUserHandlerKeyValue MwUserHandlerKeyValue;
typedef struct _MwVoidKeyValue MwVoidKeyValue;
typedef struct _MwMenu* MwMenu;
typedef struct _MwEntry* MwEntry;
typedef struct _MwViewport* MwViewport;
typedef struct _MwListBox* MwListBox;
typedef struct _MwComboBox* MwComboBox;
typedef struct _MwTreeView* MwTreeView;
typedef struct _MwScrollBar* MwScrollBar;
typedef struct _MwLabel* MwLabel;
typedef struct _MwLabelSegment MwLabelSegment;
typedef struct _MwListBoxEntry MwListBoxEntry;
typedef struct _MwTreeViewEntry MwTreeViewEntry;
typedef struct _MwDirectoryEntry MwDirectoryEntry;
typedef struct _MwBox* MwBox;
typedef struct _MwSubWindow* MwSubWindow;
typedef struct _MwTab* MwTab;
typedef struct _MwTable* MwTable;
typedef struct _MwMouse MwMouse;
#ifdef _MILSKO
typedef struct _MwWidget* MwWidget;
#else
typedef void* MwWidget;
#endif
typedef void (*MwHandler)(MwWidget handle);
typedef int (*MwHandlerWithStatus)(MwWidget handle);
typedef void (*MwHandlerProps)(MwWidget handle, char** key);
typedef void (*MwHandlerProp)(MwWidget handle, const char* key);
typedef void (*MwHandlerChildrenUpdate)(MwWidget handle, MwWidget child, int new_child);
typedef void (*MwHandlerChildrenProp)(MwWidget handle, MwWidget child, const char* key);
typedef void (*MwHandlerKey)(MwWidget handle, int key);
typedef void (*MwHandlerMouse)(MwWidget handle, void* ptr);
typedef void (*MwHandlerExecute)(MwWidget handle, const char* name, void* out, va_list args);
typedef void (*MwHandlerClipboardReceived)(MwWidget handle, const char* data);
typedef void(MWAPI* MwUserHandler)(MwWidget handle, void* user_data, void* call_data);
typedef void(MWAPI* MwErrorHandler)(int code, const char* message, void* user_data);
struct _MwTextKeyValue {
char* key;
char* value;
};
struct _MwIntegerKeyValue {
char* key;
int value;
};
struct _MwUserHandlerArray {
void* user_data;
MwUserHandler handler;
};
struct _MwUserHandlerKeyValue {
char* key;
MwUserHandlerArray* value;
};
struct _MwVoidKeyValue {
char* key;
void* value;
};
#include <Mw/LowLevel.h>
#ifdef _MILSKO
struct _MwWidget {
char* name;
MwLLColor bgcolor;
MwLL lowlevel;
MwWidget parent;
MwWidget* children;
MwClass widget_class;
int pressed;
MwPoint mouse_point;
int close;
int prop_event;
void* internal;
void* opaque;
void* user;
void (*draw_inject)(MwWidget handle);
void (*destroy_inject)(MwWidget handle);
MwIntegerKeyValue* integer;
MwTextKeyValue* text;
MwUserHandlerKeyValue* handler;
MwVoidKeyValue* data;
MwWidget* destroy_queue;
MwWidget* tick_list;
int destroyed;
void* root_font;
void* root_boldfont;
void* root_monofont;
void* root_boldmonofont;
int top_step;
MwWidget* draw_queue;
MwWidget* resize_queue;
int berserk;
long last_tick;
MwBool is_menu;
};
#endif
struct _MwMenu {
char* name;
int keep;
MwWidget wsub;
MwMenu* sub;
void* opaque;
int cleaned;
};
struct _MwEntry {
int cursor;
int right;
int length;
MwPoint mouse;
};
struct _MwViewport {
MwWidget vscroll;
MwWidget hscroll;
MwWidget frame;
MwWidget inframe;
int vchanged;
int hchanged;
};
struct _MwListBoxEntry {
char** name;
MwLLPixmap pixmap;
};
struct _MwListBox {
MwWidget vscroll;
MwWidget frame;
MwListBoxEntry* list;
unsigned long click_time;
int pressed;
int* width;
int* alignment;
int changed;
};
struct _MwComboBox {
char** list;
int opened;
MwWidget listbox;
};
struct _MwTreeViewEntry {
char* label;
MwLLPixmap pixmap;
MwTreeViewEntry** tree;
int opened;
int selected;
unsigned long click_time;
MwTreeViewEntry* parent;
};
struct _MwTreeView {
MwWidget frame;
MwWidget vscroll;
int changed;
MwTreeViewEntry** tree;
MwPoint pressed;
};
struct _MwScrollBar {
MwPoint point;
int drag;
int pos;
};
struct _MwLabel {
MwLabelSegment* segment;
MwHandler draw;
};
struct _MwLabelSegment {
int key;
unsigned char value;
};
struct _MwDirectoryEntry {
char* name;
int type;
MwOffset size;
time_t mtime;
};
struct _MwBox {
int layout;
};
struct _MwTable {
int layout;
MwWidget* widgets;
};
struct _MwSubWindow {
MwWidget frame;
MwWidget minimize;
MwWidget maximize;
MwWidget close;
int maximized;
int minimized;
int x;
int y;
int width;
int height;
MwPoint cursor_start;
MwPoint base;
};
struct _MwTab {
MwWidget* frames;
char** names;
};
struct _MwMouse {
MwPoint point;
int button;
};
struct _MwClass {
MwHandlerWithStatus create;
MwHandler destroy;
MwHandler draw;
MwHandler click;
MwHandler parent_resize;
MwHandlerProp prop_change;
MwHandler mouse_move;
MwHandlerMouse mouse_up;
MwHandlerMouse mouse_down;
MwHandlerKey key;
MwHandlerExecute execute;
MwHandler tick;
MwHandler resize;
MwHandlerChildrenUpdate children_update;
MwHandlerChildrenProp children_prop_change;
MwHandlerClipboardReceived clipboard;
MwHandlerProps props_change;
void* reserved1;
void* reserved2;
void* reserved3;
};
#endif
/*!
* @file Mw/TypeDefs.h
* @brief Type definitions
*/
#ifndef __MW_TYPEDEFS_H__
#define __MW_TYPEDEFS_H__
#include <Mw/MachDep.h>
#include <Mw/BaseTypes.h>
typedef struct _MwClass * MwClass, MwClassRec;
typedef struct _MwIntegerKeyValue MwIntegerKeyValue;
typedef struct _MwTextKeyValue MwTextKeyValue;
typedef struct _MwUserHandlerArray MwUserHandlerArray;
typedef struct _MwUserHandlerKeyValue MwUserHandlerKeyValue;
typedef struct _MwVoidKeyValue MwVoidKeyValue;
typedef struct _MwMenu* MwMenu;
typedef struct _MwEntry* MwEntry;
typedef struct _MwViewport* MwViewport;
typedef struct _MwListBox* MwListBox;
typedef struct _MwComboBox* MwComboBox;
typedef struct _MwTreeView* MwTreeView;
typedef struct _MwScrollBar* MwScrollBar;
typedef struct _MwLabel* MwLabel;
typedef struct _MwLabelSegment MwLabelSegment;
typedef struct _MwListBoxEntry MwListBoxEntry;
typedef struct _MwTreeViewEntry MwTreeViewEntry;
typedef struct _MwDirectoryEntry MwDirectoryEntry;
typedef struct _MwBox* MwBox;
typedef struct _MwSubWindow* MwSubWindow;
typedef struct _MwTab* MwTab;
typedef struct _MwTable* MwTable;
typedef struct _MwMouse MwMouse;
#ifdef _MILSKO
typedef struct _MwWidget* MwWidget;
#else
typedef void* MwWidget;
#endif
typedef void (*MwHandler)(MwWidget handle);
typedef int (*MwHandlerWithStatus)(MwWidget handle);
typedef void (*MwHandlerProps)(MwWidget handle, char** key);
typedef void (*MwHandlerProp)(MwWidget handle, const char* key);
typedef void (*MwHandlerChildrenUpdate)(MwWidget handle, MwWidget child, int new_child);
typedef void (*MwHandlerChildrenProp)(MwWidget handle, MwWidget child, const char* key);
typedef void (*MwHandlerKey)(MwWidget handle, int key);
typedef void (*MwHandlerMouse)(MwWidget handle, void* ptr);
typedef void (*MwHandlerExecute)(MwWidget handle, const char* name, void* out, va_list args);
typedef void (*MwHandlerClipboardReceived)(MwWidget handle, const char* data);
typedef void(MWAPI* MwUserHandler)(MwWidget handle, void* user_data, void* call_data);
typedef void(MWAPI* MwErrorHandler)(int code, const char* message, void* user_data);
struct _MwTextKeyValue {
char* key;
char* value;
};
struct _MwIntegerKeyValue {
char* key;
int value;
};
struct _MwUserHandlerArray {
void* user_data;
MwUserHandler handler;
};
struct _MwUserHandlerKeyValue {
char* key;
MwUserHandlerArray* value;
};
struct _MwVoidKeyValue {
char* key;
void* value;
};
#include <Mw/LowLevel.h>
#ifdef _MILSKO
struct _MwWidget {
char* name;
MwLLColor bgcolor;
MwLL lowlevel;
MwWidget parent;
MwWidget* children;
MwClass widget_class;
int pressed;
MwPoint mouse_point;
int close;
int prop_event;
void* internal;
void* opaque;
void* user;
void (*draw_inject)(MwWidget handle);
void (*destroy_inject)(MwWidget handle);
MwIntegerKeyValue* integer;
MwTextKeyValue* text;
MwUserHandlerKeyValue* handler;
MwVoidKeyValue* data;
MwWidget* destroy_queue;
MwWidget* tick_list;
int destroyed;
void* root_font;
void* root_boldfont;
void* root_monofont;
void* root_boldmonofont;
int top_step;
MwWidget* draw_queue;
MwWidget* resize_queue;
int berserk;
long last_tick;
MwBool is_menu;
};
#endif
struct _MwMenu {
char* name;
int keep;
MwWidget wsub;
MwMenu* sub;
void* opaque;
int cleaned;
};
struct _MwEntry {
int cursor;
int right;
int length;
MwPoint mouse;
};
struct _MwViewport {
MwWidget vscroll;
MwWidget hscroll;
MwWidget frame;
MwWidget inframe;
int vchanged;
int hchanged;
};
struct _MwListBoxEntry {
char** name;
MwLLPixmap pixmap;
};
struct _MwListBox {
MwWidget vscroll;
MwWidget frame;
MwListBoxEntry* list;
unsigned long click_time;
int pressed;
int* width;
int* alignment;
int changed;
};
struct _MwComboBox {
char** list;
int opened;
MwWidget listbox;
};
struct _MwTreeViewEntry {
char* label;
MwLLPixmap pixmap;
MwTreeViewEntry** tree;
int opened;
int selected;
unsigned long click_time;
MwTreeViewEntry* parent;
};
struct _MwTreeView {
MwWidget frame;
MwWidget vscroll;
int changed;
MwTreeViewEntry** tree;
MwPoint pressed;
};
struct _MwScrollBar {
MwPoint point;
int drag;
int pos;
};
struct _MwLabel {
MwLabelSegment* segment;
MwHandler draw;
};
struct _MwLabelSegment {
int key;
unsigned char value;
};
struct _MwDirectoryEntry {
char* name;
int type;
MwOffset size;
time_t mtime;
};
struct _MwBox {
int layout;
};
struct _MwTable {
int layout;
MwWidget* widgets;
};
struct _MwSubWindow {
MwWidget frame;
MwWidget minimize;
MwWidget maximize;
MwWidget close;
int maximized;
int minimized;
int x;
int y;
int width;
int height;
MwPoint cursor_start;
MwPoint base;
};
struct _MwTab {
MwWidget* frames;
char** names;
};
struct _MwMouse {
MwPoint point;
int button;
};
struct _MwClass {
MwHandlerWithStatus create;
MwHandler destroy;
MwHandler draw;
MwHandler click;
MwHandler parent_resize;
MwHandlerProp prop_change;
MwHandler mouse_move;
MwHandlerMouse mouse_up;
MwHandlerMouse mouse_down;
MwHandlerKey key;
MwHandlerExecute execute;
MwHandler tick;
MwHandler resize;
MwHandlerChildrenUpdate children_update;
MwHandlerChildrenProp children_prop_change;
MwHandlerClipboardReceived clipboard;
MwHandlerProps props_change;
void* reserved1;
void* reserved2;
void* reserved3;
};
#endif

View file

@ -1,53 +1,53 @@
/*!
* @file Mw/Unicode.h
* @brief Handles UTF8 stuff
*/
#ifndef __MW_UNICODE_H__
#define __MW_UNICODE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Converts UTF-8 to UTF-32
* @brief input Input
* @brief output Output
* @return Bytes this multibyte takes
*/
MWDECL int MWAPI MwUTF8ToUTF32(const char* input, int* output);
/*!
* @brief Calculates UTF-8 string length
* @brief input Input
* @return Length
*/
MWDECL int MWAPI MwUTF8Length(const char* input);
/*!
* @brief Copies UTF-8 string to other string
* @brief src Source
* @brief srcskip Length to be skipped
* @brief dst Destination
* @brief dstskip Length to be skipped
* @brief len Length
* @return Copied length in bytes
*/
MWDECL int MWAPI MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int len);
/*!
* @brief Converts UTF-32 to UTF-8
* @brief input Input
* @brief output Output
* @return Bytes this wide byte takes
*/
MWDECL int MWAPI MwUTF32ToUTF8(int input, char* output);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Unicode.h
* @brief Handles UTF8 stuff
*/
#ifndef __MW_UNICODE_H__
#define __MW_UNICODE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Converts UTF-8 to UTF-32
* @brief input Input
* @brief output Output
* @return Bytes this multibyte takes
*/
MWDECL int MWAPI MwUTF8ToUTF32(const char* input, int* output);
/*!
* @brief Calculates UTF-8 string length
* @brief input Input
* @return Length
*/
MWDECL int MWAPI MwUTF8Length(const char* input);
/*!
* @brief Copies UTF-8 string to other string
* @brief src Source
* @brief srcskip Length to be skipped
* @brief dst Destination
* @brief dstskip Length to be skipped
* @brief len Length
* @return Copied length in bytes
*/
MWDECL int MWAPI MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int len);
/*!
* @brief Converts UTF-32 to UTF-8
* @brief input Input
* @brief output Output
* @return Bytes this wide byte takes
*/
MWDECL int MWAPI MwUTF32ToUTF8(int input, char* output);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,33 +1,33 @@
/*!
* @file Mw/Version.h
* @brief Version informations
*/
#ifndef __MW_VERSION_H__
#define __MW_VERSION_H__
/*!
* @brief Major version
*/
#define MwMAJOR 1
/*!
* @brief Minor version
*/
#define MwMINOR 3
/*!
* @brief Patchlevel of version, if patchlevel_alphabet is a or bigger, this value is calculated by `patchlevel_alphabet - 'a' + 1`. Otherwise 0
*/
#define MwPATCH 0
/*!
* @brief Version in string
*/
#define MwVERSION "1.3"
/*!
* @brief Version in string
*/
MWDECL const char* MwVersionString;
#endif
/*!
* @file Mw/Version.h
* @brief Version informations
*/
#ifndef __MW_VERSION_H__
#define __MW_VERSION_H__
/*!
* @brief Major version
*/
#define MwMAJOR 1
/*!
* @brief Minor version
*/
#define MwMINOR 3
/*!
* @brief Patchlevel of version, if patchlevel_alphabet is a or bigger, this value is calculated by `patchlevel_alphabet - 'a' + 1`. Otherwise 0
*/
#define MwPATCH 0
/*!
* @brief Version in string
*/
#define MwVERSION "1.3"
/*!
* @brief Version in string
*/
MWDECL const char* MwVersionString;
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Box.h
* @brief Box widget
*/
#ifndef __MW_WIDGET_BOX_H__
#define __MW_WIDGET_BOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Box widget class
*/
MWDECL MwClass MwBoxClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Box.h
* @brief Box widget
*/
#ifndef __MW_WIDGET_BOX_H__
#define __MW_WIDGET_BOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Box widget class
*/
MWDECL MwClass MwBoxClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Button.h
* @brief Button widget
*/
#ifndef __MW_WIDGET_BUTTON_H__
#define __MW_WIDGET_BUTTON_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Button widget class
*/
MWDECL MwClass MwButtonClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Button.h
* @brief Button widget
*/
#ifndef __MW_WIDGET_BUTTON_H__
#define __MW_WIDGET_BUTTON_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Button widget class
*/
MWDECL MwClass MwButtonClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Calendar.h
* @brief Calendar widget
*/
#ifndef __MW_WIDGET_CALENDAR_H__
#define __MW_WIDGET_CALENDAR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Calendar widget class
*/
MWDECL MwClass MwCalendarClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Calendar.h
* @brief Calendar widget
*/
#ifndef __MW_WIDGET_CALENDAR_H__
#define __MW_WIDGET_CALENDAR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Calendar widget class
*/
MWDECL MwClass MwCalendarClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/CheckBox.h
* @brief CheckBox widget
*/
#ifndef __MW_WIDGET_CHECKBOX_H__
#define __MW_WIDGET_CHECKBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief CheckBox widget class
*/
MWDECL MwClass MwCheckBoxClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/CheckBox.h
* @brief CheckBox widget
*/
#ifndef __MW_WIDGET_CHECKBOX_H__
#define __MW_WIDGET_CHECKBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief CheckBox widget class
*/
MWDECL MwClass MwCheckBoxClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,48 +1,48 @@
/*!
* @file Mw/Widget/ComboBox.h
* @brief ComboBox widget
*/
#ifndef __MW_WIDGET_COMBOBOX_H__
#define __MW_WIDGET_COMBOBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ComboBox widget class
*/
MWDECL MwClass MwComboBoxClass;
/*!
* @brief Adds the entry to combobox
* @param handle Widget
* @param index Index
* @param text Text
*/
MwInline void MwComboBoxAdd(MwWidget handle, int index, const char* text) {
MwVaWidgetExecute(handle, "mwComboBoxAdd", NULL, index, text);
}
/*!
* @brief Gets the entry from combobox
* @param handle Widget
* @param index Index
* @return Text
*/
MwInline const char* MwComboBoxGet(MwWidget handle, int index) {
const char* text;
MwVaWidgetExecute(handle, "mwComboBoxGet", (void*)&text, index);
return text;
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/ComboBox.h
* @brief ComboBox widget
*/
#ifndef __MW_WIDGET_COMBOBOX_H__
#define __MW_WIDGET_COMBOBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ComboBox widget class
*/
MWDECL MwClass MwComboBoxClass;
/*!
* @brief Adds the entry to combobox
* @param handle Widget
* @param index Index
* @param text Text
*/
MwInline void MwComboBoxAdd(MwWidget handle, int index, const char* text) {
MwVaWidgetExecute(handle, "mwComboBoxAdd", NULL, index, text);
}
/*!
* @brief Gets the entry from combobox
* @param handle Widget
* @param index Index
* @return Text
*/
MwInline const char* MwComboBoxGet(MwWidget handle, int index) {
const char* text;
MwVaWidgetExecute(handle, "mwComboBoxGet", (void*)&text, index);
return text;
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Entry.h
* @brief Entry widget
*/
#ifndef __MW_WIDGET_ENTRY_H__
#define __MW_WIDGET_ENTRY_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Entry widget class
*/
MWDECL MwClass MwEntryClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Entry.h
* @brief Entry widget
*/
#ifndef __MW_WIDGET_ENTRY_H__
#define __MW_WIDGET_ENTRY_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Entry widget class
*/
MWDECL MwClass MwEntryClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Frame.h
* @brief Frame widget
*/
#ifndef __MW_WIDGET_FRAME_H__
#define __MW_WIDGET_FRAME_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Frame widget class
*/
MWDECL MwClass MwFrameClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Frame.h
* @brief Frame widget
*/
#ifndef __MW_WIDGET_FRAME_H__
#define __MW_WIDGET_FRAME_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Frame widget class
*/
MWDECL MwClass MwFrameClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Image.h
* @brief Image widget
*/
#ifndef __MW_WIDGET_IMAGE_H__
#define __MW_WIDGET_IMAGE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Image widget class
*/
MWDECL MwClass MwImageClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Image.h
* @brief Image widget
*/
#ifndef __MW_WIDGET_IMAGE_H__
#define __MW_WIDGET_IMAGE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Image widget class
*/
MWDECL MwClass MwImageClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,36 +1,36 @@
/*!
* @file Mw/Widget/Label.h
* @brief Label widget
*/
#ifndef __MW_WIDGET_LABEL_H__
#define __MW_WIDGET_LABEL_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Label widget class
*/
MWDECL MwClass MwLabelClass;
/*!
* @brief Sets the custom data for seven segment
* @param handle Widget
* @param index Index
* @param data Data, `GFEDCBA` as 7-bit value
* @note See https://en.wikipedia.org/wiki/File:7_Segment_Display_with_Labeled_Segments.svg for what alphabets mean here
* */
MwInline void MwLabelSetSevenSegment(MwWidget handle, int index, int data) {
MwVaWidgetExecute(handle, "mwLabelSetSevenSegment", NULL, index, data);
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Label.h
* @brief Label widget
*/
#ifndef __MW_WIDGET_LABEL_H__
#define __MW_WIDGET_LABEL_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Label widget class
*/
MWDECL MwClass MwLabelClass;
/*!
* @brief Sets the custom data for seven segment
* @param handle Widget
* @param index Index
* @param data Data, `GFEDCBA` as 7-bit value
* @note See https://en.wikipedia.org/wiki/File:7_Segment_Display_with_Labeled_Segments.svg for what alphabets mean here
* */
MwInline void MwLabelSetSevenSegment(MwWidget handle, int index, int data) {
MwVaWidgetExecute(handle, "mwLabelSetSevenSegment", NULL, index, data);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,100 +1,100 @@
/*!
* @file Mw/Widget/ListBox.h
* @brief ListBox widget
*/
#ifndef __MW_WIDGET_LISTBOX_H__
#define __MW_WIDGET_LISTBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ListBox widget class
*/
MWDECL MwClass MwListBoxClass;
/*!
* @brief Sets item on the listbox
* @param handle Widget
* @param row Row
* @param col Column
* @param text Text
* @return Index
*/
MwInline int MwListBoxSet(MwWidget handle, int row, int col, const char* text) {
int out;
MwVaWidgetExecute(handle, "mwListBoxSet", (void*)&out, row, col, text);
return out;
}
/*!
* @brief Sets the icon of the row
* @param handle Widget
* @param index Index
* @param icon Icon
*/
MwInline void MwListBoxSetIcon(MwWidget handle, int index, MwLLPixmap icon) {
MwVaWidgetExecute(handle, "mwListBoxSetIcon", NULL, index, icon);
}
/*!
* @brief Deletes item from the listbox
* @param handle Widget
* @param index Index
*/
MwInline void MwListBoxDelete(MwWidget handle, int index) {
MwVaWidgetExecute(handle, "mwListBoxDelete", NULL, index);
}
/*!
* @brief Gets item from the listbox
* @param handle Widget
* @param index Index
* @return Item
*/
MwInline const char* MwListBoxGet(MwWidget handle, int index) {
const char* out;
MwVaWidgetExecute(handle, "mwListBoxGet", (void*)&out, index);
return out;
}
/*!
* @brief Sets an item width of the listbox
* @param handle Widget
* @param index Column index
* @param width Width
*/
MwInline void MwListBoxSetWidth(MwWidget handle, int index, int width) {
MwVaWidgetExecute(handle, "mwListBoxSetWidth", NULL, index, width);
}
/*!
* @brief Sets an item alignment of the listbox
* @param handle Widget
* @param index Column index
* @param alignment Alignment
*/
MwInline void MwListBoxSetAlignment(MwWidget handle, int index, int alignment) {
MwVaWidgetExecute(handle, "mwListBoxSetAlignment", NULL, index, alignment);
}
/*!
* @brief Resets the listbox
* @param handle Widget
*/
MwInline void MwListBoxReset(MwWidget handle) {
MwVaWidgetExecute(handle, "mwListBoxReset", NULL);
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/ListBox.h
* @brief ListBox widget
*/
#ifndef __MW_WIDGET_LISTBOX_H__
#define __MW_WIDGET_LISTBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ListBox widget class
*/
MWDECL MwClass MwListBoxClass;
/*!
* @brief Sets item on the listbox
* @param handle Widget
* @param row Row
* @param col Column
* @param text Text
* @return Index
*/
MwInline int MwListBoxSet(MwWidget handle, int row, int col, const char* text) {
int out;
MwVaWidgetExecute(handle, "mwListBoxSet", (void*)&out, row, col, text);
return out;
}
/*!
* @brief Sets the icon of the row
* @param handle Widget
* @param index Index
* @param icon Icon
*/
MwInline void MwListBoxSetIcon(MwWidget handle, int index, MwLLPixmap icon) {
MwVaWidgetExecute(handle, "mwListBoxSetIcon", NULL, index, icon);
}
/*!
* @brief Deletes item from the listbox
* @param handle Widget
* @param index Index
*/
MwInline void MwListBoxDelete(MwWidget handle, int index) {
MwVaWidgetExecute(handle, "mwListBoxDelete", NULL, index);
}
/*!
* @brief Gets item from the listbox
* @param handle Widget
* @param index Index
* @return Item
*/
MwInline const char* MwListBoxGet(MwWidget handle, int index) {
const char* out;
MwVaWidgetExecute(handle, "mwListBoxGet", (void*)&out, index);
return out;
}
/*!
* @brief Sets an item width of the listbox
* @param handle Widget
* @param index Column index
* @param width Width
*/
MwInline void MwListBoxSetWidth(MwWidget handle, int index, int width) {
MwVaWidgetExecute(handle, "mwListBoxSetWidth", NULL, index, width);
}
/*!
* @brief Sets an item alignment of the listbox
* @param handle Widget
* @param index Column index
* @param alignment Alignment
*/
MwInline void MwListBoxSetAlignment(MwWidget handle, int index, int alignment) {
MwVaWidgetExecute(handle, "mwListBoxSetAlignment", NULL, index, alignment);
}
/*!
* @brief Resets the listbox
* @param handle Widget
*/
MwInline void MwListBoxReset(MwWidget handle) {
MwVaWidgetExecute(handle, "mwListBoxReset", NULL);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,38 +1,38 @@
/*!
* @file Mw/Widget/Menu.h
* @brief Menu widget
*/
#ifndef __MW_WIDGET_MENU_H__
#define __MW_WIDGET_MENU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Menu widget class
*/
MWDECL MwClass MwMenuClass;
/*!
* @brief Adds a menu
* @param handle Widget
* @param menu Menu
* @param name Menu name
* @return Menu
*/
MwInline MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
MwMenu out;
MwVaWidgetExecute(handle, "mwMenuAdd", &out, menu, name);
return out;
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Menu.h
* @brief Menu widget
*/
#ifndef __MW_WIDGET_MENU_H__
#define __MW_WIDGET_MENU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Menu widget class
*/
MWDECL MwClass MwMenuClass;
/*!
* @brief Adds a menu
* @param handle Widget
* @param menu Menu
* @param name Menu name
* @return Menu
*/
MwInline MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
MwMenu out;
MwVaWidgetExecute(handle, "mwMenuAdd", &out, menu, name);
return out;
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/NumberEntry.h
* @brief NumberEntry widget
*/
#ifndef __MW_WIDGET_NUMBERENTRY_H__
#define __MW_WIDGET_NUMBERENTRY_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief NumberEntry widget class
*/
MWDECL MwClass MwNumberEntryClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/NumberEntry.h
* @brief NumberEntry widget
*/
#ifndef __MW_WIDGET_NUMBERENTRY_H__
#define __MW_WIDGET_NUMBERENTRY_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief NumberEntry widget class
*/
MWDECL MwClass MwNumberEntryClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,73 +1,73 @@
/*!
* @file Mw/Widget/OpenGL.h
* @brief OpenGL widget
*/
#ifndef __MW_WIDGET_OPENGL_H__
#define __MW_WIDGET_OPENGL_H__
#include <Mw/Core.h>
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#if !defined(MW_OPENGL_NO_INCLUDE) && !defined(__gl_h_)
#ifdef _WIN32
#include <windows.h>
#elif defined(__APPLE__)
#else
#include <GL/glx.h>
#endif
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief OpenGL widget class
*/
MWDECL MwClass MwOpenGLClass;
/*!
* @brief Make a widget current OpenGL context
* @param handle Widget
*/
MwInline void MwOpenGLMakeCurrent(MwWidget handle) {
MwVaWidgetExecute(handle, "mwOpenGLMakeCurrent", NULL);
}
/*!
* @brief Get a procedure from OpenGL
* @param handle Widget
* @param name Name
* @return Procedure
*/
MwInline void* MwOpenGLGetProcAddress(MwWidget handle, const char* name) {
void* out;
MwVaWidgetExecute(handle, "mwOpenGLGetProcAddress", &out, name);
return out;
}
/*!
* @brief Swaps the buffer of OpenGL context
* @param handle Widget
*/
MwInline void MwOpenGLSwapBuffer(MwWidget handle) {
MwVaWidgetExecute(handle, "mwOpenGLSwapBuffer", NULL);
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/OpenGL.h
* @brief OpenGL widget
*/
#ifndef __MW_WIDGET_OPENGL_H__
#define __MW_WIDGET_OPENGL_H__
#include <Mw/Core.h>
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#if !defined(MW_OPENGL_NO_INCLUDE) && !defined(__gl_h_)
#ifdef _WIN32
#include <windows.h>
#elif defined(__APPLE__)
#else
#include <GL/glx.h>
#endif
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief OpenGL widget class
*/
MWDECL MwClass MwOpenGLClass;
/*!
* @brief Make a widget current OpenGL context
* @param handle Widget
*/
MwInline void MwOpenGLMakeCurrent(MwWidget handle) {
MwVaWidgetExecute(handle, "mwOpenGLMakeCurrent", NULL);
}
/*!
* @brief Get a procedure from OpenGL
* @param handle Widget
* @param name Name
* @return Procedure
*/
MwInline void* MwOpenGLGetProcAddress(MwWidget handle, const char* name) {
void* out;
MwVaWidgetExecute(handle, "mwOpenGLGetProcAddress", &out, name);
return out;
}
/*!
* @brief Swaps the buffer of OpenGL context
* @param handle Widget
*/
MwInline void MwOpenGLSwapBuffer(MwWidget handle) {
MwVaWidgetExecute(handle, "mwOpenGLSwapBuffer", NULL);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/ProgressBar.h
* @brief ProgressBar widget
*/
#ifndef __MW_WIDGET_PROGRESSBAR_H__
#define __MW_WIDGET_PROGRESSBAR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ProgressBar widget class
*/
MWDECL MwClass MwProgressBarClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/ProgressBar.h
* @brief ProgressBar widget
*/
#ifndef __MW_WIDGET_PROGRESSBAR_H__
#define __MW_WIDGET_PROGRESSBAR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ProgressBar widget class
*/
MWDECL MwClass MwProgressBarClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/RadioBox.h
* @brief RadioBox widget
*/
#ifndef __MW_WIDGET_RADIOBOX_H__
#define __MW_WIDGET_RADIOBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief RadioBox widget class
*/
MWDECL MwClass MwRadioBoxClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/RadioBox.h
* @brief RadioBox widget
*/
#ifndef __MW_WIDGET_RADIOBOX_H__
#define __MW_WIDGET_RADIOBOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief RadioBox widget class
*/
MWDECL MwClass MwRadioBoxClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,36 +1,36 @@
/*!
* @file Mw/Widget/ScrollBar.h
* @brief ScrollBar widget
*/
#ifndef __MW_WIDGET_SCROLLBAR_H__
#define __MW_WIDGET_SCROLLBAR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ScrollBar widget class
*/
MWDECL MwClass MwScrollBarClass;
/*!
* @brief Calculates a visible length of scrollbar
* @param handle Widget
* @return Visible length
*/
MwInline int MwScrollBarGetVisibleLength(MwWidget handle) {
int out;
MwVaWidgetExecute(handle, "mwScrollBarGetVisibleLength", &out, NULL);
return out;
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/ScrollBar.h
* @brief ScrollBar widget
*/
#ifndef __MW_WIDGET_SCROLLBAR_H__
#define __MW_WIDGET_SCROLLBAR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief ScrollBar widget class
*/
MWDECL MwClass MwScrollBarClass;
/*!
* @brief Calculates a visible length of scrollbar
* @param handle Widget
* @return Visible length
*/
MwInline int MwScrollBarGetVisibleLength(MwWidget handle) {
int out;
MwVaWidgetExecute(handle, "mwScrollBarGetVisibleLength", &out, NULL);
return out;
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Separator.h
* @brief Separator widget
*/
#ifndef __MW_WIDGET_SEPARATOR_H__
#define __MW_WIDGET_SEPARATOR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Separator widget class
*/
MWDECL MwClass MwSeparatorClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Separator.h
* @brief Separator widget
*/
#ifndef __MW_WIDGET_SEPARATOR_H__
#define __MW_WIDGET_SEPARATOR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Separator widget class
*/
MWDECL MwClass MwSeparatorClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,46 +1,46 @@
/*!
* @file Mw/Widget/SubMenu.h
* @brief SubMenu widget
*/
#ifndef __MW_WIDGET_SUBMENU_H__
#define __MW_WIDGET_SUBMENU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief SubMenu widget class
*/
MWDECL MwClass MwSubMenuClass;
/*!
* @brief Makes submenu appear
* @param handle Handle
* @param menu Menu
* @param point Point
* @param diff_calc Toggles different way to calculate positiion
*/
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point, int diff_calc) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point, diff_calc);
}
/*!
* @brief Calculates the size of submenu
* @param handle Handle
* @param menu Menu
* @param rect Size
*/
MwInline void MwSubMenuGetSize(MwWidget handle, MwMenu menu, MwRect* rect) {
MwVaWidgetExecute(handle, "mwSubMenuGetSize", NULL, menu, rect);
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/SubMenu.h
* @brief SubMenu widget
*/
#ifndef __MW_WIDGET_SUBMENU_H__
#define __MW_WIDGET_SUBMENU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief SubMenu widget class
*/
MWDECL MwClass MwSubMenuClass;
/*!
* @brief Makes submenu appear
* @param handle Handle
* @param menu Menu
* @param point Point
* @param diff_calc Toggles different way to calculate positiion
*/
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point, int diff_calc) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point, diff_calc);
}
/*!
* @brief Calculates the size of submenu
* @param handle Handle
* @param menu Menu
* @param rect Size
*/
MwInline void MwSubMenuGetSize(MwWidget handle, MwMenu menu, MwRect* rect) {
MwVaWidgetExecute(handle, "mwSubMenuGetSize", NULL, menu, rect);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,36 +1,36 @@
/*!
* @file Mw/Widget/SubWindow.h
* @brief SubWindow widget
*/
#ifndef __MW_WIDGET_SUBWINDOW_H__
#define __MW_WIDGET_SUBWINDOW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief SubWindow widget class
*/
MWDECL MwClass MwSubWindowClass;
/*!
* @brief Get parent widget where widgets should be placed
* @param handle Widget
* @return Widget
*/
MwInline MwWidget MwSubWindowGetFrame(MwWidget handle) {
MwWidget out;
MwVaWidgetExecute(handle, "mwSubWindowGetFrame", &out);
return out;
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/SubWindow.h
* @brief SubWindow widget
*/
#ifndef __MW_WIDGET_SUBWINDOW_H__
#define __MW_WIDGET_SUBWINDOW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief SubWindow widget class
*/
MWDECL MwClass MwSubWindowClass;
/*!
* @brief Get parent widget where widgets should be placed
* @param handle Widget
* @return Widget
*/
MwInline MwWidget MwSubWindowGetFrame(MwWidget handle) {
MwWidget out;
MwVaWidgetExecute(handle, "mwSubWindowGetFrame", &out);
return out;
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,59 +1,59 @@
/*!
* @file Mw/Widget/Tab.h
* @brief Tab widget
*/
#ifndef __MW_WIDGET_TAB_H__
#define __MW_WIDGET_TAB_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Tab widget class
*/
MWDECL MwClass MwTabClass;
/*!
* @brief Adds a tab
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline MwWidget MwTabAdd(MwWidget handle, const char* name) {
MwWidget out;
MwVaWidgetExecute(handle, "mwTabAdd", &out, name);
return out;
}
/*!
* @brief Gets a tab frame
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline MwWidget MwTabGetFrame(MwWidget handle, const char* name) {
MwWidget out;
MwVaWidgetExecute(handle, "mwTabGetFrame", &out, name);
return out;
}
/*!
* @brief Focus on a tab frame
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline void MwTabFocus(MwWidget handle, const char* name) {
MwVaWidgetExecute(handle, "mwTabFocus", NULL, name);
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Tab.h
* @brief Tab widget
*/
#ifndef __MW_WIDGET_TAB_H__
#define __MW_WIDGET_TAB_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Tab widget class
*/
MWDECL MwClass MwTabClass;
/*!
* @brief Adds a tab
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline MwWidget MwTabAdd(MwWidget handle, const char* name) {
MwWidget out;
MwVaWidgetExecute(handle, "mwTabAdd", &out, name);
return out;
}
/*!
* @brief Gets a tab frame
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline MwWidget MwTabGetFrame(MwWidget handle, const char* name) {
MwWidget out;
MwVaWidgetExecute(handle, "mwTabGetFrame", &out, name);
return out;
}
/*!
* @brief Focus on a tab frame
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline void MwTabFocus(MwWidget handle, const char* name) {
MwVaWidgetExecute(handle, "mwTabFocus", NULL, name);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,24 +1,24 @@
/*!
* @file Mw/Widget/Table.h
* @brief Table widget
*/
#ifndef __MW_WIDGET_TABLE_H__
#define __MW_WIDGET_TABLE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Table widget class
*/
MWDECL MwClass MwTableClass;
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Table.h
* @brief Table widget
*/
#ifndef __MW_WIDGET_TABLE_H__
#define __MW_WIDGET_TABLE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Table widget class
*/
MWDECL MwClass MwTableClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,110 +1,110 @@
/*!
* @file Mw/Widget/TreeView.h
* @brief TreeView widget
*/
#ifndef __MW_WIDGET_TREEVIEW_H__
#define __MW_WIDGET_TREEVIEW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief TreeView widget class
*/
MWDECL MwClass MwTreeViewClass;
/*!
* @brief Adds item to the treeview
* @param handle Widget
* @parma parent Parent
* @parma pixmap Pixmap
* @param item Item
*/
MwInline void* MwTreeViewAdd(MwWidget handle, void* parent, MwLLPixmap pixmap, const char* item) {
void* out;
MwVaWidgetExecute(handle, "mwTreeViewAdd", &out, parent, pixmap, item);
return out;
}
/*!
* @brief Deletes item from the treeview
* @param handle Widget
* @param item Item
*/
MwInline void MwTreeViewDelete(MwWidget handle, void* item) {
MwVaWidgetExecute(handle, "mwTreeViewDelete", NULL, item);
}
/*!
* @brief Resets the treeview
* @param handle Widget
*/
MwInline void MwTreeViewReset(MwWidget handle) {
MwVaWidgetExecute(handle, "mwTreeViewReset", NULL);
}
/*!
* @brief Gets item from the treeview
* @param handle Widget
* @param item Item
* @return Item
*/
MwInline const char* MwTreeViewGet(MwWidget handle, void* item) {
const char* out;
MwVaWidgetExecute(handle, "mwTreeViewGet", (void*)&out, item);
return out;
}
/*!
* @brief Sets the label of ithe item
* @param handle Widget
* @param item Item
* @param label Label
*/
MwInline void MwTreeViewSetLabel(MwWidget handle, void* item, const char* label) {
MwVaWidgetExecute(handle, "mwTreeViewSetLabel", NULL, item, label);
}
/*!
* @brief Sets the pixmap of ithe item
* @param handle Widget
* @param item Item
* @param pixmap Pixmap
*/
MwInline void MwTreeViewSetPixmap(MwWidget handle, void* item, MwLLPixmap pixmap) {
MwVaWidgetExecute(handle, "mwTreeViewSetPixmap", NULL, item, pixmap);
}
/*!
* @brief Sets the opened state of ithe item
* @param handle Widget
* @param item Item
* @param opened Opened or not
*/
MwInline void MwTreeViewSetOpened(MwWidget handle, void* item, int opened) {
MwVaWidgetExecute(handle, "mwTreeViewSetOpened", NULL, item, opened);
}
/*!
* @brief Gets the opened state of ithe item
* @param handle Widget
* @param item Item
* @return Opened or not
*/
MwInline int MwTreeViewGetOpened(MwWidget handle, void* item) {
int out;
MwVaWidgetExecute(handle, "mwTreeViewGetOpened", (void*)&out, item);
return out;
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/TreeView.h
* @brief TreeView widget
*/
#ifndef __MW_WIDGET_TREEVIEW_H__
#define __MW_WIDGET_TREEVIEW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief TreeView widget class
*/
MWDECL MwClass MwTreeViewClass;
/*!
* @brief Adds item to the treeview
* @param handle Widget
* @parma parent Parent
* @parma pixmap Pixmap
* @param item Item
*/
MwInline void* MwTreeViewAdd(MwWidget handle, void* parent, MwLLPixmap pixmap, const char* item) {
void* out;
MwVaWidgetExecute(handle, "mwTreeViewAdd", &out, parent, pixmap, item);
return out;
}
/*!
* @brief Deletes item from the treeview
* @param handle Widget
* @param item Item
*/
MwInline void MwTreeViewDelete(MwWidget handle, void* item) {
MwVaWidgetExecute(handle, "mwTreeViewDelete", NULL, item);
}
/*!
* @brief Resets the treeview
* @param handle Widget
*/
MwInline void MwTreeViewReset(MwWidget handle) {
MwVaWidgetExecute(handle, "mwTreeViewReset", NULL);
}
/*!
* @brief Gets item from the treeview
* @param handle Widget
* @param item Item
* @return Item
*/
MwInline const char* MwTreeViewGet(MwWidget handle, void* item) {
const char* out;
MwVaWidgetExecute(handle, "mwTreeViewGet", (void*)&out, item);
return out;
}
/*!
* @brief Sets the label of ithe item
* @param handle Widget
* @param item Item
* @param label Label
*/
MwInline void MwTreeViewSetLabel(MwWidget handle, void* item, const char* label) {
MwVaWidgetExecute(handle, "mwTreeViewSetLabel", NULL, item, label);
}
/*!
* @brief Sets the pixmap of ithe item
* @param handle Widget
* @param item Item
* @param pixmap Pixmap
*/
MwInline void MwTreeViewSetPixmap(MwWidget handle, void* item, MwLLPixmap pixmap) {
MwVaWidgetExecute(handle, "mwTreeViewSetPixmap", NULL, item, pixmap);
}
/*!
* @brief Sets the opened state of ithe item
* @param handle Widget
* @param item Item
* @param opened Opened or not
*/
MwInline void MwTreeViewSetOpened(MwWidget handle, void* item, int opened) {
MwVaWidgetExecute(handle, "mwTreeViewSetOpened", NULL, item, opened);
}
/*!
* @brief Gets the opened state of ithe item
* @param handle Widget
* @param item Item
* @return Opened or not
*/
MwInline int MwTreeViewGetOpened(MwWidget handle, void* item) {
int out;
MwVaWidgetExecute(handle, "mwTreeViewGetOpened", (void*)&out, item);
return out;
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,46 +1,46 @@
/*!
* @file Mw/Widget/Viewport.h
* @brief Viewport widget
*/
#ifndef __MW_WIDGET_VIEWPORT_H__
#define __MW_WIDGET_VIEWPORT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Viewport widget class
*/
MWDECL MwClass MwViewportClass;
/*!
* @brief Get parent widget where widgets should be placed
* @param handle Widget
* @return Widget
*/
MwInline MwWidget MwViewportGetViewport(MwWidget handle) {
MwWidget out;
MwVaWidgetExecute(handle, "mwViewportGetViewport", &out);
return out;
}
/*!
* @brief Set viewport size
* @param handle Widget
* @param w Width
* @param h Height
*/
MwInline void MwViewportSetSize(MwWidget handle, int w, int h) {
MwVaWidgetExecute(handle, "mwViewportSetSize", NULL, w, h);
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Viewport.h
* @brief Viewport widget
*/
#ifndef __MW_WIDGET_VIEWPORT_H__
#define __MW_WIDGET_VIEWPORT_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Viewport widget class
*/
MWDECL MwClass MwViewportClass;
/*!
* @brief Get parent widget where widgets should be placed
* @param handle Widget
* @return Widget
*/
MwInline MwWidget MwViewportGetViewport(MwWidget handle) {
MwWidget out;
MwVaWidgetExecute(handle, "mwViewportGetViewport", &out);
return out;
}
/*!
* @brief Set viewport size
* @param handle Widget
* @param w Width
* @param h Height
*/
MwInline void MwViewportSetSize(MwWidget handle, int w, int h) {
MwVaWidgetExecute(handle, "mwViewportSetSize", NULL, w, h);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,112 +1,112 @@
/*!
* @file Mw/Widget/Vulkan.h
* @brief Vulkan widget
* @warning This header is not documented yet
*/
/**
* ioixd maintains this file. nishi doesn't know vulkan at all
*/
#ifndef __MW_WIDGET_VULKAN_H__
#define __MW_WIDGET_VULKAN_H__
#if defined(MW_VULKAN) && !defined(_WIN32) && !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
#error Vulkan is unsupported on the requested platform.
#endif
#if !defined(MW_VULKAN_NO_INCLUDE)
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
#endif
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Vulkan widget class
*/
MWDECL MwClass MwVulkanClass;
/*!
* @brief Configuration options that can be passed to setup parts of the Vulkan widget.
*/
typedef struct _MwVulkanConfig {
/*!
* @brief Vulkan API version (default: VK_API_VERSION_1_0)
*/
MwU32 api_version;
/*!
* @brief Vulkan version (default: VK_VERSION_1_0)
*/
MwU32 vk_version;
/*!
* @brief Whether or not to enable validation layers (default: false)
*/
int validation_layers;
} MwVulkanConfig;
/*!
* @brief Field that can be gotten from Vulkan.
*/
enum MwVULKANFIELD {
/*!
* @brief The address of the vulkan widget's vkGetInstanceProcAddr function (PFN_vkGetInstanceProcAddr)
*/
MwVULKANFIELD_GETINSTANCEPROCADDR = 0,
/*!
* @brief The address of the vulkan widget's instance (VkInstance)
*/
MwVULKANFIELD_INSTANCE,
/*!
* @brief The address of the vulkan widget's surface (VkSurfaceKHR)
*/
MwVULKANFIELD_SURFACE,
/*!
* @brief The address of the vulkan widget's physical device (VkPhysicalDevice)
*/
MwVULKANFIELD_PHYSICALDEVICE,
/*!
* @brief The address of the vulkan widget's logical device (VkDevice)
*/
MwVULKANFIELD_LOGICALDEVICE,
/*!
* @brief The address of the index that the vulkan widget uses for the graphics queue (uint32_t *)
*/
MwVULKANFIELD_GRAPHICSQUEUEINDEX,
/*!
* @brief The address of the index that the vulkan widget uses for the present queue (uint32_t *)
*/
MwVULKANFIELD_PRESENTQUEUEINDEX,
MwVULKANFIELD_GRAPHICSQUEUE,
/*!
* @brief The address of the vulkan widget's graphics queue (VkQueue)
*/
MwVULKANFIELD_PRESENTQUEUE,
};
/*!
* @brief Function for getting a field from within Vulkan.
* @note Consult the documentation for MwVULKANFIELD to know what type is expected for output.
*/
MwInline void* MwVulkanGetField(MwWidget handle, int field, int* err) {
void* field_out;
MwVaWidgetExecute(handle, "mwVulkanGetField", &field_out, field, err);
return field_out;
}
/*!
* @brief Return whether Vulkan is installed on the target platform.
*/
MWDECL int MWAPI MwVulkanSupported(void);
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Vulkan.h
* @brief Vulkan widget
* @warning This header is not documented yet
*/
/**
* ioixd maintains this file. nishi doesn't know vulkan at all
*/
#ifndef __MW_WIDGET_VULKAN_H__
#define __MW_WIDGET_VULKAN_H__
#if defined(MW_VULKAN) && !defined(_WIN32) && !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
#error Vulkan is unsupported on the requested platform.
#endif
#if !defined(MW_VULKAN_NO_INCLUDE)
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
#endif
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Vulkan widget class
*/
MWDECL MwClass MwVulkanClass;
/*!
* @brief Configuration options that can be passed to setup parts of the Vulkan widget.
*/
typedef struct _MwVulkanConfig {
/*!
* @brief Vulkan API version (default: VK_API_VERSION_1_0)
*/
MwU32 api_version;
/*!
* @brief Vulkan version (default: VK_VERSION_1_0)
*/
MwU32 vk_version;
/*!
* @brief Whether or not to enable validation layers (default: false)
*/
int validation_layers;
} MwVulkanConfig;
/*!
* @brief Field that can be gotten from Vulkan.
*/
enum MwVULKANFIELD {
/*!
* @brief The address of the vulkan widget's vkGetInstanceProcAddr function (PFN_vkGetInstanceProcAddr)
*/
MwVULKANFIELD_GETINSTANCEPROCADDR = 0,
/*!
* @brief The address of the vulkan widget's instance (VkInstance)
*/
MwVULKANFIELD_INSTANCE,
/*!
* @brief The address of the vulkan widget's surface (VkSurfaceKHR)
*/
MwVULKANFIELD_SURFACE,
/*!
* @brief The address of the vulkan widget's physical device (VkPhysicalDevice)
*/
MwVULKANFIELD_PHYSICALDEVICE,
/*!
* @brief The address of the vulkan widget's logical device (VkDevice)
*/
MwVULKANFIELD_LOGICALDEVICE,
/*!
* @brief The address of the index that the vulkan widget uses for the graphics queue (uint32_t *)
*/
MwVULKANFIELD_GRAPHICSQUEUEINDEX,
/*!
* @brief The address of the index that the vulkan widget uses for the present queue (uint32_t *)
*/
MwVULKANFIELD_PRESENTQUEUEINDEX,
MwVULKANFIELD_GRAPHICSQUEUE,
/*!
* @brief The address of the vulkan widget's graphics queue (VkQueue)
*/
MwVULKANFIELD_PRESENTQUEUE,
};
/*!
* @brief Function for getting a field from within Vulkan.
* @note Consult the documentation for MwVULKANFIELD to know what type is expected for output.
*/
MwInline void* MwVulkanGetField(MwWidget handle, int field, int* err) {
void* field_out;
MwVaWidgetExecute(handle, "mwVulkanGetField", &field_out, field, err);
return field_out;
}
/*!
* @brief Return whether Vulkan is installed on the target platform.
*/
MWDECL int MWAPI MwVulkanSupported(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,34 +1,34 @@
/*!
* @file Mw/Widget/Window.h
* @brief Window widget
*/
#ifndef __MW_WIDGET_WINDOW_H__
#define __MW_WIDGET_WINDOW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Window widget class
*/
MWDECL MwClass MwWindowClass;
/*!
* @brief Makes window borderless
* @param handle Widget
* @param toggle Toggle
*/
MwInline void MwWindowMakeBorderless(MwWidget handle, int toggle) {
MwVaWidgetExecute(handle, "mwWindowMakeBorderless", NULL, toggle);
}
#ifdef __cplusplus
}
#endif
#endif
/*!
* @file Mw/Widget/Window.h
* @brief Window widget
*/
#ifndef __MW_WIDGET_WINDOW_H__
#define __MW_WIDGET_WINDOW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Window widget class
*/
MWDECL MwClass MwWindowClass;
/*!
* @brief Makes window borderless
* @param handle Widget
* @param toggle Toggle
*/
MwInline void MwWindowMakeBorderless(MwWidget handle, int toggle) {
MwVaWidgetExecute(handle, "mwWindowMakeBorderless", NULL, toggle);
}
#ifdef __cplusplus
}
#endif
#endif