Implemented the foundation for padding.

This commit is contained in:
Pietro Gagliardi 2015-04-09 15:30:24 -04:00
parent ec95a4a2dd
commit 1b5de5f096
3 changed files with 14 additions and 0 deletions

View File

@ -34,6 +34,8 @@ uiLogObjCClassAllocations
// TODO reverify these against /layout rects/, not /frame rects/ // TODO reverify these against /layout rects/, not /frame rects/
#define macXMargin 20 #define macXMargin 20
#define macYMargin 20 #define macYMargin 20
#define macXPadding 8
#define macYPadding 8
- (void)uiUpdateNow - (void)uiUpdateNow
{ {
@ -52,6 +54,8 @@ uiLogObjCClassAllocations
width -= 2 * macXMargin; width -= 2 * macXMargin;
height -= 2 * macYMargin; height -= 2 * macYMargin;
} }
d.xPadding = macXPadding;
d.yPadding = macYPadding;
(*(self.child->resize))(self.child, x, y, width, height, &d); (*(self.child->resize))(self.child, x, y, width, height, &d);
} }

View File

@ -57,6 +57,8 @@ static void uiContainer_remove(GtkContainer *container, GtkWidget *widget)
#define gtkXMargin 12 #define gtkXMargin 12
#define gtkYMargin 12 #define gtkYMargin 12
#define gtkXPadding 12
#define gtkYPadding 6
static void uiContainer_size_allocate(GtkWidget *widget, GtkAllocation *allocation) static void uiContainer_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{ {
@ -77,6 +79,8 @@ static void uiContainer_size_allocate(GtkWidget *widget, GtkAllocation *allocati
width -= 2 * gtkXMargin; width -= 2 * gtkXMargin;
height -= 2 * gtkYMargin; height -= 2 * gtkYMargin;
} }
d.xPadding = gtkXPadding;
d.yPadding = gtkYPadding;
(*(c->child->resize))(c->child, x, y, width, height, &d); (*(c->child->resize))(c->child, x, y, width, height, &d);
} }

View File

@ -55,6 +55,10 @@ BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *
return FALSE; return FALSE;
} }
// TODO get source
#define winXPadding 4
#define winYPadding 4
void resize(uiControl *control, HWND parent, RECT r, RECT margin) void resize(uiControl *control, HWND parent, RECT r, RECT margin)
{ {
uiSizing d; uiSizing d;
@ -87,6 +91,8 @@ void resize(uiControl *control, HWND parent, RECT r, RECT margin)
r.top += uiDlgUnitToY(margin.top, d.baseY); r.top += uiDlgUnitToY(margin.top, d.baseY);
r.right -= uiDlgUnitToX(margin.right, d.baseX); r.right -= uiDlgUnitToX(margin.right, d.baseX);
r.bottom -= uiDlgUnitToY(margin.bottom, d.baseY); r.bottom -= uiDlgUnitToY(margin.bottom, d.baseY);
d.xPadding = uiDlgUnitToX(winXPadding, d.baseX);
d.yPadding = uiDlgUnitToY(winYPadding, d.baseY);
(*(control->resize))(control, r.left, r.top, r.right - r.left, r.bottom - r.top, &d); (*(control->resize))(control, r.left, r.top, r.right - r.left, r.bottom - r.top, &d);
} }