From cd7b608f0517c1100f79b4a3ec654e4178373506 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Thu, 3 Jan 2019 01:06:00 +0100 Subject: widget layout improvements --- alf/alf.h | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'alf/alf.h') diff --git a/alf/alf.h b/alf/alf.h index f057b10..13b2571 100644 --- a/alf/alf.h +++ b/alf/alf.h @@ -45,6 +45,9 @@ typedef struct { #define ALF_WM_SETFOCUS (ALF_WM__BASE + 10) #define ALF_WM_GETAPPLICATION (ALF_WM__BASE + 11) #define ALF_WM_APPLYSIZE (ALF_WM__BASE + 12) +#define ALF_WM_GETLAYOUTPARAMS (ALF_WM__BASE + 13) +#define ALF_WM_SETLAYOUTPARAMS (ALF_WM__BASE + 14) +#define ALF_WM_GETWIDGETATPOS (ALF_WM__BASE + 15) typedef struct { const TCHAR *className; @@ -60,7 +63,7 @@ typedef struct { UINT height; DWORD flags; UINT margins[4]; -} ALFAddWidgetParams; +} ALFWidgetLayoutParams; typedef struct ALFAppPriv *ALFAPP; @@ -119,7 +122,7 @@ void ALF_AddWidget(HWND win, UINT x, UINT y, HWND widget, UINT cptWidth, UINT cptHeight, DWORD flags); void -ALF_AddWidgetEx(HWND win, const ALFAddWidgetParams *params); +ALF_AddWidgetEx(HWND win, const ALFWidgetLayoutParams *params); HWND ALF_WidgetHwndById(HWND win, WORD id); @@ -157,6 +160,39 @@ ALF_Text(HWND hwnd); TCHAR * // free with HeapFree ALF_WidgetText(HWND parent, WORD id); +DWORD +ALF_WidgetLayoutFlags(HWND parent, HWND widget); + +BOOL +ALF_SetWidgetLayoutFlags(HWND parent, HWND widget, DWORD flags); + +static inline void +ALF_AddWidgetLayoutFlag(HWND parent, HWND widget, DWORD flag) +{ + ALF_SetWidgetLayoutFlags(parent, widget, ALF_WidgetLayoutFlags(parent, widget) | flag); +} + +static inline void +ALF_RemoveWidgetLayoutFlag(HWND parent, HWND widget, DWORD flag) +{ + ALF_SetWidgetLayoutFlags(parent, widget, ALF_WidgetLayoutFlags(parent, widget) & ~flag); +} + +BOOL +ALF_WidgetLayoutPosition(HWND parent, HWND widget, UINT *pX, UINT *pY); + +BOOL +ALF_SetWidgetLayoutPosition(HWND parent, HWND widget, UINT x, UINT y); + +BOOL +ALF_WidgetLayoutSize(HWND parent, HWND widget, UINT *pCptWidth, UINT *pCptHeight); + +BOOL +ALF_SetWidgetLayoutSize(HWND parent, HWND widget, UINT cptWidth, UINT cptHeight); + +HWND +ALF_WidgetAtLayoutPosition(HWND parent, UINT x, UINT y); + // combo box HWND -- cgit v1.2.3