More compiler error fixes. Warning fixes will come later.

This commit is contained in:
Pietro Gagliardi 2016-04-23 21:38:51 -04:00
parent e0a8c8ce60
commit 47aff78aae
8 changed files with 30 additions and 27 deletions

41
ui.h
View File

@ -17,6 +17,10 @@ extern "C" {
#define _UI_EXTERN extern
#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;
struct uiInitOptions {
@ -308,35 +312,34 @@ typedef struct uiDrawMatrix uiDrawMatrix;
typedef struct uiDrawBrushGradientStop uiDrawBrushGradientStop;
// ISO C forbids us from forward declaring enums >:(
typedef enum uiDrawBrushType {
_UI_ENUM(uiDrawBrushType) {
uiDrawBrushTypeSolid,
uiDrawBrushTypeLinearGradient,
uiDrawBrushTypeRadialGradient,
uiDrawBrushTypeImage,
} uiDrawBrushType;
};
typedef enum uiDrawLineCap {
_UI_ENUM(uiDrawLineCap) {
uiDrawLineCapFlat,
uiDrawLineCapRound,
uiDrawLineCapSquare,
} uiDrawLineCap;
};
typedef enum uiDrawLineJoin {
_UI_ENUM(uiDrawLineJoin) {
uiDrawLineJoinMiter,
uiDrawLineJoinRound,
uiDrawLineJoinBevel,
} uiDrawLineJoin;
};
// 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
// so we're good to use it too!
#define uiDrawDefaultMiterLimit 10.0
typedef enum uiDrawFillMode {
_UI_ENUM(uiDrawFillMode) {
uiDrawFillModeWinding,
uiDrawFillModeAlternate,
} uiDrawFillMode;
};
struct uiDrawMatrix {
double M11;
@ -458,7 +461,7 @@ typedef struct uiDrawTextFont uiDrawTextFont;
typedef struct uiDrawTextFontDescriptor uiDrawTextFontDescriptor;
typedef struct uiDrawTextFontMetrics uiDrawTextFontMetrics;
typedef enum uiDrawTextWeight {
_UI_ENUM(uiDrawTextWeight) {
uiDrawTextWeightThin,
uiDrawTextWeightUltraLight,
uiDrawTextWeightLight,
@ -470,15 +473,15 @@ typedef enum uiDrawTextWeight {
uiDrawTextWeightUtraBold,
uiDrawTextWeightHeavy,
uiDrawTextWeightUltraHeavy,
} uiDrawTextWeight;
};
typedef enum uiDrawTextItalic {
_UI_ENUM(uiDrawTextItalic) {
uiDrawTextItalicNormal,
uiDrawTextItalicOblique,
uiDrawTextItalicItalic,
} uiDrawTextItalic;
};
typedef enum uiDrawTextStretch {
_UI_ENUM(uiDrawTextStretch) {
uiDrawTextStretchUltraCondensed,
uiDrawTextStretchExtraCondensed,
uiDrawTextStretchCondensed,
@ -488,7 +491,7 @@ typedef enum uiDrawTextStretch {
uiDrawTextStretchExpanded,
uiDrawTextStretchExtraExpanded,
uiDrawTextStretchUltraExpanded,
} uiDrawTextStretch;
};
struct uiDrawTextFontDescriptor {
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);
typedef enum uiModifiers {
_UI_ENUM(uiModifiers) {
uiModifierCtrl = 1 << 0,
uiModifierAlt = 1 << 1,
uiModifierShift = 1 << 2,
uiModifierSuper = 1 << 3,
} uiModifiers;
};
// TODO document drag captures
struct uiAreaMouseEvent {
@ -554,7 +557,7 @@ struct uiAreaMouseEvent {
uint64_t Held1To64;
};
typedef enum uiExtKey {
_UI_ENUM(uiExtKey) {
uiExtKeyEscape = 1,
uiExtKeyInsert, // equivalent to "Help" on Apple keyboards
uiExtKeyDelete,
@ -594,7 +597,7 @@ typedef enum uiExtKey {
uiExtKeyNSubtract,
uiExtKeyNMultiply,
uiExtKeyNDivide,
} uiExtKey;
};
struct uiAreaKeyEvent {
char Key;

View File

@ -124,7 +124,7 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
intmax_t minimumWidth, minimumHeight;
uiWindowsSizing *d;
uiWindowsEnsureMoveWindow(b->hwnd, x, y, width, height);
uiWindowsEnsureMoveWindowDuringResize(b->hwnd, x, y, width, height);
if (b->controls->len == 0)
return;

View File

@ -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;
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
y = 0;
if (c->margined) {

View File

@ -60,7 +60,7 @@ ATOM initContainer(HICON hDefaultIcon, HCURSOR hDefaultCursor)
void uninitContainer(void)
{
if (UnregisterClassW(containerClass, hInstance) == 0)
logLastError("error unregistering container window class in uninitContainer()");
logLastError(L"error unregistering container window class");
}
HWND newContainer(void)

View File

@ -1,5 +1,5 @@
// 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)
{
@ -16,7 +16,7 @@ HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCW
100, 100,
utilWindow, NULL, hInstance, lpParam);
if (hwnd == NULL) {
logLastError("error creating window");
logLastError(L"error creating window");
// TODO return a decoy window
}
if (useStandardControlFont)

View File

@ -1,5 +1,5 @@
// 25 february 2015
#include "uipriv_windows.h"
#include "uipriv_windows.hpp"
// TODO disable logging and stopping on no-debug builds

View File

@ -1,5 +1,5 @@
// 9 april 2015
#include "uipriv_windows.h"
#include "uipriv_windows.hpp"
WCHAR *windowTextAndLen(HWND hwnd, LRESULT *len)
{

View File

@ -1,5 +1,5 @@
// 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
// there are a number of places where we need to know what window class an arbitrary handle has