mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-06 09:29:44 +00:00
merge generic_func_idea from git
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@433 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,7 +1,9 @@
|
||||
*.o
|
||||
*.so
|
||||
examples/example
|
||||
examples/image
|
||||
examples/opengl
|
||||
examples/rotate
|
||||
examples/vulkan
|
||||
examples/*
|
||||
examples/*.exe
|
||||
examples/*/*
|
||||
examples/*/*.exe
|
||||
!examples/*/
|
||||
!examples/*.*
|
||||
!examples/*/*.*
|
||||
|
||||
138
doc/index.html
138
doc/index.html
@@ -77,6 +77,12 @@
|
||||
<dd>
|
||||
<a href="#Mw_Core_h__MwDestroyWidget">MwDestroyWidget</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Core_h__MwWidgetExecute">MwWidgetExecute</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Core_h__MwVaWidgetExecute">MwVaWidgetExecute</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Core_h__MwLoop">MwLoop</a>
|
||||
</dd>
|
||||
@@ -267,7 +273,7 @@
|
||||
<a href="#Mw_Error_h__MwGetLastError">MwGetLastError</a>
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="#Mw_FileChoose_h">Mw/FileChoose.h</a>
|
||||
<a href="#Mw_FileChooser_h">Mw/FileChooser.h</a>
|
||||
</dt>
|
||||
<dt>
|
||||
<a href="#Mw_Font_h">Mw/Font.h</a>
|
||||
@@ -377,6 +383,18 @@
|
||||
<dd>
|
||||
<a href="#Mw_Unicode_h__MwUTF32ToUTF8">MwUTF32ToUTF8</a>
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="#Mw_Version_h">Mw/Version.h</a>
|
||||
</dt>
|
||||
<dd>
|
||||
<a href="#Mw_Version_h__MwMAJOR">MwMAJOR</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Version_h__MwMINOR">MwMINOR</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Version_h__MwVERSION">MwVERSION</a>
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="#Mw_Widget_Button_h">Mw/Widget/Button.h</a>
|
||||
</dt>
|
||||
@@ -979,6 +997,60 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Core_h__MwWidgetExecute">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwWidgetExecute</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* func_name,
|
||||
<B><FONT COLOR="#228B22">void</FONT></B>* out,
|
||||
...
|
||||
);</pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Executes a method specific to the widget (varadic version).
|
||||
</dd>
|
||||
<dt>
|
||||
<table border="0"><tr><td><img src="warning.gif" alt="warning"></td><td>Prefer using corresponding functions for better code clarity and type safety.</td></table>
|
||||
</dt>
|
||||
<dt>
|
||||
Parameter <code>handle</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>...</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget function arguments.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Core_h__MwVaWidgetExecute">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwVaWidgetExecute</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* func_name,
|
||||
<B><FONT COLOR="#228B22">void</FONT></B>* out,
|
||||
va_list va
|
||||
);</pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Executes a method specific to the widget (va_list version).
|
||||
</dd>
|
||||
<dt>
|
||||
<table border="0"><tr><td><img src="warning.gif" alt="warning"></td><td>Prefer using corresponding functions for better code clarity and type safety.</td></table>
|
||||
</dt>
|
||||
<dt>
|
||||
Parameter <code>handle</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>va</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget function arguments.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Core_h__MwLoop">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwLoop</FONT></B> (
|
||||
MwWidget handle
|
||||
);</pre>
|
||||
@@ -2257,7 +2329,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<h2 align="center" id="Mw_FileChoose_h">Mw/FileChoose.h</h2>
|
||||
<h2 align="center" id="Mw_FileChooser_h">Mw/FileChooser.h</h2>
|
||||
<dl>
|
||||
<dt>
|
||||
File chooser.
|
||||
@@ -2680,6 +2752,34 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<h2 align="center" id="Mw_Version_h">Mw/Version.h</h2>
|
||||
<dl>
|
||||
<dt>
|
||||
Version informations.
|
||||
</dt>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Version_h__MwMAJOR">#<B><FONT COLOR="#5F9EA0">define</FONT></B> <FONT COLOR="#B8860B">MwMAJOR</FONT> 0</pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Major version.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Version_h__MwMINOR">#<B><FONT COLOR="#5F9EA0">define</FONT></B> <FONT COLOR="#B8860B">MwMINOR</FONT> 0</pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Minor version.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Version_h__MwVERSION">#<B><FONT COLOR="#5F9EA0">define</FONT></B> <FONT COLOR="#B8860B">MwVERSION</FONT> <B><FONT COLOR="#BC8F8F">"pre-1.0"</FONT></B></pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Version in string.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<h2 align="center" id="Mw_Widget_Button_h">Mw/Widget/Button.h</h2>
|
||||
<dl>
|
||||
<dt>
|
||||
@@ -2778,7 +2878,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxInsert">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxInsert</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxInsert"><B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxInsert</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index,
|
||||
MwLLPixmap pixmap,
|
||||
@@ -2814,7 +2914,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxInsertMultiple">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxInsertMultiple</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxInsertMultiple"><B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxInsertMultiple</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> count,
|
||||
@@ -2857,7 +2957,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxVaInsert">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxVaInsert</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxVaInsert"><B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxVaInsert</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index,
|
||||
MwLLPixmap pixmap,
|
||||
@@ -2893,7 +2993,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxVaInsertMultiple">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxVaInsertMultiple</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxVaInsertMultiple"><B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxVaInsertMultiple</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> count,
|
||||
@@ -2936,7 +3036,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxDelete">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxDelete</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxDelete">MwInline <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxDelete</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index
|
||||
);</pre>
|
||||
@@ -2958,7 +3058,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxGet">MWDECL <B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* <B><FONT COLOR="#0000FF">MwListBoxGet</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxGet">MwInline <B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* <B><FONT COLOR="#0000FF">MwListBoxGet</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index
|
||||
);</pre>
|
||||
@@ -2986,7 +3086,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxSetWidth">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxSetWidth</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxSetWidth">MwInline <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxSetWidth</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> width
|
||||
@@ -3015,7 +3115,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxReset">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxReset</FONT></B> (
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxReset">MwInline <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxReset</FONT></B> (
|
||||
MwWidget handle
|
||||
);</pre>
|
||||
<dl>
|
||||
@@ -3044,7 +3144,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_Menu_h__MwMenuAdd">MWDECL MwMenu <B><FONT COLOR="#0000FF">MwMenuAdd</FONT></B> (
|
||||
<pre id="Mw_Widget_Menu_h__MwMenuAdd">MwInline MwMenu <B><FONT COLOR="#0000FF">MwMenuAdd</FONT></B> (
|
||||
MwWidget handle,
|
||||
MwMenu menu,
|
||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* name
|
||||
@@ -3107,7 +3207,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_OpenGL_h__MwOpenGLMakeCurrent">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwOpenGLMakeCurrent</FONT></B> (
|
||||
<pre id="Mw_Widget_OpenGL_h__MwOpenGLMakeCurrent">MwInline <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwOpenGLMakeCurrent</FONT></B> (
|
||||
MwWidget handle
|
||||
);</pre>
|
||||
<dl>
|
||||
@@ -3122,7 +3222,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_OpenGL_h__MwOpenGLGetProcAddress">MWDECL <B><FONT COLOR="#228B22">void</FONT></B>* <B><FONT COLOR="#0000FF">MwOpenGLGetProcAddress</FONT></B> (
|
||||
<pre id="Mw_Widget_OpenGL_h__MwOpenGLGetProcAddress">MwInline <B><FONT COLOR="#228B22">void</FONT></B>* <B><FONT COLOR="#0000FF">MwOpenGLGetProcAddress</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* name
|
||||
);</pre>
|
||||
@@ -3150,7 +3250,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_OpenGL_h__MwOpenGLSwapBuffer">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwOpenGLSwapBuffer</FONT></B> (
|
||||
<pre id="Mw_Widget_OpenGL_h__MwOpenGLSwapBuffer">MwInline <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwOpenGLSwapBuffer</FONT></B> (
|
||||
MwWidget handle
|
||||
);</pre>
|
||||
<dl>
|
||||
@@ -3179,7 +3279,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ScrollBar_h__MwScrollBarGetVisibleLength">MWDECL <B><FONT COLOR="#228B22">int</FONT></B> <B><FONT COLOR="#0000FF">MwScrollBarGetVisibleLength</FONT></B> (
|
||||
<pre id="Mw_Widget_ScrollBar_h__MwScrollBarGetVisibleLength">MwInline <B><FONT COLOR="#228B22">int</FONT></B> <B><FONT COLOR="#0000FF">MwScrollBarGetVisibleLength</FONT></B> (
|
||||
MwWidget handle
|
||||
);</pre>
|
||||
<dl>
|
||||
@@ -3228,7 +3328,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_Viewport_h__MwViewportGetViewport">MWDECL MwWidget <B><FONT COLOR="#0000FF">MwViewportGetViewport</FONT></B> (
|
||||
<pre id="Mw_Widget_Viewport_h__MwViewportGetViewport">MwInline MwWidget <B><FONT COLOR="#0000FF">MwViewportGetViewport</FONT></B> (
|
||||
MwWidget handle
|
||||
);</pre>
|
||||
<dl>
|
||||
@@ -3249,7 +3349,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_Viewport_h__MwViewportSetSize">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwViewportSetSize</FONT></B> (
|
||||
<pre id="Mw_Widget_Viewport_h__MwViewportSetSize">MwInline <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwViewportSetSize</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> w,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> h
|
||||
@@ -3422,7 +3522,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_Vulkan_h__MwVulkanGetField">MWDECL <B><FONT COLOR="#228B22">void</FONT></B>* <B><FONT COLOR="#0000FF">MwVulkanGetField</FONT></B> (
|
||||
<pre id="Mw_Widget_Vulkan_h__MwVulkanGetField">MwInline <B><FONT COLOR="#228B22">void</FONT></B>* <B><FONT COLOR="#0000FF">MwVulkanGetField</FONT></B> (
|
||||
MwWidget handle,
|
||||
MwVulkanField field,
|
||||
MwErrorEnum* out
|
||||
@@ -3459,7 +3559,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_Window_h__MwWindowMakeBorderless">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwWindowMakeBorderless</FONT></B> (
|
||||
<pre id="Mw_Widget_Window_h__MwWindowMakeBorderless">MwInline <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwWindowMakeBorderless</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> toggle
|
||||
);</pre>
|
||||
|
||||
@@ -91,6 +91,22 @@ MWDECL MwWidget MwVaListCreateWidget(MwClass widget_class, const char* name, MwW
|
||||
*/
|
||||
MWDECL void 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 MwWidgetExecute(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 MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va);
|
||||
|
||||
/*!
|
||||
* %brief Runs the main loop
|
||||
* %param handle Widget
|
||||
|
||||
@@ -39,4 +39,6 @@
|
||||
#define MWDECL extern
|
||||
#endif
|
||||
|
||||
#define MwInline __inline
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,7 @@ typedef void (*MwHandler4)(MwWidget handle, int key);
|
||||
typedef void (*MwHandler5)(MwWidget handle, void* ptr);
|
||||
typedef void (*MwUserHandler)(MwWidget handle, void* user_data, void* call_data);
|
||||
typedef void (*MwErrorHandler)(int code, const char* message, void* user_data);
|
||||
typedef void (*MwHandlerExecute)(MwWidget handle, const char* name, void* out, va_list args);
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L || __GNUC__ > 2
|
||||
typedef unsigned long long MwOffset;
|
||||
@@ -184,7 +185,7 @@ struct _MwClass {
|
||||
MwHandler5 mouse_up;
|
||||
MwHandler5 mouse_down;
|
||||
MwHandler4 key;
|
||||
void* reserved1;
|
||||
MwHandlerExecute execute;
|
||||
void* reserved2;
|
||||
void* reserved3;
|
||||
void* reserved4;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -26,7 +27,7 @@ MWDECL MwClass MwListBoxClass;
|
||||
* %param pixmap Pixmap
|
||||
* %param ... Text
|
||||
*/
|
||||
MWDECL void MwListBoxInsert(MwWidget handle, int index, MwLLPixmap pixmap, ...); /* VA_HINT:pixmap */
|
||||
void MwListBoxInsert(MwWidget handle, int index, MwLLPixmap pixmap, ...); /* VA_HINT:pixmap */
|
||||
|
||||
/*!
|
||||
* %brief Inserts multiple items on the listbox
|
||||
@@ -36,7 +37,7 @@ MWDECL void MwListBoxInsert(MwWidget handle, int index, MwLLPixmap pixmap, ...);
|
||||
* %param pixmap Pixmap
|
||||
* %param ... Text
|
||||
*/
|
||||
MWDECL void MwListBoxInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, ...); /* VA_HINT:pixmap */
|
||||
void MwListBoxInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, ...); /* VA_HINT:pixmap */
|
||||
|
||||
/*!
|
||||
* %brief Inserts item on the listbox
|
||||
@@ -45,7 +46,7 @@ MWDECL void MwListBoxInsertMultiple(MwWidget handle, int index, int count, MwLLP
|
||||
* %param pixmap Pixmap
|
||||
* %param va Text
|
||||
*/
|
||||
MWDECL void MwListBoxVaInsert(MwWidget handle, int index, MwLLPixmap pixmap, va_list va);
|
||||
void MwListBoxVaInsert(MwWidget handle, int index, MwLLPixmap pixmap, va_list va);
|
||||
|
||||
/*!
|
||||
* %brief Inserts multiple items on the listbox
|
||||
@@ -55,14 +56,16 @@ MWDECL void MwListBoxVaInsert(MwWidget handle, int index, MwLLPixmap pixmap, va_
|
||||
* %param pixmap Pixmap
|
||||
* %param va Text
|
||||
*/
|
||||
MWDECL void MwListBoxVaInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, va_list va);
|
||||
void MwListBoxVaInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, va_list va);
|
||||
|
||||
/*!
|
||||
* %brief Deletes item from the listbox
|
||||
* %param handle Widget
|
||||
* %param index Index
|
||||
*/
|
||||
MWDECL void MwListBoxDelete(MwWidget handle, int index);
|
||||
MwInline void MwListBoxDelete(MwWidget handle, int index) {
|
||||
MwWidgetExecute(handle, "mwListboxDelete", NULL, index);
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Gets item from the listbox
|
||||
@@ -70,7 +73,11 @@ MWDECL void MwListBoxDelete(MwWidget handle, int index);
|
||||
* %param index Index
|
||||
* %return Item
|
||||
*/
|
||||
MWDECL const char* MwListBoxGet(MwWidget handle, int index);
|
||||
MwInline const char* MwListBoxGet(MwWidget handle, int index) {
|
||||
const char* out;
|
||||
MwWidgetExecute(handle, "mwListBoxGet", &out, index);
|
||||
return out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Sets an item width of the listbox
|
||||
@@ -78,13 +85,17 @@ MWDECL const char* MwListBoxGet(MwWidget handle, int index);
|
||||
* %param index Column index
|
||||
* %param width Width
|
||||
*/
|
||||
MWDECL void MwListBoxSetWidth(MwWidget handle, int index, int width);
|
||||
MwInline void MwListBoxSetWidth(MwWidget handle, int index, int width) {
|
||||
MwWidgetExecute(handle, "mwListBoxSetWidth", NULL, index, width);
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Resets the listbox
|
||||
* %param handle Widget
|
||||
*/
|
||||
MWDECL void MwListBoxReset(MwWidget handle);
|
||||
MwInline void MwListBoxReset(MwWidget handle) {
|
||||
MwWidgetExecute(handle, "mwListBoxReset", NULL, handle);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -25,7 +26,11 @@ MWDECL MwClass MwMenuClass;
|
||||
* %param name Menu name
|
||||
* %return Menu
|
||||
*/
|
||||
MWDECL MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name);
|
||||
MwInline MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
|
||||
MwMenu out;
|
||||
MwWidgetExecute(handle, "mwMenuAdd", &out, menu, name);
|
||||
return out;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
@@ -33,7 +34,9 @@ MWDECL MwClass MwOpenGLClass;
|
||||
* %brief Make a widget current OpenGL context
|
||||
* %param handle Widget
|
||||
*/
|
||||
MWDECL void MwOpenGLMakeCurrent(MwWidget handle);
|
||||
MwInline void MwOpenGLMakeCurrent(MwWidget handle) {
|
||||
MwWidgetExecute(handle, "mwOpenGLMakeCurrent", NULL);
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Get a procedure from OpenGL
|
||||
@@ -41,13 +44,19 @@ MWDECL void MwOpenGLMakeCurrent(MwWidget handle);
|
||||
* %param name Name
|
||||
* %return Procedure
|
||||
*/
|
||||
MWDECL void* MwOpenGLGetProcAddress(MwWidget handle, const char* name);
|
||||
MwInline void* MwOpenGLGetProcAddress(MwWidget handle, const char* name) {
|
||||
void* out;
|
||||
MwWidgetExecute(handle, "mwOpenGLGetProcAddress", &out, name);
|
||||
return out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Swaps the buffer of OpenGL context
|
||||
* %param handle Widget
|
||||
*/
|
||||
MWDECL void MwOpenGLSwapBuffer(MwWidget handle);
|
||||
MwInline void MwOpenGLSwapBuffer(MwWidget handle) {
|
||||
MwWidgetExecute(handle, "mwOpenGLSwapBuffer", NULL);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -24,7 +25,11 @@ MWDECL MwClass MwScrollBarClass;
|
||||
* %param handle Widget
|
||||
* %return Visible length
|
||||
*/
|
||||
MWDECL int MwScrollBarGetVisibleLength(MwWidget handle);
|
||||
MwInline int MwScrollBarGetVisibleLength(MwWidget handle) {
|
||||
int out;
|
||||
MwWidgetExecute(handle, "mwScrollBarGetVisibleLength", &out, NULL);
|
||||
return out;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -18,7 +19,9 @@ extern "C" {
|
||||
*/
|
||||
MWDECL MwClass MwSubMenuClass;
|
||||
|
||||
MWDECL void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point);
|
||||
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
|
||||
MwWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -23,7 +24,11 @@ MWDECL MwClass MwViewportClass;
|
||||
* %param handle Widget
|
||||
* %return Widget
|
||||
*/
|
||||
MWDECL MwWidget MwViewportGetViewport(MwWidget handle);
|
||||
MwInline MwWidget MwViewportGetViewport(MwWidget handle) {
|
||||
MwWidget out;
|
||||
MwWidgetExecute(handle, "mwViewportGetViewport", &out);
|
||||
return out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Set viewport size
|
||||
@@ -31,7 +36,9 @@ MWDECL MwWidget MwViewportGetViewport(MwWidget handle);
|
||||
* %param w Width
|
||||
* %param h Height
|
||||
*/
|
||||
MWDECL void MwViewportSetSize(MwWidget handle, int w, int h);
|
||||
MwInline void MwViewportSetSize(MwWidget handle, int w, int h) {
|
||||
MwWidgetExecute(handle, "mwViewportSetSize", NULL, w, h);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
#include <Mw/Error.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -112,7 +113,11 @@ typedef enum MwVulkanField_T {
|
||||
* %brief Function for getting a field from within Vulkan.
|
||||
* %warning Consult the documentation for MwVulkanField to know what type is expected for out.
|
||||
*/
|
||||
MWDECL void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out);
|
||||
MwInline void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
|
||||
void* field_out;
|
||||
MwWidgetExecute(handle, "mwVulkanGetField", &field_out, field, out);
|
||||
return field_out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Return whether Vulkan is installed on the target platform.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -24,7 +25,9 @@ MWDECL MwClass MwWindowClass;
|
||||
* %param handle Widget
|
||||
* %param toggle Toggle
|
||||
*/
|
||||
MWDECL void MwWindowMakeBorderless(MwWidget handle, int toggle);
|
||||
MwInline void MwWindowMakeBorderless(MwWidget handle, int toggle) {
|
||||
MwWidgetExecute(handle, "mwWindowMakeBorderless", NULL, toggle);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
13
src/core.c
13
src/core.c
@@ -230,6 +230,19 @@ void MwDestroyWidget(MwWidget handle) {
|
||||
handle->destroyed = 1;
|
||||
}
|
||||
|
||||
void MwWidgetExecute(MwWidget handle, const char* func_name, void* out, ...) {
|
||||
va_list args;
|
||||
va_start(args, out);
|
||||
va_end(args);
|
||||
MwVaWidgetExecute(handle, func_name, out, args);
|
||||
}
|
||||
|
||||
void MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va) {
|
||||
if(handle->widget_class->execute != NULL) {
|
||||
handle->widget_class->execute(handle, func_name, out, va);
|
||||
}
|
||||
}
|
||||
|
||||
static void clean_destroy_queue(MwWidget handle) {
|
||||
int i, j;
|
||||
for(i = 0; i < arrlen(handle->destroy_queue); i++) {
|
||||
|
||||
@@ -76,7 +76,7 @@ MwClassRec MwButtonClassRec = {
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -48,7 +48,7 @@ MwClassRec MwCheckBoxClassRec = {
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -134,7 +134,7 @@ MwClassRec MwEntryClassRec = {
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
key, /* key */
|
||||
NULL,
|
||||
NULL, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -51,7 +51,7 @@ MwClassRec MwFrameClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -39,7 +39,7 @@ MwClassRec MwImageClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -56,7 +56,7 @@ MwClassRec MwLabelClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -312,24 +312,6 @@ static void prop_change(MwWidget handle, const char* prop) {
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwListBoxClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwListBoxClass = &MwListBoxClassRec;
|
||||
|
||||
void MwListBoxVaInsert(MwWidget handle, int index, MwLLPixmap pixmap, va_list va) {
|
||||
MwListBox lb = handle->internal;
|
||||
MwListBoxEntry entry;
|
||||
@@ -392,7 +374,7 @@ void MwListBoxVaInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap
|
||||
}
|
||||
}
|
||||
|
||||
void MwListBoxDelete(MwWidget handle, int index) {
|
||||
static void mwListBoxDeleteImpl(MwWidget handle, int index) {
|
||||
MwListBox lb = handle->internal;
|
||||
int i;
|
||||
|
||||
@@ -416,7 +398,7 @@ void MwListBoxDelete(MwWidget handle, int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void MwListBoxReset(MwWidget handle) {
|
||||
static void mwListBoxResetImpl(MwWidget handle) {
|
||||
MwListBox lb = handle->internal;
|
||||
int i;
|
||||
|
||||
@@ -448,7 +430,7 @@ void MwListBoxInsert(MwWidget handle, int index, MwLLPixmap pixmap, ...) {
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
const char* MwListBoxGet(MwWidget handle, int index) {
|
||||
static const char* mwListBoxGetImpl(MwWidget handle, int index) {
|
||||
MwListBox lb = handle->internal;
|
||||
|
||||
if(index < 0) return NULL;
|
||||
@@ -457,7 +439,7 @@ const char* MwListBoxGet(MwWidget handle, int index) {
|
||||
return lb->list[index].name[0];
|
||||
}
|
||||
|
||||
void MwListBoxSetWidth(MwWidget handle, int index, int width) {
|
||||
static void mwListBoxSetWidthImpl(MwWidget handle, int index, int width) {
|
||||
MwListBox lb = handle->internal;
|
||||
|
||||
while(((index + 1) - arrlen(lb->width)) > 0) arrput(lb->width, 0);
|
||||
@@ -467,3 +449,42 @@ void MwListBoxSetWidth(MwWidget handle, int index, int width) {
|
||||
MwForceRender(handle);
|
||||
MwForceRender(lb->frame);
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
(void)out;
|
||||
|
||||
if(strcmp(name, "mwListBoxDelete") == 0) {
|
||||
int index = va_arg(va, int);
|
||||
mwListBoxDeleteImpl(handle, index);
|
||||
}
|
||||
if(strcmp(name, "mwListBoxReset") == 0) {
|
||||
mwListBoxResetImpl(handle);
|
||||
}
|
||||
if(strcmp(name, "mwListBoxGet") == 0) {
|
||||
int index = va_arg(va, int);
|
||||
mwListBoxGetImpl(handle, index);
|
||||
}
|
||||
if(strcmp(name, "mwListBoxSetWidth") == 0) {
|
||||
int index = va_arg(va, int);
|
||||
int width = va_arg(va, int);
|
||||
mwListBoxSetWidthImpl(handle, index, width);
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwListBoxClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwListBoxClass = &MwListBoxClassRec;
|
||||
|
||||
@@ -172,25 +172,7 @@ static void mouse_up(MwWidget handle, void* ptr) {
|
||||
MwForceRender(handle);
|
||||
}
|
||||
|
||||
MwClassRec MwMenuClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
parent_resize, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
mouse_up, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwMenuClass = &MwMenuClassRec;
|
||||
|
||||
MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
|
||||
static MwMenu mwMenuAddImpl(MwWidget handle, MwMenu menu, const char* name) {
|
||||
MwMenu m = menu == NULL ? handle->internal : menu;
|
||||
MwMenu new = malloc(sizeof(*new));
|
||||
new->name = MwStringDupliacte(name);
|
||||
@@ -204,3 +186,29 @@ MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
if(strcmp(name, "mwMenuAdd") == 0) {
|
||||
MwMenu menu = va_arg(va, MwMenu);
|
||||
const char* name = va_arg(va, const char*);
|
||||
*(MwMenu*)out = mwMenuAddImpl(handle, menu, name);
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwMenuClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
parent_resize, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
mouse_up, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwMenuClass = &MwMenuClassRec;
|
||||
|
||||
@@ -141,7 +141,7 @@ MwClassRec MwNumberEntryClassRec = {
|
||||
mouse_up, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
key, /* key */
|
||||
NULL,
|
||||
NULL, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -126,6 +126,48 @@ static void destroy(MwWidget handle) {
|
||||
free(o);
|
||||
}
|
||||
|
||||
static void mwOpenGLMakeCurrentImpl(MwWidget handle) {
|
||||
opengl_t* o = (opengl_t*)handle->internal;
|
||||
#ifdef _WIN32
|
||||
o->wglMakeCurrent(o->dc, o->gl);
|
||||
#else
|
||||
o->glXMakeCurrent(handle->lowlevel->display, handle->lowlevel->window, o->gl);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mwOpenGLSwapBufferImpl(MwWidget handle) {
|
||||
opengl_t* o = (opengl_t*)handle->internal;
|
||||
#ifdef _WIN32
|
||||
SwapBuffers(o->dc);
|
||||
#else
|
||||
(void)o;
|
||||
|
||||
o->glXSwapBuffers(handle->lowlevel->display, handle->lowlevel->window);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void* mwOpenGLGetProcAddressImpl(MwWidget handle, const char* name) {
|
||||
opengl_t* o = (opengl_t*)handle->internal;
|
||||
#ifdef _WIN32
|
||||
return o->wglGetProcAddress(name);
|
||||
#else
|
||||
return o->glXGetProcAddress((const GLubyte*)name);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
if(strcmp(name, "mwOpenGLMakeCurrent") == 0) {
|
||||
mwOpenGLMakeCurrentImpl(handle);
|
||||
}
|
||||
if(strcmp(name, "mwOpenGLSwapBuffer") == 0) {
|
||||
mwOpenGLSwapBufferImpl(handle);
|
||||
}
|
||||
if(strcmp(name, "mwOpenGLGetProcAddress") == 0) {
|
||||
const char* _name = va_arg(va, const char*);
|
||||
*(void**)out = mwOpenGLGetProcAddressImpl(handle, _name);
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwOpenGLClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
@@ -137,38 +179,9 @@ MwClassRec MwOpenGLClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwOpenGLClass = &MwOpenGLClassRec;
|
||||
|
||||
void MwOpenGLMakeCurrent(MwWidget handle) {
|
||||
opengl_t* o = (opengl_t*)handle->internal;
|
||||
#ifdef _WIN32
|
||||
o->wglMakeCurrent(o->dc, o->gl);
|
||||
#else
|
||||
o->glXMakeCurrent(handle->lowlevel->display, handle->lowlevel->window, o->gl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MwOpenGLSwapBuffer(MwWidget handle) {
|
||||
opengl_t* o = (opengl_t*)handle->internal;
|
||||
#ifdef _WIN32
|
||||
SwapBuffers(o->dc);
|
||||
#else
|
||||
(void)o;
|
||||
|
||||
o->glXSwapBuffers(handle->lowlevel->display, handle->lowlevel->window);
|
||||
#endif
|
||||
}
|
||||
|
||||
void* MwOpenGLGetProcAddress(MwWidget handle, const char* name) {
|
||||
opengl_t* o = (opengl_t*)handle->internal;
|
||||
#ifdef _WIN32
|
||||
return o->wglGetProcAddress(name);
|
||||
#else
|
||||
return o->glXGetProcAddress((const GLubyte*)name);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -219,25 +219,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwScrollBarClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
mouse_move, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwScrollBarClass = &MwScrollBarClassRec;
|
||||
|
||||
int MwScrollBarGetVisibleLength(MwWidget handle) {
|
||||
static int mwScrollBarGetVisibleLengthImpl(MwWidget handle) {
|
||||
int ww = MwGetInteger(handle, MwNwidth);
|
||||
int wh = MwGetInteger(handle, MwNheight);
|
||||
int or = MwGetInteger(handle, MwNorientation);
|
||||
@@ -253,3 +235,29 @@ int MwScrollBarGetVisibleLength(MwWidget handle) {
|
||||
}
|
||||
return s - tri - MwDefaultBorderWidth * 2;
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
(void)va;
|
||||
|
||||
if(strcmp(name, "mwScrollBarGetVisibleLength") == 0) {
|
||||
*(int*)out = mwScrollBarGetVisibleLengthImpl(handle);
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwScrollBarClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
mouse_move, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwScrollBarClass = &MwScrollBarClassRec;
|
||||
|
||||
@@ -146,25 +146,7 @@ static void click(MwWidget handle) {
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwSubMenuClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwSubMenuClass = &MwSubMenuClassRec;
|
||||
|
||||
void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
|
||||
static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) {
|
||||
int i, w = 0, h = 0;
|
||||
#ifdef UNIX
|
||||
XSetWindowAttributes xswa;
|
||||
@@ -204,3 +186,31 @@ void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
|
||||
MwNheight, h,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
(void)out;
|
||||
|
||||
if(strcmp(name, "mwSubMenuAppear") == 0) {
|
||||
MwMenu menu = va_arg(va, MwMenu);
|
||||
MwPoint* point = va_arg(va, MwPoint*);
|
||||
mwSubMenuAppearImpl(handle, menu, point);
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwSubMenuClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwSubMenuClass = &MwSubMenuClassRec;
|
||||
|
||||
@@ -118,6 +118,34 @@ static void prop_change(MwWidget handle, const char* prop) {
|
||||
if(strcmp(prop, MwNwidth) == 0 || strcmp(prop, MwNheight) == 0) resize(handle);
|
||||
}
|
||||
|
||||
static MwWidget mwViewportGetViewportImpl(MwWidget handle) {
|
||||
MwViewport vp = handle->internal;
|
||||
|
||||
return vp->inframe;
|
||||
}
|
||||
|
||||
static void mwViewportSetSizeImpl(MwWidget handle, int w, int h) {
|
||||
MwViewport vp = handle->internal;
|
||||
|
||||
MwVaApply(vp->inframe,
|
||||
MwNwidth, w,
|
||||
MwNheight, h,
|
||||
NULL);
|
||||
|
||||
resize(handle);
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
if(strcmp(name, "mwViewportGetViewport") == 0) {
|
||||
*(MwWidget*)out = mwViewportGetViewportImpl(handle);
|
||||
}
|
||||
if(strcmp(name, "mwViewportSetSize") == 0) {
|
||||
int w = va_arg(va, int);
|
||||
int h = va_arg(va, int);
|
||||
mwViewportSetSizeImpl(handle, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
MwClassRec MwViewportClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
@@ -129,26 +157,9 @@ MwClassRec MwViewportClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwViewportClass = &MwViewportClassRec;
|
||||
|
||||
MwWidget MwViewportGetViewport(MwWidget handle) {
|
||||
MwViewport vp = handle->internal;
|
||||
|
||||
return vp->inframe;
|
||||
}
|
||||
|
||||
void MwViewportSetSize(MwWidget handle, int w, int h) {
|
||||
MwViewport vp = handle->internal;
|
||||
|
||||
MwVaApply(vp->inframe,
|
||||
MwNwidth, w,
|
||||
MwNheight, h,
|
||||
NULL);
|
||||
|
||||
resize(handle);
|
||||
}
|
||||
|
||||
@@ -452,7 +452,25 @@ void MwVulkanEnableExtension(const char* name) {
|
||||
void MwVulkanEnableLayer(const char* name) {
|
||||
arrput(enabledLayers, name);
|
||||
}
|
||||
void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
|
||||
|
||||
VkBool32 MwVulkanSupported(void) {
|
||||
if(vulkan_supported == VULKAN_SUPPORTED_UNKNOWN) {
|
||||
LIB_TYPE lib = vulkan_lib_load();
|
||||
if(lib == NULL) {
|
||||
vulkan_supported = VULKAN_SUPPORTED_NO;
|
||||
} else {
|
||||
vulkan_supported = VULKAN_SUPPORTED_YES;
|
||||
LIB_CLOSE(lib);
|
||||
}
|
||||
}
|
||||
if(vulkan_supported == VULKAN_SUPPORTED_YES) {
|
||||
return VK_TRUE;
|
||||
} else {
|
||||
return VK_FALSE;
|
||||
}
|
||||
};
|
||||
|
||||
static void* mwVulkanGetFieldImpl(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
|
||||
vulkan_t* o = handle->internal;
|
||||
|
||||
switch(field) {
|
||||
@@ -486,22 +504,13 @@ void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
|
||||
}
|
||||
};
|
||||
|
||||
VkBool32 MwVulkanSupported(void) {
|
||||
if(vulkan_supported == VULKAN_SUPPORTED_UNKNOWN) {
|
||||
LIB_TYPE lib = vulkan_lib_load();
|
||||
if(lib == NULL) {
|
||||
vulkan_supported = VULKAN_SUPPORTED_NO;
|
||||
} else {
|
||||
vulkan_supported = VULKAN_SUPPORTED_YES;
|
||||
LIB_CLOSE(lib);
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
if(strcmp(name, "mwVulkanGetField") == 0) {
|
||||
MwVulkanField field = va_arg(va, MwVulkanField);
|
||||
MwErrorEnum* err = va_arg(va, MwErrorEnum*);
|
||||
*(void**)out = mwVulkanGetFieldImpl(handle, field, err);
|
||||
}
|
||||
}
|
||||
if(vulkan_supported == VULKAN_SUPPORTED_YES) {
|
||||
return VK_TRUE;
|
||||
} else {
|
||||
return VK_FALSE;
|
||||
}
|
||||
};
|
||||
|
||||
MwClassRec MwVulkanClassRec = {
|
||||
create, /* create */
|
||||
@@ -514,7 +523,7 @@ MwClassRec MwVulkanClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -20,7 +20,18 @@ static void draw(MwWidget handle) {
|
||||
|
||||
MwLLFreeColor(c);
|
||||
}
|
||||
static void mwWindowMakeBorderlessImpl(MwWidget handle, int toggle) {
|
||||
MwLLMakeBorderless(handle->lowlevel, toggle);
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
(void)out;
|
||||
|
||||
if(strcmp(name, "mwWindowMakeBorderless") == 0) {
|
||||
int toggle = va_arg(va, int);
|
||||
mwWindowMakeBorderlessImpl(handle, toggle);
|
||||
}
|
||||
}
|
||||
MwClassRec MwWindowClassRec = {
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
@@ -32,17 +43,9 @@ MwClassRec MwWindowClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
func_handler, /* custom */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwWindowClass = &MwWindowClassRec;
|
||||
|
||||
void MwWindowSetIcon(MwWidget handle, MwLLPixmap pixmap) {
|
||||
MwLLSetIcon(handle->lowlevel, pixmap);
|
||||
}
|
||||
|
||||
void MwWindowMakeBorderless(MwWidget handle, int toggle) {
|
||||
MwLLMakeBorderless(handle->lowlevel, toggle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user