diff options
Diffstat (limited to 'alf/alf.h')
| -rw-r--r-- | alf/alf.h | 147 |
1 files changed, 85 insertions, 62 deletions
@@ -72,11 +72,10 @@ typedef struct { // messages #define ALF_WM__BASE 0x2800 #define ALF_WM_QUERYSIZE (ALF_WM__BASE + 1) -#define ALF_WM_APPLYLAYOUT (ALF_WM__BASE + 2) #define ALF_WM_UPDATEFONTS (ALF_WM__BASE + 3) -#define ALF_WM_ADDWIDGET (ALF_WM__BASE + 4) -#define ALF_WM_WIDGETBYID (ALF_WM__BASE + 5) -#define ALF_WM_REMOVEWIDGET (ALF_WM__BASE + 6) +#define ALF_WM_ADDCONTROL (ALF_WM__BASE + 4) +#define ALF_WM_CONTROLBYID (ALF_WM__BASE + 5) +#define ALF_WM_REMOVECONTROL (ALF_WM__BASE + 6) #define ALF_WM_SETMODALRESULT (ALF_WM__BASE + 7) #define ALF_WM_GETMODALRESULT (ALF_WM__BASE + 8) #define ALF_WM_GETDPI (ALF_WM__BASE + 9) @@ -85,15 +84,15 @@ typedef struct { #define ALF_WM_APPLYSIZE (ALF_WM__BASE + 12) #define ALF_WM_SETBGCOLOR (ALF_WM__BASE + 13) #define ALF_WM_GETBGCOLOR (ALF_WM__BASE + 14) -#define ALF_WM_GETWIDGETATPOS (ALF_WM__BASE + 15) +#define ALF_WM_LYT_GETCTLATPOS (ALF_WM__BASE + 15) #define ALF_WM_INVALIDATELAYOUT (ALF_WM__BASE + 17) #define ALF_WM_VALIDATELAYOUT (ALF_WM__BASE + 18) -#define ALF_WM_LYT_GETWIDGETPOS (ALF_WM__BASE + 19) -#define ALF_WM_LYT_SETWIDGETPOS (ALF_WM__BASE + 20) -#define ALF_WM_LYT_GETWIDGTSIZE (ALF_WM__BASE + 21) -#define ALF_WM_LYT_SETWIDGTSIZE (ALF_WM__BASE + 22) -#define ALF_WM_LYT_GETWDGTFLAGS (ALF_WM__BASE + 23) -#define ALF_WM_LYT_SETWDGTFLAGS (ALF_WM__BASE + 24) +#define ALF_WM_LYT_GETCTLPOS (ALF_WM__BASE + 19) +#define ALF_WM_LYT_SETCTLPOS (ALF_WM__BASE + 20) +#define ALF_WM_LYT_GETCTLSIZE (ALF_WM__BASE + 21) +#define ALF_WM_LYT_SETCTLSIZE (ALF_WM__BASE + 22) +#define ALF_WM_LYT_GETCTLFLAGS (ALF_WM__BASE + 23) +#define ALF_WM_LYT_SETCTLFLAGS (ALF_WM__BASE + 24) #define ALF_WM_LYT_GETCOLSIZE (ALF_WM__BASE + 25) #define ALF_WM_LYT_SETCOLSIZE (ALF_WM__BASE + 26) #define ALF_WM_LYT_GETCOLEXPAND (ALF_WM__BASE + 27) @@ -109,8 +108,8 @@ typedef struct { #define ALF_WM_GETTEXTCOLOR (ALF_WM__BASE + 37) #define ALF_WM_SETTEXTCOLOR (ALF_WM__BASE + 38) #define ALF_WM_DPICHANGE (ALF_WM__BASE + 39) -#define ALF_WM_LYT_GETWDGTSPAN (ALF_WM__BASE + 40) -#define ALF_WM_LYT_SETWDGTSPAN (ALF_WM__BASE + 41) +#define ALF_WM_LYT_GETCTLSPAN (ALF_WM__BASE + 40) +#define ALF_WM_LYT_SETCTLSPAN (ALF_WM__BASE + 41) #define ALF_WM_LBL_GETSTYLE (ALF_WM__BASE + 201) #define ALF_WM_LBL_SETSTYLE (ALF_WM__BASE + 202) @@ -171,14 +170,9 @@ ALF_CentipointsToPixels(int cptValue, int dpi); int ALF_GetDpi(HWND hwnd); -void -ALF_AddWidget(HWND win, int x, int y, HWND widget, int width, int height, DWORD flags); - HWND -ALF_WidgetHwndById(HWND win, WORD id); +ALF_ControlHwndById(HWND win, WORD id); -void -ALF_InvalidateLayout(HWND win); // Sends ALF_WM_BACKGROUNDCHANGE to notify the window of a changed background // Only useful when you have overridden the window or panel pain() vfunc @@ -186,7 +180,7 @@ ALF_InvalidateLayout(HWND win); void ALF_InvalidateBackground(HWND win); -// Recalculates the window's fonts and applies them to child widgets. +// Recalculates the window's fonts and applies them to child controls. // ALF does this automatically on a DPI or settings change so you shouldn't have // to call ALF_UpdateFonts(). void @@ -194,7 +188,7 @@ ALF_UpdateFonts(HWND win); // Sets the background color of the given window // Also, if the window is a child window, disables the ALF_LAYOUT_INHERITBGCOLOR flag -// Only the following widgets have background colors: +// Only the following controls have background colors: // - Top-Level window // - Panel // - Label @@ -217,100 +211,129 @@ ALF_SetFocus(HWND target); void ALF_SetText(HWND hwnd, const TCHAR *text); -void -ALF_SetWidgetText(HWND parent, WORD id, const TCHAR *text); - TCHAR * // free with ALF_Free ALF_Text(HWND hwnd); -TCHAR * // free with ALF_Free -ALF_WidgetText(HWND parent, WORD id); +void +ALF_FillRect(HDC dc, const RECT *rc, ALFColor color); + +// wrapper for MessageBox() that handles modality for multiple toplevels with ALFApplication +int +ALF_MessageBox(HWND hwnd, const TCHAR *text, const TCHAR *caption, UINT type); + +// layout +// +// All of these functions are appropriate for every container that contains layouted children, +// i.e. toplevel, panel and groupbox +// +// Container controls which do not layout their children (e.g. notebook) might still +// support some of these functions in some ways, mostly (Set)ControlFlags so that +// background color and font inheritance can be toggled + +void +ALF_InvalidateLayout(HWND win); + +void +ALF_AddControl(HWND win, int x, int y, HWND control, int width, int height, DWORD flags); DWORD -ALF_WidgetLayoutFlags(HWND parent, HWND widget); +ALF_Layout_ControlFlags(HWND parent, HWND control); BOOL -ALF_SetWidgetLayoutFlags(HWND parent, HWND widget, DWORD flags); +ALF_Layout_SetControlFlags(HWND parent, HWND control, DWORD flags); static inline void -ALF_AddWidgetLayoutFlag(HWND parent, HWND widget, DWORD flag) +ALF_Layout_AddControlFlag(HWND parent, HWND control, DWORD flag) { - ALF_SetWidgetLayoutFlags(parent, widget, ALF_WidgetLayoutFlags(parent, widget) | flag); + ALF_Layout_SetControlFlags(parent, control, ALF_Layout_ControlFlags(parent, control) | flag); } static inline void -ALF_RemoveWidgetLayoutFlag(HWND parent, HWND widget, DWORD flag) +ALF_Layout_RemoveControlFlag(HWND parent, HWND control, DWORD flag) { - ALF_SetWidgetLayoutFlags(parent, widget, ALF_WidgetLayoutFlags(parent, widget) & ~flag); + ALF_Layout_SetControlFlags(parent, control, ALF_Layout_ControlFlags(parent, control) & ~flag); } BOOL -ALF_WidgetLayoutPosition(HWND parent, HWND widget, int *pX, int *pY); +ALF_Layout_ControlPosition(HWND parent, HWND control, int *pX, int *pY); BOOL -ALF_SetWidgetLayoutPosition(HWND parent, HWND widget, int x, int y); +ALF_Layout_SetControlPosition(HWND parent, HWND control, int x, int y); BOOL -ALF_WidgetLayoutSpan(HWND parent, HWND widget, int *pXspan, int *pYspan); +ALF_Layout_ControlSpan(HWND parent, HWND control, int *pXspan, int *pYspan); BOOL -ALF_SetWidgetLayoutSpan(HWND parent, HWND widget, int xspan, int yspan); +ALF_Layout_SetControlSpan(HWND parent, HWND control, int xspan, int yspan); BOOL -ALF_WidgetLayoutMinSize(HWND parent, HWND widget, int *pWidth, int *pheight); +ALF_Layout_ControlMinSize(HWND parent, HWND control, int *pWidth, int *pheight); BOOL -ALF_SetWidgetLayoutMinSize(HWND parent, HWND widget, int width, int height); +ALF_Layout_SetControlMinSize(HWND parent, HWND control, int width, int height); HWND -ALF_WidgetAtLayoutPosition(HWND parent, int x, int y); +ALF_Layout_ControlAtPosition(HWND parent, int x, int y); int -ALF_LayoutRowMinSize(HWND parent, int rowno); +ALF_Layout_RowMinSize(HWND parent, int rowno); BOOL -ALF_LayoutSetRowMinSize(HWND parent, int rowno, int rowsize); +ALF_Layout_SetRowMinSize(HWND parent, int rowno, int rowsize); int -ALF_LayoutColumnMinSize(HWND parent, int colno); +ALF_Layout_ColumnMinSize(HWND parent, int colno); BOOL -ALF_LayoutSetColumnMinSize(HWND parent, int colno, int colsize); +ALF_Layout_SetColumnMinSize(HWND parent, int colno, int colsize); DWORD -ALF_LayoutRowFlags(HWND parent, int rowno); +ALF_Layout_RowFlags(HWND parent, int rowno); BOOL -ALF_LayoutSetRowFlags(HWND parent, int rowno, DWORD flags); +ALF_Layout_SetRowFlags(HWND parent, int rowno, DWORD flags); + +static inline BOOL +ALF_Layout_AddRowFlag(HWND parent, int rowno, DWORD addflag) +{ + return ALF_Layout_SetRowFlags(parent, rowno, ALF_Layout_RowFlags(parent, rowno) | addflag); +} + +static inline BOOL +ALF_Layout_RemoveRowFlag(HWND parent, int rowno, DWORD removeflag) +{ + return ALF_Layout_SetRowFlags(parent, rowno, ALF_Layout_RowFlags(parent, rowno) & ~removeflag); +} DWORD -ALF_LayoutColumnFlags(HWND parent, int colno); +ALF_Layout_ColumnFlags(HWND parent, int colno); BOOL -ALF_LayoutSetColumnFlags(HWND parent, int colno, DWORD flags); +ALF_Layout_SetColumnFlags(HWND parent, int colno, DWORD flags); -int -ALF_LayoutRowExpandNumerator(HWND parent, int rowno); +static inline BOOL +ALF_Layout_AddColumnFlag(HWND parent, int colno, DWORD addflag) +{ + return ALF_Layout_SetColumnFlags(parent, colno, ALF_Layout_ColumnFlags(parent, colno) | addflag); +} -BOOL -ALF_LayoutSetRowExpandNumerator(HWND parent, int rowno, int expand); +static inline BOOL +ALF_Layout_RemoveColumnFlag(HWND parent, int colno, DWORD removeflag) +{ + return ALF_Layout_SetColumnFlags(parent, colno, ALF_Layout_ColumnFlags(parent, colno) & ~removeflag); +} int -ALF_LayoutColumnExpandNumerator(HWND parent, int colno); +ALF_Layout_RowExpandNumerator(HWND parent, int rowno); BOOL -ALF_LayoutSetColumnExpandNumerator(HWND parent, int colno, int expand); - -void -ALF_FillRect(HDC dc, const RECT *rc, ALFColor color); +ALF_Layout_SetRowExpandNumerator(HWND parent, int rowno, int expand); -void -ALF_DestroyWidget(HWND win, WORD id); - -// wrapper for MessageBox() that handles modality for multiple toplevels with ALFApplication int -ALF_MessageBox(HWND hwnd, const TCHAR *text, const TCHAR *caption, UINT type); +ALF_Layout_ColumnExpandNumerator(HWND parent, int colno); +BOOL +ALF_Layout_SetColumnExpandNumerator(HWND parent, int colno, int expand); // application @@ -434,7 +457,7 @@ ALF_Toplevel_EnsureBigEnough(HWND toplevel); // // - If no default button is specified, the default button will be the button // with the id IDOK. A WM_COMMAND message on pressing the return key will be -// sent even if no widget with the default id can be found. +// sent even if no control with the default id can be found. // - In NT 3.51, the default button must be a direct child of the window. Otherwise // the default button effect will not work. // - In Win32s on Win3.1, the default button should be a direct child of the window. |
