More compiler error fixes. Warning fixes will come later.
This commit is contained in:
parent
e0a8c8ce60
commit
47aff78aae
41
ui.h
41
ui.h
|
@ -17,6 +17,10 @@ extern "C" {
|
||||||
#define _UI_EXTERN extern
|
#define _UI_EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// C++ is really really really really really really dumb about enums, so screw that and just make them anonymous
|
||||||
|
// This has the advantage of being ABI-able should we ever need an ABI...
|
||||||
|
#define _UI_ENUM(s) typedef unsigned int s; enum
|
||||||
|
|
||||||
typedef struct uiInitOptions uiInitOptions;
|
typedef struct uiInitOptions uiInitOptions;
|
||||||
|
|
||||||
struct uiInitOptions {
|
struct uiInitOptions {
|
||||||
|
@ -308,35 +312,34 @@ typedef struct uiDrawMatrix uiDrawMatrix;
|
||||||
|
|
||||||
typedef struct uiDrawBrushGradientStop uiDrawBrushGradientStop;
|
typedef struct uiDrawBrushGradientStop uiDrawBrushGradientStop;
|
||||||
|
|
||||||
// ISO C forbids us from forward declaring enums >:(
|
_UI_ENUM(uiDrawBrushType) {
|
||||||
typedef enum uiDrawBrushType {
|
|
||||||
uiDrawBrushTypeSolid,
|
uiDrawBrushTypeSolid,
|
||||||
uiDrawBrushTypeLinearGradient,
|
uiDrawBrushTypeLinearGradient,
|
||||||
uiDrawBrushTypeRadialGradient,
|
uiDrawBrushTypeRadialGradient,
|
||||||
uiDrawBrushTypeImage,
|
uiDrawBrushTypeImage,
|
||||||
} uiDrawBrushType;
|
};
|
||||||
|
|
||||||
typedef enum uiDrawLineCap {
|
_UI_ENUM(uiDrawLineCap) {
|
||||||
uiDrawLineCapFlat,
|
uiDrawLineCapFlat,
|
||||||
uiDrawLineCapRound,
|
uiDrawLineCapRound,
|
||||||
uiDrawLineCapSquare,
|
uiDrawLineCapSquare,
|
||||||
} uiDrawLineCap;
|
};
|
||||||
|
|
||||||
typedef enum uiDrawLineJoin {
|
_UI_ENUM(uiDrawLineJoin) {
|
||||||
uiDrawLineJoinMiter,
|
uiDrawLineJoinMiter,
|
||||||
uiDrawLineJoinRound,
|
uiDrawLineJoinRound,
|
||||||
uiDrawLineJoinBevel,
|
uiDrawLineJoinBevel,
|
||||||
} uiDrawLineJoin;
|
};
|
||||||
|
|
||||||
// this is the default for botoh cairo and Direct2D (in the latter case, from the C++ helper functions)
|
// this is the default for botoh cairo and Direct2D (in the latter case, from the C++ helper functions)
|
||||||
// Core Graphics doesn't explicitly specify a default, but NSBezierPath allows you to choose one, and this is the initial value
|
// Core Graphics doesn't explicitly specify a default, but NSBezierPath allows you to choose one, and this is the initial value
|
||||||
// so we're good to use it too!
|
// so we're good to use it too!
|
||||||
#define uiDrawDefaultMiterLimit 10.0
|
#define uiDrawDefaultMiterLimit 10.0
|
||||||
|
|
||||||
typedef enum uiDrawFillMode {
|
_UI_ENUM(uiDrawFillMode) {
|
||||||
uiDrawFillModeWinding,
|
uiDrawFillModeWinding,
|
||||||
uiDrawFillModeAlternate,
|
uiDrawFillModeAlternate,
|
||||||
} uiDrawFillMode;
|
};
|
||||||
|
|
||||||
struct uiDrawMatrix {
|
struct uiDrawMatrix {
|
||||||
double M11;
|
double M11;
|
||||||
|
@ -458,7 +461,7 @@ typedef struct uiDrawTextFont uiDrawTextFont;
|
||||||
typedef struct uiDrawTextFontDescriptor uiDrawTextFontDescriptor;
|
typedef struct uiDrawTextFontDescriptor uiDrawTextFontDescriptor;
|
||||||
typedef struct uiDrawTextFontMetrics uiDrawTextFontMetrics;
|
typedef struct uiDrawTextFontMetrics uiDrawTextFontMetrics;
|
||||||
|
|
||||||
typedef enum uiDrawTextWeight {
|
_UI_ENUM(uiDrawTextWeight) {
|
||||||
uiDrawTextWeightThin,
|
uiDrawTextWeightThin,
|
||||||
uiDrawTextWeightUltraLight,
|
uiDrawTextWeightUltraLight,
|
||||||
uiDrawTextWeightLight,
|
uiDrawTextWeightLight,
|
||||||
|
@ -470,15 +473,15 @@ typedef enum uiDrawTextWeight {
|
||||||
uiDrawTextWeightUtraBold,
|
uiDrawTextWeightUtraBold,
|
||||||
uiDrawTextWeightHeavy,
|
uiDrawTextWeightHeavy,
|
||||||
uiDrawTextWeightUltraHeavy,
|
uiDrawTextWeightUltraHeavy,
|
||||||
} uiDrawTextWeight;
|
};
|
||||||
|
|
||||||
typedef enum uiDrawTextItalic {
|
_UI_ENUM(uiDrawTextItalic) {
|
||||||
uiDrawTextItalicNormal,
|
uiDrawTextItalicNormal,
|
||||||
uiDrawTextItalicOblique,
|
uiDrawTextItalicOblique,
|
||||||
uiDrawTextItalicItalic,
|
uiDrawTextItalicItalic,
|
||||||
} uiDrawTextItalic;
|
};
|
||||||
|
|
||||||
typedef enum uiDrawTextStretch {
|
_UI_ENUM(uiDrawTextStretch) {
|
||||||
uiDrawTextStretchUltraCondensed,
|
uiDrawTextStretchUltraCondensed,
|
||||||
uiDrawTextStretchExtraCondensed,
|
uiDrawTextStretchExtraCondensed,
|
||||||
uiDrawTextStretchCondensed,
|
uiDrawTextStretchCondensed,
|
||||||
|
@ -488,7 +491,7 @@ typedef enum uiDrawTextStretch {
|
||||||
uiDrawTextStretchExpanded,
|
uiDrawTextStretchExpanded,
|
||||||
uiDrawTextStretchExtraExpanded,
|
uiDrawTextStretchExtraExpanded,
|
||||||
uiDrawTextStretchUltraExpanded,
|
uiDrawTextStretchUltraExpanded,
|
||||||
} uiDrawTextStretch;
|
};
|
||||||
|
|
||||||
struct uiDrawTextFontDescriptor {
|
struct uiDrawTextFontDescriptor {
|
||||||
const char *Family;
|
const char *Family;
|
||||||
|
@ -527,12 +530,12 @@ _UI_EXTERN void uiDrawTextLayoutSetColor(uiDrawTextLayout *layout, intmax_t star
|
||||||
|
|
||||||
_UI_EXTERN void uiDrawText(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout);
|
_UI_EXTERN void uiDrawText(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout);
|
||||||
|
|
||||||
typedef enum uiModifiers {
|
_UI_ENUM(uiModifiers) {
|
||||||
uiModifierCtrl = 1 << 0,
|
uiModifierCtrl = 1 << 0,
|
||||||
uiModifierAlt = 1 << 1,
|
uiModifierAlt = 1 << 1,
|
||||||
uiModifierShift = 1 << 2,
|
uiModifierShift = 1 << 2,
|
||||||
uiModifierSuper = 1 << 3,
|
uiModifierSuper = 1 << 3,
|
||||||
} uiModifiers;
|
};
|
||||||
|
|
||||||
// TODO document drag captures
|
// TODO document drag captures
|
||||||
struct uiAreaMouseEvent {
|
struct uiAreaMouseEvent {
|
||||||
|
@ -554,7 +557,7 @@ struct uiAreaMouseEvent {
|
||||||
uint64_t Held1To64;
|
uint64_t Held1To64;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum uiExtKey {
|
_UI_ENUM(uiExtKey) {
|
||||||
uiExtKeyEscape = 1,
|
uiExtKeyEscape = 1,
|
||||||
uiExtKeyInsert, // equivalent to "Help" on Apple keyboards
|
uiExtKeyInsert, // equivalent to "Help" on Apple keyboards
|
||||||
uiExtKeyDelete,
|
uiExtKeyDelete,
|
||||||
|
@ -594,7 +597,7 @@ typedef enum uiExtKey {
|
||||||
uiExtKeyNSubtract,
|
uiExtKeyNSubtract,
|
||||||
uiExtKeyNMultiply,
|
uiExtKeyNMultiply,
|
||||||
uiExtKeyNDivide,
|
uiExtKeyNDivide,
|
||||||
} uiExtKey;
|
};
|
||||||
|
|
||||||
struct uiAreaKeyEvent {
|
struct uiAreaKeyEvent {
|
||||||
char Key;
|
char Key;
|
||||||
|
|
|
@ -124,7 +124,7 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
|
||||||
intmax_t minimumWidth, minimumHeight;
|
intmax_t minimumWidth, minimumHeight;
|
||||||
uiWindowsSizing *d;
|
uiWindowsSizing *d;
|
||||||
|
|
||||||
uiWindowsEnsureMoveWindow(b->hwnd, x, y, width, height);
|
uiWindowsEnsureMoveWindowDuringResize(b->hwnd, x, y, width, height);
|
||||||
|
|
||||||
if (b->controls->len == 0)
|
if (b->controls->len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -95,7 +95,7 @@ void childRelayout(struct child *c, intmax_t x, intmax_t y, intmax_t width, intm
|
||||||
intmax_t left, top, right, bottom;
|
intmax_t left, top, right, bottom;
|
||||||
|
|
||||||
if (c->tabpage != NULL) {
|
if (c->tabpage != NULL) {
|
||||||
uiWindowsEnsureMoveWindow(c->tabpage, x, y, width, height);
|
uiWindowsEnsureMoveWindowDuringResize(c->tabpage, x, y, width, height);
|
||||||
x = 0; // and make relative to the client rect of the tab page
|
x = 0; // and make relative to the client rect of the tab page
|
||||||
y = 0;
|
y = 0;
|
||||||
if (c->margined) {
|
if (c->margined) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ ATOM initContainer(HICON hDefaultIcon, HCURSOR hDefaultCursor)
|
||||||
void uninitContainer(void)
|
void uninitContainer(void)
|
||||||
{
|
{
|
||||||
if (UnregisterClassW(containerClass, hInstance) == 0)
|
if (UnregisterClassW(containerClass, hInstance) == 0)
|
||||||
logLastError("error unregistering container window class in uninitContainer()");
|
logLastError(L"error unregistering container window class");
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND newContainer(void)
|
HWND newContainer(void)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 16 august 2015
|
// 16 august 2015
|
||||||
#include "uipriv_windows.h"
|
#include "uipriv_windows.hpp"
|
||||||
|
|
||||||
HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, HINSTANCE hInstance, LPVOID lpParam, BOOL useStandardControlFont)
|
HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, HINSTANCE hInstance, LPVOID lpParam, BOOL useStandardControlFont)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCW
|
||||||
100, 100,
|
100, 100,
|
||||||
utilWindow, NULL, hInstance, lpParam);
|
utilWindow, NULL, hInstance, lpParam);
|
||||||
if (hwnd == NULL) {
|
if (hwnd == NULL) {
|
||||||
logLastError("error creating window");
|
logLastError(L"error creating window");
|
||||||
// TODO return a decoy window
|
// TODO return a decoy window
|
||||||
}
|
}
|
||||||
if (useStandardControlFont)
|
if (useStandardControlFont)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 25 february 2015
|
// 25 february 2015
|
||||||
#include "uipriv_windows.h"
|
#include "uipriv_windows.hpp"
|
||||||
|
|
||||||
// TODO disable logging and stopping on no-debug builds
|
// TODO disable logging and stopping on no-debug builds
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 9 april 2015
|
// 9 april 2015
|
||||||
#include "uipriv_windows.h"
|
#include "uipriv_windows.hpp"
|
||||||
|
|
||||||
WCHAR *windowTextAndLen(HWND hwnd, LRESULT *len)
|
WCHAR *windowTextAndLen(HWND hwnd, LRESULT *len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 6 april 2015
|
// 6 april 2015
|
||||||
#include "uipriv_windows.h"
|
#include "uipriv_windows.hpp"
|
||||||
|
|
||||||
// this is a helper function that takes the logic of determining window classes and puts it all in one place
|
// this is a helper function that takes the logic of determining window classes and puts it all in one place
|
||||||
// there are a number of places where we need to know what window class an arbitrary handle has
|
// there are a number of places where we need to know what window class an arbitrary handle has
|
||||||
|
|
Loading…
Reference in New Issue