And added uiControlOSVtable on Windows. We're now back to building everywhere! :D
This commit is contained in:
parent
80ada0a06b
commit
c17f854d04
|
@ -4,5 +4,9 @@
|
||||||
* [Initialization and the Main Loop](init-main.md)
|
* [Initialization and the Main Loop](init-main.md)
|
||||||
* [Event Handling](events.md)
|
* [Event Handling](events.md)
|
||||||
* [Controls](controls.md)
|
* [Controls](controls.md)
|
||||||
|
* Windows
|
||||||
|
** [Controls](windows-controls.md)
|
||||||
|
* Unix
|
||||||
|
** [Controls](unix-controls.md)
|
||||||
* macOS
|
* macOS
|
||||||
** [Controls](darwin-controls.md)
|
** [Controls](darwin-controls.md)
|
||||||
|
|
|
@ -23,4 +23,4 @@ You are responsible for allocating and initializing this struct. To do so, you s
|
||||||
|
|
||||||
Each method takes at least two parameters. The first, `c`, is the `uiControl` itself. The second, `implData`, is the implementation data pointer; it is the same as the pointer returned by `uiControlImplData(c)`, and is provided here as a convenience.
|
Each method takes at least two parameters. The first, `c`, is the `uiControl` itself. The second, `implData`, is the implementation data pointer; it is the same as the pointer returned by `uiControlImplData(c)`, and is provided here as a convenience.
|
||||||
|
|
||||||
Each method is named for the `uiDarwinControl` function that it implements. As such, details on how to implement these methods are documented alongside those functions. For instance, instructions on implementing `TODO()` are given under the documentation for `TOOD()`.
|
Each method is named for the `uiDarwinControl` function that it implements. As such, details on how to implement these methods are documented alongside those functions. For instance, instructions on implementing `TODO()` are given under the documentation for `TODO()`.
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!-- 10 june 2019 -->
|
||||||
|
|
||||||
|
# Controls on Unix systems other than macOS
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
|
||||||
|
### `uiControlOSVtable`
|
||||||
|
|
||||||
|
```c
|
||||||
|
typedef struct uiControlOSVtable uiControlOSVtable;
|
||||||
|
struct uiControlOSVtable {
|
||||||
|
size_t Size;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
`uiControlOSVtable` describes the set of functions that control implementations on Unix need to implement. When registering your control type, you pass this in as a parameter to `uiRegisterControlType()`. Each method here is required.
|
||||||
|
|
||||||
|
You are responsible for allocating and initializing this struct. To do so, you simply zero the memory for this struct and set its `Size` field to `sizeof (uiControlOSVtable)`. (TODO put this in a common place)
|
||||||
|
|
||||||
|
Each method takes at least two parameters. The first, `c`, is the `uiControl` itself. The second, `implData`, is the implementation data pointer; it is the same as the pointer returned by `uiControlImplData(c)`, and is provided here as a convenience.
|
||||||
|
|
||||||
|
Each method is named for the `uiUnixControl` function that it implements. As such, details on how to implement these methods are documented alongside those functions. For instance, instructions on implementing `TODO()` are given under the documentation for `TODO()`.
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!-- 10 june 2019 -->
|
||||||
|
|
||||||
|
# Controls on Windows
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
|
||||||
|
### `uiControlOSVtable`
|
||||||
|
|
||||||
|
```c
|
||||||
|
typedef struct uiControlOSVtable uiControlOSVtable;
|
||||||
|
struct uiControlOSVtable {
|
||||||
|
size_t Size;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
`uiControlOSVtable` describes the set of functions that control implementations on Windows need to implement. When registering your control type, you pass this in as a parameter to `uiRegisterControlType()`. Each method here is required.
|
||||||
|
|
||||||
|
You are responsible for allocating and initializing this struct. To do so, you simply zero the memory for this struct and set its `Size` field to `sizeof (uiControlOSVtable)`. (TODO put this in a common place)
|
||||||
|
|
||||||
|
Each method takes at least two parameters. The first, `c`, is the `uiControl` itself. The second, `implData`, is the implementation data pointer; it is the same as the pointer returned by `uiControlImplData(c)`, and is provided here as a convenience.
|
||||||
|
|
||||||
|
Each method is named for the `uiWindowsControl` function that it implements. As such, details on how to implement these methods are documented alongside those functions. For instance, instructions on implementing `TODO()` are given under the documentation for `TODO()`.
|
|
@ -0,0 +1,11 @@
|
||||||
|
// 10 june 2019
|
||||||
|
#include "test_windows.h"
|
||||||
|
|
||||||
|
static const uiControlOSVtable vtable = {
|
||||||
|
.Size = sizeof (uiControlOSVtable),
|
||||||
|
};
|
||||||
|
|
||||||
|
const uiControlOSVtable *testOSVtable(void)
|
||||||
|
{
|
||||||
|
return &vtable;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// 16 june 2019
|
||||||
|
#include "test_windows.h"
|
||||||
|
|
||||||
|
const struct checkErrorCase controlOSVtableCases[] = {
|
||||||
|
{
|
||||||
|
"uiRegisterControlType() with OS vtable with wrong size",
|
||||||
|
[](void) {
|
||||||
|
uiControlOSVtable vtable;
|
||||||
|
|
||||||
|
memset(&vtable, 0, sizeof (uiControlOSVtable));
|
||||||
|
vtable.Size = 1;
|
||||||
|
uiRegisterControlType("name", testVtable(), &vtable, 0);
|
||||||
|
},
|
||||||
|
"uiRegisterControlType(): wrong size 1 for uiControlOSVtable",
|
||||||
|
},
|
||||||
|
{ NULL, NULL, NULL },
|
||||||
|
};
|
|
@ -14,6 +14,7 @@ libui_test_sources = [
|
||||||
if libui_OS == 'windows'
|
if libui_OS == 'windows'
|
||||||
libui_test_sources += [
|
libui_test_sources += [
|
||||||
'controls_windows.c',
|
'controls_windows.c',
|
||||||
|
'controls_windows_errors.cpp',
|
||||||
]
|
]
|
||||||
elif libui_OS == 'darwin'
|
elif libui_OS == 'darwin'
|
||||||
libui_test_sources += [
|
libui_test_sources += [
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
// 10 june 2019
|
||||||
|
#define libuiOSHeader "../ui_windows.h"
|
||||||
|
#include "test.h"
|
|
@ -11,6 +11,10 @@ This file assumes that you have included <windows.h> and "ui.h" beforehand. It p
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct uiControlOSVtable {
|
||||||
|
size_t Size;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
// 8 june 2019
|
||||||
|
#include "uipriv_windows.hpp"
|
||||||
|
|
||||||
|
bool uiprivOSVtableValid(const uiControlOSVtable *osVtable, const char *func)
|
||||||
|
{
|
||||||
|
if (osVtable->Size != sizeof (uiControlOSVtable)) {
|
||||||
|
uiprivProgrammerErrorWrongStructSize(osVtable->Size, "uiControlOSVtable", func);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable)
|
||||||
|
{
|
||||||
|
uiControlOSVtable *v2;
|
||||||
|
|
||||||
|
v2 = uiprivNew(uiControlOSVtable);
|
||||||
|
*v2 = *osVtable;
|
||||||
|
return v2;
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
windows = import('windows')
|
windows = import('windows')
|
||||||
|
|
||||||
libui_sources += [
|
libui_sources += [
|
||||||
|
'windows/controls.cpp',
|
||||||
'windows/main.cpp',
|
'windows/main.cpp',
|
||||||
'windows/utilwin.cpp',
|
'windows/utilwin.cpp',
|
||||||
'windows/winhresult.cpp',
|
'windows/winhresult.cpp',
|
||||||
|
|
Loading…
Reference in New Issue