From 1b5de5f09614d64bb161c45e9c3d012fc301bb50 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 9 Apr 2015 15:30:24 -0400 Subject: [PATCH] Implemented the foundation for padding. --- container_darwin.m | 4 ++++ container_unix.c | 4 ++++ container_windows.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/container_darwin.m b/container_darwin.m index 50122299..bdfab908 100644 --- a/container_darwin.m +++ b/container_darwin.m @@ -34,6 +34,8 @@ uiLogObjCClassAllocations // TODO reverify these against /layout rects/, not /frame rects/ #define macXMargin 20 #define macYMargin 20 +#define macXPadding 8 +#define macYPadding 8 - (void)uiUpdateNow { @@ -52,6 +54,8 @@ uiLogObjCClassAllocations width -= 2 * macXMargin; height -= 2 * macYMargin; } + d.xPadding = macXPadding; + d.yPadding = macYPadding; (*(self.child->resize))(self.child, x, y, width, height, &d); } diff --git a/container_unix.c b/container_unix.c index d393273e..bb0cbb8d 100644 --- a/container_unix.c +++ b/container_unix.c @@ -57,6 +57,8 @@ static void uiContainer_remove(GtkContainer *container, GtkWidget *widget) #define gtkXMargin 12 #define gtkYMargin 12 +#define gtkXPadding 12 +#define gtkYPadding 6 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; height -= 2 * gtkYMargin; } + d.xPadding = gtkXPadding; + d.yPadding = gtkYPadding; (*(c->child->resize))(c->child, x, y, width, height, &d); } diff --git a/container_windows.c b/container_windows.c index f4d00ba8..8881c102 100644 --- a/container_windows.c +++ b/container_windows.c @@ -55,6 +55,10 @@ BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT * return FALSE; } +// TODO get source +#define winXPadding 4 +#define winYPadding 4 + void resize(uiControl *control, HWND parent, RECT r, RECT margin) { uiSizing d; @@ -87,6 +91,8 @@ void resize(uiControl *control, HWND parent, RECT r, RECT margin) r.top += uiDlgUnitToY(margin.top, d.baseY); r.right -= uiDlgUnitToX(margin.right, d.baseX); 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); }