Fixed some build errors.
This commit is contained in:
parent
f5824d74e9
commit
65cc67e0e1
31
redo/box.c
31
redo/box.c
|
@ -1,5 +1,5 @@
|
||||||
// 7 april 2015
|
// 7 april 2015
|
||||||
#include "ui.h"
|
#include "out/ui.h"
|
||||||
#include "uipriv.h"
|
#include "uipriv.h"
|
||||||
|
|
||||||
struct box {
|
struct box {
|
||||||
|
@ -7,8 +7,8 @@ struct box {
|
||||||
void (*baseDestroy)(uiControl *);
|
void (*baseDestroy)(uiControl *);
|
||||||
struct ptrArray *controls;
|
struct ptrArray *controls;
|
||||||
int vertical;
|
int vertical;
|
||||||
void (*baseSetParent)(uiControl *, uiContainer *);
|
void (*baseSetParent)(uiControl *, uiControl *);
|
||||||
uiContainer *parent;
|
uiControl *parent;
|
||||||
int padded;
|
int padded;
|
||||||
void (*baseResize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *);
|
void (*baseResize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *);
|
||||||
};
|
};
|
||||||
|
@ -41,14 +41,7 @@ static void boxDestroy(uiControl *c)
|
||||||
uiFree(b);
|
uiFree(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uiControl *boxParent(uiControl *c)
|
static void boxSetParent(uiControl *c, uiControl *parent)
|
||||||
{
|
|
||||||
struct box *b = (struct box *) c;
|
|
||||||
|
|
||||||
return b->parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void boxSetParent(uiControl *c, uiContainer *parent)
|
|
||||||
{
|
{
|
||||||
struct box *b = (struct box *) c;
|
struct box *b = (struct box *) c;
|
||||||
|
|
||||||
|
@ -97,7 +90,7 @@ static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
||||||
maxStretchyHeight = 0;
|
maxStretchyHeight = 0;
|
||||||
for (i = 0; i < b->controls->len; i++) {
|
for (i = 0; i < b->controls->len; i++) {
|
||||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||||
if (!uiControlVisible(bc->c))
|
if (!uiControlContainerVisible(bc->c))
|
||||||
continue;
|
continue;
|
||||||
uiControlPreferredSize(bc->c, d, &preferredWidth, &preferredHeight);
|
uiControlPreferredSize(bc->c, d, &preferredWidth, &preferredHeight);
|
||||||
if (bc->stretchy) {
|
if (bc->stretchy) {
|
||||||
|
@ -127,7 +120,7 @@ static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
||||||
*width += nStretchy * maxStretchyWidth;
|
*width += nStretchy * maxStretchyWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void boxResize(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
|
static void boxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
|
||||||
{
|
{
|
||||||
struct box *b = (struct box *) c;
|
struct box *b = (struct box *) c;
|
||||||
struct boxControl *bc;
|
struct boxControl *bc;
|
||||||
|
@ -164,7 +157,7 @@ static void boxResize(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, in
|
||||||
nStretchy = 0;
|
nStretchy = 0;
|
||||||
for (i = 0; i < b->controls->len; i++) {
|
for (i = 0; i < b->controls->len; i++) {
|
||||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||||
if (!uiControlVisible(bc->c))
|
if (!uiControlContainerVisible(bc->c))
|
||||||
continue;
|
continue;
|
||||||
if (bc->stretchy) {
|
if (bc->stretchy) {
|
||||||
nStretchy++;
|
nStretchy++;
|
||||||
|
@ -190,7 +183,7 @@ static void boxResize(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, in
|
||||||
stretchywid /= nStretchy;
|
stretchywid /= nStretchy;
|
||||||
for (i = 0; i < b->controls->len; i++) {
|
for (i = 0; i < b->controls->len; i++) {
|
||||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||||
if (!uiControlVisible(bc->c))
|
if (!uiControlContainerVisible(bc->c))
|
||||||
continue;
|
continue;
|
||||||
if (bc->stretchy) {
|
if (bc->stretchy) {
|
||||||
bc->width = stretchywid;
|
bc->width = stretchywid;
|
||||||
|
@ -201,7 +194,7 @@ static void boxResize(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, in
|
||||||
// 3) now we can position controls
|
// 3) now we can position controls
|
||||||
for (i = 0; i < b->controls->len; i++) {
|
for (i = 0; i < b->controls->len; i++) {
|
||||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||||
if (!uiControlVisible(bc->c))
|
if (!uiControlContainerVisible(bc->c))
|
||||||
continue;
|
continue;
|
||||||
uiControlResize(bc->c, x, y, bc->width, bc->height, d);
|
uiControlResize(bc->c, x, y, bc->width, bc->height, d);
|
||||||
if (b->vertical)
|
if (b->vertical)
|
||||||
|
@ -231,7 +224,7 @@ static void boxAppend(uiBox *ss, uiControl *c, int stretchy)
|
||||||
bc = uiNew(struct boxControl);
|
bc = uiNew(struct boxControl);
|
||||||
bc->c = c;
|
bc->c = c;
|
||||||
bc->stretchy = stretchy;
|
bc->stretchy = stretchy;
|
||||||
uiControlSetParent(bc->c, uiContainer(b));
|
uiControlSetParent(bc->c, uiControl(b));
|
||||||
ptrArrayAppend(b->controls, bc);
|
ptrArrayAppend(b->controls, bc);
|
||||||
uiControlQueueResize(uiControl(b));
|
uiControlQueueResize(uiControl(b));
|
||||||
}
|
}
|
||||||
|
@ -273,7 +266,7 @@ uiBox *uiNewHorizontalBox(void)
|
||||||
|
|
||||||
b = uiNew(struct box);
|
b = uiNew(struct box);
|
||||||
|
|
||||||
uiMakeContainer(uiContainer(b));
|
uiMakeContainer(uiControl(b));
|
||||||
|
|
||||||
b->controls = newPtrArray();
|
b->controls = newPtrArray();
|
||||||
|
|
||||||
|
@ -282,7 +275,7 @@ uiBox *uiNewHorizontalBox(void)
|
||||||
b->baseSetParent = uiControl(b)->SetParent;
|
b->baseSetParent = uiControl(b)->SetParent;
|
||||||
uiControl(b)->SetParent = boxSetParent;
|
uiControl(b)->SetParent = boxSetParent;
|
||||||
uiControl(b)->PreferredSize = boxPreferredSize;
|
uiControl(b)->PreferredSize = boxPreferredSize;
|
||||||
b->baseResize = uiControl(b)->Resize
|
b->baseResize = uiControl(b)->Resize;
|
||||||
uiControl(b)->Resize = boxResize;
|
uiControl(b)->Resize = boxResize;
|
||||||
uiControl(b)->SysFunc = boxSysFunc;
|
uiControl(b)->SysFunc = boxSysFunc;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// 5 may 2015
|
// 5 may 2015
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ui.h"
|
#include "out/ui.h"
|
||||||
#include "uipriv.h"
|
#include "uipriv.h"
|
||||||
|
|
||||||
struct ptrArray *newPtrArray(void)
|
struct ptrArray *newPtrArray(void)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 9 may 2015
|
// 9 may 2015
|
||||||
#include "ui.h"
|
#include "out/ui.h"
|
||||||
#include "uipriv.h"
|
#include "uipriv.h"
|
||||||
|
|
||||||
static int defaultOnShouldQuit(void *data)
|
static int defaultOnShouldQuit(void *data)
|
||||||
|
|
|
@ -82,7 +82,7 @@ interface Button from Control {
|
||||||
};
|
};
|
||||||
func NewButton(text *const char) *Button;
|
func NewButton(text *const char) *Button;
|
||||||
|
|
||||||
interface Box from Container {
|
interface Box from Control {
|
||||||
func Append(c *Control, stretchy int);
|
func Append(c *Control, stretchy int);
|
||||||
func Delete(index uintmax_t);
|
func Delete(index uintmax_t);
|
||||||
func Padded(void) int;
|
func Padded(void) int;
|
||||||
|
|
|
@ -10,13 +10,6 @@ extern void uiFree(void *);
|
||||||
|
|
||||||
extern void complain(const char *, ...);
|
extern void complain(const char *, ...);
|
||||||
|
|
||||||
extern uiBin *newBin(void);
|
|
||||||
extern int binHasOSParent(uiBin *);
|
|
||||||
extern void binSetOSParent(uiBin *, uintptr_t);
|
|
||||||
extern void binRemoveOSParent(uiBin *);
|
|
||||||
extern void binResizeRootAndUpdate(uiBin *, intmax_t, intmax_t, intmax_t, intmax_t);
|
|
||||||
extern void binTranslateMargins(uiBin *, intmax_t *, intmax_t *, intmax_t *, intmax_t *, uiSizing *);
|
|
||||||
|
|
||||||
// array.c
|
// array.c
|
||||||
struct ptrArray {
|
struct ptrArray {
|
||||||
void **ptrs;
|
void **ptrs;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
// Code for containers. uiMakeContainer() creates a singleHWND of this window class.
|
// Code for containers. uiMakeContainer() creates a singleHWND of this window class.
|
||||||
|
|
||||||
#define containerClass L"libui_uiContainerClass"}
|
#define containerClass L"libui_uiContainerClass"
|
||||||
|
|
||||||
static LRESULT CALLBACK containerWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK containerWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -54,12 +54,12 @@ 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 uiContainer window class in uninitContainer()");
|
logLastError("error unregistering container window class in uninitContainer()");
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
||||||
{
|
{
|
||||||
return FALSE
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
|
static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
|
||||||
|
@ -86,7 +86,7 @@ static void containerComputeChildSize(uiControl *c, intmax_t *x, intmax_t *y, in
|
||||||
*height = r.bottom - r.top;
|
*height = r.bottom - r.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiMakeContainer(uiContainer *c)
|
void uiMakeContainer(uiControl *c)
|
||||||
{
|
{
|
||||||
uiWindowsMakeControlParams p;
|
uiWindowsMakeControlParams p;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ struct singleHWND {
|
||||||
BOOL (*onWM_NOTIFY)(uiControl *, NMHDR *, LRESULT *);
|
BOOL (*onWM_NOTIFY)(uiControl *, NMHDR *, LRESULT *);
|
||||||
void (*onDestroy)(void *);
|
void (*onDestroy)(void *);
|
||||||
void *onDestroyData;
|
void *onDestroyData;
|
||||||
uiContainer *parent;
|
uiControl *parent;
|
||||||
int userHidden;
|
int userHidden;
|
||||||
int containerHidden;
|
int containerHidden;
|
||||||
int userDisabled;
|
int userDisabled;
|
||||||
|
@ -40,10 +40,10 @@ static uiControl *singleParent(uiControl *c)
|
||||||
return s->parent;
|
return s->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void singleSetParent(uiControl *c, uiContainer *parent)
|
static void singleSetParent(uiControl *c, uiControl *parent)
|
||||||
{
|
{
|
||||||
struct singleHWND *s = (struct singleHWND *) (c->Internal);
|
struct singleHWND *s = (struct singleHWND *) (c->Internal);
|
||||||
uiContainer *oldparent;
|
uiControl *oldparent;
|
||||||
HWND newParentHWND;
|
HWND newParentHWND;
|
||||||
|
|
||||||
oldparent = s->parent;
|
oldparent = s->parent;
|
||||||
|
@ -67,7 +67,7 @@ static void singleQueueResize(uiControl *c)
|
||||||
queueResize(c);
|
queueResize(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void singleGetSIzing(uiControl *c, uiSizing *d)
|
static void singleGetSizing(uiControl *c, uiSizing *d)
|
||||||
{
|
{
|
||||||
uiWindowsGetSizing(c, d);
|
uiWindowsGetSizing(c, d);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ static void singleShow(uiControl *c)
|
||||||
if (!s->containerHidden)
|
if (!s->containerHidden)
|
||||||
ShowWindow(s->hwnd, SW_SHOW);
|
ShowWindow(s->hwnd, SW_SHOW);
|
||||||
if (s->parent != NULL)
|
if (s->parent != NULL)
|
||||||
uiContainerUpdate(s->parent);
|
uiControlQueueResize(s->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void singleHide(uiControl *c)
|
static void singleHide(uiControl *c)
|
||||||
|
@ -102,7 +102,7 @@ static void singleHide(uiControl *c)
|
||||||
s->userHidden = 1;
|
s->userHidden = 1;
|
||||||
ShowWindow(s->hwnd, SW_HIDE);
|
ShowWindow(s->hwnd, SW_HIDE);
|
||||||
if (s->parent != NULL)
|
if (s->parent != NULL)
|
||||||
uiContainerUpdate(s->parent);
|
uiControlQueueResize(s->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void singleContainerShow(uiControl *c)
|
static void singleContainerShow(uiControl *c)
|
||||||
|
@ -113,7 +113,7 @@ static void singleContainerShow(uiControl *c)
|
||||||
if (!s->userHidden)
|
if (!s->userHidden)
|
||||||
ShowWindow(s->hwnd, SW_SHOW);
|
ShowWindow(s->hwnd, SW_SHOW);
|
||||||
if (s->parent != NULL)
|
if (s->parent != NULL)
|
||||||
uiContainerUpdate(s->parent);
|
uiControlQueueResize(s->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void singleContainerHide(uiControl *c)
|
static void singleContainerHide(uiControl *c)
|
||||||
|
@ -123,7 +123,7 @@ static void singleContainerHide(uiControl *c)
|
||||||
s->containerHidden = 1;
|
s->containerHidden = 1;
|
||||||
ShowWindow(s->hwnd, SW_HIDE);
|
ShowWindow(s->hwnd, SW_HIDE);
|
||||||
if (s->parent != NULL)
|
if (s->parent != NULL)
|
||||||
uiContainerUpdate(s->parent);
|
uiControlQueueResize(s->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void singleEnable(uiControl *c)
|
static void singleEnable(uiControl *c)
|
||||||
|
@ -170,7 +170,7 @@ static void singleSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
||||||
if ((getStyle(s->hwnd) & WS_TABSTOP) != 0)
|
if ((getStyle(s->hwnd) & WS_TABSTOP) != 0)
|
||||||
p->HasTabStops = TRUE;
|
p->HasTabStops = TRUE;
|
||||||
return;
|
return;
|
||||||
case uiWindowSysFuncSetZOrder:
|
case uiWindowsSysFuncSetZOrder:
|
||||||
// TODO
|
// TODO
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ extern ATOM registerWindowClass(HICON, HCURSOR);
|
||||||
extern void unregisterWindowClass(void);
|
extern void unregisterWindowClass(void);
|
||||||
|
|
||||||
// container.c
|
// container.c
|
||||||
extern const char *initContainer(HICON, HCURSOR);
|
extern ATOM initContainer(HICON, HCURSOR);
|
||||||
extern void uninitContainer(void);
|
extern void uninitContainer(void);
|
||||||
|
|
||||||
// menu.c
|
// menu.c
|
||||||
|
|
Loading…
Reference in New Issue