Milsko GUI Toolkit Documentation


Table of Contents

Mw/Button.h
MwButtonClass
Mw/Core.h
MwDispatch
MwCreateWidget
MwVaCreateWidget
MwVaListCreateWidget
MwDestroyWidget
MwLoop
MwStep
MwPending
MwSetInteger
MwSetText
MwSetVoid
MwGetInteger
MwGetText
MwGetVoid
MwSetDefault
MwVaApply
MwVaListApply
MwAddUserHandler
MwDispatchUserHandler
MwSetErrorHandler
MwDispatchError
MwGetBeforeStep
Mw/Default.h
MwDefaultBackground
MwDefaultForeground
Mw/Draw.h
MwParseColor
MwDrawRect
MwDrawFrame
MwDrawFrameEx
MwDrawText
MwLoadImage
MwTextWidth
MwTextHeight
Mw/Error.h
MwErrorEnum_T
MwEsuccess
MwEerror
MwGetLastError()
Mw/Font.h
MwFontData[]
MwBoldFontData[]
Mw/Frame.h
MwFrameClass
Mw/GDI.h
Mw/LowLevel.h
Mw/MachDep.h
Mw/Menu.h
MwMenuClass
MwMenuAdd
Mw/Milsko.h
Mw/OpenGL.h
MwOpenGLClass
MwOpenGLMakeCurrent
MwOpenGLGetProcAddress
MwOpenGLSwapBuffer
Mw/StringDefs.h
Mw/SubMenu.h
MwSubMenuClass
Mw/TypeDefs.h
Mw/Vulkan.h
MwVulkanClass
MwVulkanEnableExtension
MwVulkanEnableLayer
MwVulkanConfig_T
api_version
vk_version
validation_layers
MwVulkanConfigure
MwVulkanField_T
MwVulkanField_GetInstanceProcAddr
MwVulkanField_Instance
MwVulkanField_Surface
MwVulkanField_PhysicalDevice
MwVulkanField_LogicalDevice
MwVulkanField_GraphicsQueueIndex
MwVulkanField_PresentQueueIndex
MwVulkanField_PresentQueue
MwVulkanField
MwVulkanGetField
MwVulkanSupported
Mw/Window.h
MwWindowClass
Mw/X11.h

Mw/Button.h

Button widget.

MWDECL MwClass MwButtonClass;
Button widget class.

Mw/Core.h

Core.

#define MwDispatch(x, y)
Dispatches the handler of widget class.
warning
Used internally.
Parameter x
Widget.
Parameter y
Handler name.

MWDECL MwWidget MwCreateWidget (
	MwClass widget_class,
	const char* name,
	MwWidget parent,
	int x,
	int y,
	unsigned int width,
	unsigned int height
);
Creates a widget.
Parameter widget_class
Widget class.
Parameter name
Widget name.
Parameter parent
Parent widget or NULL.
Parameter x
X.
Parameter y
Y.
Parameter width
Width.
Parameter height
Height.
Returns
Widget.

MWDECL MwWidget MwVaCreateWidget (
	MwClass widget_class,
	const char* name,
	MwWidget parent,
	int x,
	int y,
	unsigned int width,
	unsigned int height,
	...
);
Creates a widget.
Parameter widget_class
Widget class.
Parameter name
Widget name.
Parameter parent
Parent widget or NULL.
Parameter x
X.
Parameter y
Y.
Parameter width
Width.
Parameter height
Height.
Parameter ...
Same with MwVaApply.
Returns
Widget.

MWDECL MwWidget MwVaListCreateWidget (
	MwClass widget_class,
	const char* name,
	MwWidget parent,
	int x,
	int y,
	unsigned int width,
	unsigned int height,
	va_list va
);
Creates a widget.
Parameter widget_class
Widget class.
Parameter name
Widget name.
Parameter parent
Parent widget or NULL.
Parameter x
X.
Parameter y
Y.
Parameter width
Width.
Parameter height
Height.
Parameter va
Same with MwVaListApply.
Returns
Widget.

MWDECL void MwDestroyWidget (
	MwWidget handle
);
Destroys the widget and its child widgets.
Parameter handle
Widget.

MWDECL void MwLoop (
	MwWidget handle
);
Runs the main loop.
Parameter handle
Widget.

MWDECL void MwStep (
	MwWidget handle
);
Runs the single step.
Parameter handle
Widget.

MWDECL int MwPending (
	MwWidget handle
);
Check if any event is pending.
Parameter handle
Widget.
Returns
1 if any event is pending.

MWDECL void MwSetInteger (
	MwWidget handle,
	const char* key,
	int n
);
Sets an integer property.
Parameter handle
Widget.
Parameter key
Key.
Parameter n
Value.

MWDECL void MwSetText (
	MwWidget handle,
	const char* key,
	const char* value
);
Sets a text property.
Parameter handle
Widget.
Parameter key
Key.
Parameter value
Value.

MWDECL void MwSetVoid (
	MwWidget handle,
	const char* key,
	void* value
);
Sets a void pointer property.
Parameter handle
Widget.
Parameter key
Key.
Parameter value
Value.

MWDECL int MwGetInteger (
	MwWidget handle,
	const char* key
);
Gets the integer property.
Parameter handle
Widget.
Parameter key
Key.
Returns
Value.

MWDECL const char* MwGetText (
	MwWidget handle,
	const char* key
);
Gets the text property.
Parameter handle
Widget.
Parameter key
Key.
Returns
Value.

MWDECL void* MwGetVoid (
	MwWidget handle,
	const char* key
);
Gets the void pointer property.
Parameter handle
Widget.
Parameter key
Key.
Returns
Value.

MWDECL void MwSetDefault (
	MwWidget handle
);
Sets the default property.
warning
This is called when widget is created.
Parameter handle
Widget.

MWDECL void MwVaApply (
	MwWidget handle,
	...
);
Sets the properties.
Parameter handle
Widget.
Parameter ...
Properties.

MWDECL void MwVaListApply (
	MwWidget handle,
	va_list va
);
Sets properties.
Parameter handle
Widget.
Parameter va
Properties.

MWDECL void MwAddUserHandler (
	MwWidget handle,
	const char* key,
	MwUserHandler handler,
	void* user_data
);
Sets a user handler.
Parameter handle
Widget.
Parameter key
Key.
Parameter handler
Handler.
Parameter user_data
User data passed to handler.

MWDECL void MwDispatchUserHandler (
	MwWidget handle,
	const char* key,
	void* handler_data
);
Dispatches the user handler.
Parameter handle
Widget.
Parameter key
Key.
Parameter handler_data
Handler data passed to handler.

MWDECL void MwSetErrorHandler (
	MwErrorHandler handler,
	void* user_data
);
Sets an error handler.
Parameter handle
Widget.
Parameter handler
Handler.
Parameter user_data
User data passed to handler.

MWDECL void MwDispatchError (
	int code,
	const char* message
);
Dispatches the error handler.
Parameter code
Error code.
Parameter message
Error message.

MWDECL void MwGetBeforeStep (
	MwWidget handle,
	jmp_buf* jmpbuf
);
Gets the before_step of widget.
Parameter handle
Widget.
Parameter jmpbuf
jmp_buf.

Mw/Default.h

Default properties.

MWDECL const char* MwDefaultBackground;
Default background color.

MWDECL const char* MwDefaultForeground;
Default foreground color.

Mw/Draw.h

Common drawing API.

MWDECL MwLLColor MwParseColor (
	MwWidget handle,
	const char* text
);
Parses a color text.
Parameter handle
Widget.
Parameter text
Color text.
Returns
Color.

MWDECL void MwDrawRect (
	MwWidget handle,
	MwRect* rect,
	MwLLColor color
);
Draws a filled rectangle.
Parameter handle
Widget.
Parameter rect
Rectangle area.
Parameter color
Color.

MWDECL void MwDrawFrame (
	MwWidget handle,
	MwRect* rect,
	MwLLColor color,
	int invert
);
Draws a frame.
warning
rect gets changed to the area of rectangle inside.
Parameter handle
Widget.
Parameter rect
Rectangle area.
Parameter color
Color.
Parameter invert
Invert the 3D border color or not.

MWDECL void MwDrawFrameEx (
	MwWidget handle,
	MwRect* rect,
	MwLLColor color,
	int invert,
	int border
);
Draws a frame with specified border width.
warning
rect gets changed to the area of rectangle inside.
Parameter handle
Widget.
Parameter rect
Rectangle area.
Parameter color
Color.
Parameter invert
Invert the 3D border color or not.
Parameter border
Border width.

MWDECL void MwDrawText (
	MwWidget handle,
	MwPoint* point,
	const char* text,
	int bold,
	MwLLColor color
);
Draws a text.
Parameter handle
Widget.
Parameter point
Center point of the text.
Parameter text
Text.
Parameter bold
Bold.
Parameter color
Color.

MWDECL MwLLPixmap MwLoadImage (
	MwWidget handle,
	const char* path
);
Creates a pixmap from image.
Parameter handle
Widget.
Parameter path
Path.
Returns
Pixmap.

MWDECL int MwTextWidth (
	MwWidget handle,
	const char* text
);
Calculates a text width.
Parameter handle
Widget.
Parameter text
Text.
Returns
Text width.

MWDECL int MwTextHeight (
	MwWidget handle,
	const char* text
);
Calculates a text height.
Parameter handle
Widget.
Parameter text
Text.
Returns
Text height.

Mw/Error.h

Error codes.

typedef enum MwErrorEnum_T;
Error code enumeration.

 MwEsuccess = 0
No error.

 MwEerror
There was an error.

MWDECL const char* MwGetLastError();
Get the last error.

Mw/Font.h

Default font.

MWDECL MwFont MwFontData[];
Default font data.

MWDECL MwFont MwBoldFontData[];
Default bold font data.

Mw/Frame.h

Frame widget.

MWDECL MwClass MwFrameClass;
Frame widget class.

Mw/GDI.h

GDI backend.
warning
This is used internally.

Mw/LowLevel.h

Low-level drawing API.
warning
This is used internally.

Mw/MachDep.h

Machine dependent headers and macros.

Mw/Menu.h

Menu widget.

MWDECL MwClass MwMenuClass;
Menu widget class.

MWDECL MwMenu MwMenuAdd (
	MwWidget handle,
	MwMenu menu,
	const char* name
);
Adds a menu.
Parameter handle
Widget.
Parameter menu
Menu.
Parameter name
Menu name.
Returns
Menu.

Mw/Milsko.h

Includes all headers.

Mw/OpenGL.h

OpenGL widget.

MWDECL MwClass MwOpenGLClass;
OpenGL widget class.

MWDECL void MwOpenGLMakeCurrent (
	MwWidget handle
);
Make a widget current OpenGL context.
Parameter handle
Widget.

MWDECL void* MwOpenGLGetProcAddress (
	MwWidget handle,
	const char* name
);
Get a procedure from OpenGL.
Parameter handle
Widget.
Parameter name
Name.
Returns
Procedure.

MWDECL void MwOpenGLSwapBuffer (
	MwWidget handle
);
Swaps the buffer of OpenGL context.
Parameter handle
Widget.

Mw/StringDefs.h

String definitions for property.

Mw/SubMenu.h

SubMenu widget.

MWDECL MwClass MwSubMenuClass;
SubMenu widget class.

Mw/TypeDefs.h

Type definitions.

Mw/Vulkan.h

Vulkan widget.
warning
This header is not documented yet.

MWDECL MwClass MwVulkanClass;
Vulkan widget class.

MWDECL void MwVulkanEnableExtension (
	const char* ext_name
);
Add an extension to the list of extensions to enable prior to initialization.
warning
This must be called before MwCreateWidget.

MWDECL void MwVulkanEnableLayer (
	const char* ext_name
);
Add an layer to the list of layers to enable prior to initialization.
warning
This must be called before MwCreateWidget.

typedef struct MwVulkanConfig_T;
Configuration options that can be passed to setup Vulkan before a widget is created.

 uint32_t api_version;
Vulkan API version (default: VK_API_VERSION_1_0).

 uint32_t vk_version;
Vulkan version (default: VK_VERSION_1_0).

 VkBool32 validation_layers;
Whether or not to enable validation layers (default: false).

MWDECL void MwVulkanConfigure (
	MwVulkanConfig cfg
);
Configure Vulkan prior to initializing the widget.
warning
The configuration provided will be used for future initializations of the Vulkan widget (unless it's changed).

typedef enum MwVulkanField_T;
Field that can be gotten from Vulkan.

 MwVulkanField_GetInstanceProcAddr = 0
The address of the vulkan widget's vkGetInstanceProcAddr function (PFN_vkGetInstanceProcAddr).

 MwVulkanField_Instance
The address of the vulkan widget's instance (VkInstance).

 MwVulkanField_Surface
The address of the vulkan widget's surface (VkSurfaceKHR).

 MwVulkanField_PhysicalDevice
The address of the vulkan widget's physical device (VkPhysicalDevice).

 MwVulkanField_LogicalDevice
The address of the vulkan widget's logical device (VkDevice).

 MwVulkanField_GraphicsQueueIndex
The address of the index that the vulkan widget uses for the graphics queue (uint32_t *).

 MwVulkanField_PresentQueueIndex
The address of the index that the vulkan widget uses for the present queue (uint32_t *).

 MwVulkanField_PresentQueue
The address of the vulkan widget's graphics queue (VkQueue).

} MwVulkanField;
The address of the vulkan widget's present queue (VkQueue).

MWDECL void* MwVulkanGetField (
	MwWidget handle,
	MwVulkanField field,
	MwErrorEnum* out
);
Function for getting a field from within Vulkan.
warning
Consult the documentation for MwVulkanField to know what type is expected for out.

MWDECL VkBool32 MwVulkanSupported (
	void
);
Return whether Vulkan is installed on the target platform.

Mw/Window.h

Window widget.

MWDECL MwClass MwWindowClass;
Window widget class.

Mw/X11.h

X11 backend.
warning
This is used internally.