1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-30 12:15:50 +01:00

fixed autoexpand to parent

This commit is contained in:
kojima
2001-01-11 16:31:23 +00:00
parent 017f3e5e4f
commit 5c62197542

View File

@@ -31,6 +31,7 @@ typedef struct W_Box {
#define DEFAULT_HEIGHT 40 #define DEFAULT_HEIGHT 40
static void destroyBox(Box *bPtr); static void destroyBox(Box *bPtr);
static void handleEvents(XEvent *event, void *data); static void handleEvents(XEvent *event, void *data);
@@ -185,7 +186,7 @@ WMAddBoxSubview(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
bPtr->subviews[i].fill = fill; bPtr->subviews[i].fill = fill;
bPtr->subviews[i].space = space; bPtr->subviews[i].space = space;
bPtr->subviews[i].end = 0; bPtr->subviews[i].end = 0;
rearrange(bPtr); rearrange(bPtr);
} }
@@ -210,11 +211,27 @@ WMAddBoxSubviewAtEnd(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
bPtr->subviews[i].fill = fill; bPtr->subviews[i].fill = fill;
bPtr->subviews[i].space = space; bPtr->subviews[i].space = space;
bPtr->subviews[i].end = 1; bPtr->subviews[i].end = 1;
rearrange(bPtr); rearrange(bPtr);
} }
void
WMRemoveBoxSubview(WMBox *bPtr, WMView *view)
{
int i;
for (i = 0; i < bPtr->subviewCount; i++) {
if (bPtr->subviews[i].view == view) {
memmove(&bPtr->subviews[i], &bPtr->subviews[i+1],
(bPtr->subviewCount - i - 1) * sizeof(void*));
bPtr->subviewCount--;
break;
}
}
}
void void
WMSetBoxHorizontal(WMBox *box, Bool flag) WMSetBoxHorizontal(WMBox *box, Bool flag)
{ {
@@ -226,18 +243,21 @@ WMSetBoxHorizontal(WMBox *box, Bool flag)
void void
WMSetBoxExpandsToParent(WMBox *box) WMSetBoxExpandsToParent(WMBox *box)
{ {
WMSize size = W_VIEW(box)->parent->size;
WMAddNotificationObserver(resizedParent, box, WMAddNotificationObserver(resizedParent, box,
WMViewSizeDidChangeNotification, WMViewSizeDidChangeNotification,
W_VIEW(box)->parent); W_VIEW(box)->parent);
WMSetViewNotifySizeChanges(W_VIEW(box)->parent, True); WMSetViewNotifySizeChanges(W_VIEW(box)->parent, True);
WMResizeWidget(box, W_VIEW(box)->parent->size.width,
W_VIEW(box)->parent->size.height); WMResizeWidget(box, size.width, size.height);
} }
static void static void
destroyBox(Box *bPtr) destroyBox(Box *bPtr)
{ {
WMRemoveNotificationObserver(bPtr);
wfree(bPtr); wfree(bPtr);
} }
@@ -248,6 +268,7 @@ didResize(struct W_ViewDelegate *delegate, WMView *view)
rearrange(view->self); rearrange(view->self);
} }
static void static void
handleEvents(XEvent *event, void *data) handleEvents(XEvent *event, void *data)
{ {
@@ -265,3 +286,4 @@ handleEvents(XEvent *event, void *data)
break; break;
} }
} }