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
|
||||
#include "ui.h"
|
||||
#include "out/ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
struct box {
|
||||
|
@ -7,8 +7,8 @@ struct box {
|
|||
void (*baseDestroy)(uiControl *);
|
||||
struct ptrArray *controls;
|
||||
int vertical;
|
||||
void (*baseSetParent)(uiControl *, uiContainer *);
|
||||
uiContainer *parent;
|
||||
void (*baseSetParent)(uiControl *, uiControl *);
|
||||
uiControl *parent;
|
||||
int padded;
|
||||
void (*baseResize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *);
|
||||
};
|
||||
|
@ -41,14 +41,7 @@ static void boxDestroy(uiControl *c)
|
|||
uiFree(b);
|
||||
}
|
||||
|
||||
static uiControl *boxParent(uiControl *c)
|
||||
{
|
||||
struct box *b = (struct box *) c;
|
||||
|
||||
return b->parent;
|
||||
}
|
||||
|
||||
static void boxSetParent(uiControl *c, uiContainer *parent)
|
||||
static void boxSetParent(uiControl *c, uiControl *parent)
|
||||
{
|
||||
struct box *b = (struct box *) c;
|
||||
|
||||
|
@ -97,7 +90,7 @@ static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
|||
maxStretchyHeight = 0;
|
||||
for (i = 0; i < b->controls->len; i++) {
|
||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||
if (!uiControlVisible(bc->c))
|
||||
if (!uiControlContainerVisible(bc->c))
|
||||
continue;
|
||||
uiControlPreferredSize(bc->c, d, &preferredWidth, &preferredHeight);
|
||||
if (bc->stretchy) {
|
||||
|
@ -127,7 +120,7 @@ static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
|||
*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 boxControl *bc;
|
||||
|
@ -164,7 +157,7 @@ static void boxResize(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, in
|
|||
nStretchy = 0;
|
||||
for (i = 0; i < b->controls->len; i++) {
|
||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||
if (!uiControlVisible(bc->c))
|
||||
if (!uiControlContainerVisible(bc->c))
|
||||
continue;
|
||||
if (bc->stretchy) {
|
||||
nStretchy++;
|
||||
|
@ -190,7 +183,7 @@ static void boxResize(uiContainer *c, intmax_t x, intmax_t y, intmax_t width, in
|
|||
stretchywid /= nStretchy;
|
||||
for (i = 0; i < b->controls->len; i++) {
|
||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||
if (!uiControlVisible(bc->c))
|
||||
if (!uiControlContainerVisible(bc->c))
|
||||
continue;
|
||||
if (bc->stretchy) {
|
||||
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
|
||||
for (i = 0; i < b->controls->len; i++) {
|
||||
bc = ptrArrayIndex(b->controls, struct boxControl *, i);
|
||||
if (!uiControlVisible(bc->c))
|
||||
if (!uiControlContainerVisible(bc->c))
|
||||
continue;
|
||||
uiControlResize(bc->c, x, y, bc->width, bc->height, d);
|
||||
if (b->vertical)
|
||||
|
@ -231,7 +224,7 @@ static void boxAppend(uiBox *ss, uiControl *c, int stretchy)
|
|||
bc = uiNew(struct boxControl);
|
||||
bc->c = c;
|
||||
bc->stretchy = stretchy;
|
||||
uiControlSetParent(bc->c, uiContainer(b));
|
||||
uiControlSetParent(bc->c, uiControl(b));
|
||||
ptrArrayAppend(b->controls, bc);
|
||||
uiControlQueueResize(uiControl(b));
|
||||
}
|
||||
|
@ -273,7 +266,7 @@ uiBox *uiNewHorizontalBox(void)
|
|||
|
||||
b = uiNew(struct box);
|
||||
|
||||
uiMakeContainer(uiContainer(b));
|
||||
uiMakeContainer(uiControl(b));
|
||||
|
||||
b->controls = newPtrArray();
|
||||
|
||||
|
@ -282,7 +275,7 @@ uiBox *uiNewHorizontalBox(void)
|
|||
b->baseSetParent = uiControl(b)->SetParent;
|
||||
uiControl(b)->SetParent = boxSetParent;
|
||||
uiControl(b)->PreferredSize = boxPreferredSize;
|
||||
b->baseResize = uiControl(b)->Resize
|
||||
b->baseResize = uiControl(b)->Resize;
|
||||
uiControl(b)->Resize = boxResize;
|
||||
uiControl(b)->SysFunc = boxSysFunc;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// 5 may 2015
|
||||
#include <string.h>
|
||||
#include "ui.h"
|
||||
#include "out/ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
struct ptrArray *newPtrArray(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 9 may 2015
|
||||
#include "ui.h"
|
||||
#include "out/ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
static int defaultOnShouldQuit(void *data)
|
||||
|
|
|
@ -82,7 +82,7 @@ interface Button from Control {
|
|||
};
|
||||
func NewButton(text *const char) *Button;
|
||||
|
||||
interface Box from Container {
|
||||
interface Box from Control {
|
||||
func Append(c *Control, stretchy int);
|
||||
func Delete(index uintmax_t);
|
||||
func Padded(void) int;
|
||||
|
|
|
@ -10,13 +10,6 @@ extern void uiFree(void *);
|
|||
|
||||
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
|
||||
struct ptrArray {
|
||||
void **ptrs;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// 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)
|
||||
{
|
||||
|
@ -54,12 +54,12 @@ ATOM initContainer(HICON hDefaultIcon, HCURSOR hDefaultCursor)
|
|||
void uninitContainer(void)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return FALSE
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void uiMakeContainer(uiContainer *c)
|
||||
void uiMakeContainer(uiControl *c)
|
||||
{
|
||||
uiWindowsMakeControlParams p;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ struct singleHWND {
|
|||
BOOL (*onWM_NOTIFY)(uiControl *, NMHDR *, LRESULT *);
|
||||
void (*onDestroy)(void *);
|
||||
void *onDestroyData;
|
||||
uiContainer *parent;
|
||||
uiControl *parent;
|
||||
int userHidden;
|
||||
int containerHidden;
|
||||
int userDisabled;
|
||||
|
@ -40,10 +40,10 @@ static uiControl *singleParent(uiControl *c)
|
|||
return s->parent;
|
||||
}
|
||||
|
||||
static void singleSetParent(uiControl *c, uiContainer *parent)
|
||||
static void singleSetParent(uiControl *c, uiControl *parent)
|
||||
{
|
||||
struct singleHWND *s = (struct singleHWND *) (c->Internal);
|
||||
uiContainer *oldparent;
|
||||
uiControl *oldparent;
|
||||
HWND newParentHWND;
|
||||
|
||||
oldparent = s->parent;
|
||||
|
@ -67,7 +67,7 @@ static void singleQueueResize(uiControl *c)
|
|||
queueResize(c);
|
||||
}
|
||||
|
||||
static void singleGetSIzing(uiControl *c, uiSizing *d)
|
||||
static void singleGetSizing(uiControl *c, uiSizing *d)
|
||||
{
|
||||
uiWindowsGetSizing(c, d);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static void singleShow(uiControl *c)
|
|||
if (!s->containerHidden)
|
||||
ShowWindow(s->hwnd, SW_SHOW);
|
||||
if (s->parent != NULL)
|
||||
uiContainerUpdate(s->parent);
|
||||
uiControlQueueResize(s->parent);
|
||||
}
|
||||
|
||||
static void singleHide(uiControl *c)
|
||||
|
@ -102,7 +102,7 @@ static void singleHide(uiControl *c)
|
|||
s->userHidden = 1;
|
||||
ShowWindow(s->hwnd, SW_HIDE);
|
||||
if (s->parent != NULL)
|
||||
uiContainerUpdate(s->parent);
|
||||
uiControlQueueResize(s->parent);
|
||||
}
|
||||
|
||||
static void singleContainerShow(uiControl *c)
|
||||
|
@ -113,7 +113,7 @@ static void singleContainerShow(uiControl *c)
|
|||
if (!s->userHidden)
|
||||
ShowWindow(s->hwnd, SW_SHOW);
|
||||
if (s->parent != NULL)
|
||||
uiContainerUpdate(s->parent);
|
||||
uiControlQueueResize(s->parent);
|
||||
}
|
||||
|
||||
static void singleContainerHide(uiControl *c)
|
||||
|
@ -123,7 +123,7 @@ static void singleContainerHide(uiControl *c)
|
|||
s->containerHidden = 1;
|
||||
ShowWindow(s->hwnd, SW_HIDE);
|
||||
if (s->parent != NULL)
|
||||
uiContainerUpdate(s->parent);
|
||||
uiControlQueueResize(s->parent);
|
||||
}
|
||||
|
||||
static void singleEnable(uiControl *c)
|
||||
|
@ -170,7 +170,7 @@ static void singleSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
|||
if ((getStyle(s->hwnd) & WS_TABSTOP) != 0)
|
||||
p->HasTabStops = TRUE;
|
||||
return;
|
||||
case uiWindowSysFuncSetZOrder:
|
||||
case uiWindowsSysFuncSetZOrder:
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ extern ATOM registerWindowClass(HICON, HCURSOR);
|
|||
extern void unregisterWindowClass(void);
|
||||
|
||||
// container.c
|
||||
extern const char *initContainer(HICON, HCURSOR);
|
||||
extern ATOM initContainer(HICON, HCURSOR);
|
||||
extern void uninitContainer(void);
|
||||
|
||||
// menu.c
|
||||
|
|
Loading…
Reference in New Issue