summaryrefslogtreecommitdiff
path: root/alf/alf.h
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alf.h')
-rw-r--r--alf/alf.h148
1 files changed, 81 insertions, 67 deletions
diff --git a/alf/alf.h b/alf/alf.h
index aab0f00..cb2e48e 100644
--- a/alf/alf.h
+++ b/alf/alf.h
@@ -18,7 +18,7 @@ typedef struct {
BOOL (*pretranslatemessage)(void * /*closure*/, HWND /*window*/, MSG * /*message*/);
void (*paint)(void * /*closure*/, HWND, HDC, RECT *);
void (*windowposchanged)(void * /*closure*/, HWND, WINDOWPOS *);
-} ALFWindowVTable;
+} ALFToplevelVTable;
typedef struct {
void (*attachvtbl)(void * /*closure*/, HWND /*panel*/);
@@ -159,62 +159,12 @@ ALF_Free(const void *p);
COLORREF
ALF_ColorToGdi(ALFColor color);
-HWND
-ALF_CreateToplevelWindow(HWND hwndParent, ALFWindowVTable *vtbl, void *closure);
-
-void
-ALF_DestroyWindow(HWND win);
-
int
ALF_CentipointsToPixels(int cptValue, int dpi);
int
ALF_GetDpi(HWND hwnd);
-LRESULT
-ALF_DefWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
-
-void
-ALF_EnsureWindowBigEnough(HWND toplevel);
-
-HWND
-ALF_AddLabel(HWND win, WORD id, int x, int y, const TCHAR *text);
-
-DWORD
-ALF_LabelStyle(HWND hwndLabel);
-
-void
-ALF_LabelSetStyle(HWND hwndLabel, DWORD style);
-
-HWND
-ALF_AddEdit(HWND win, WORD id, int x, int y, const TCHAR *text);
-
-HWND
-ALF_AddButton(HWND win, WORD id, int x, int y, const TCHAR *text);
-
-// NOTE about default buttons:
-//
-// - 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.
-// - 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.
-// Otherwise the default button effect will be buggy when setting the focus
-// via WM_NEXTDLGCTL or ALF_SetFocus(), but it will work correctly when using
-// the TAB key.
-// - Changing the default button will only fully take effect after a focus change.
-// It might temporarily lead to artifacts such as having two or no default buttons.
-//
-// Recommendation: Set the default button during window initialization, and then
-// immediately set the focus via ALF_SetFocus(). If you want to support NT 3.51
-// or Win32s, ensure that the default button is a direct child of the toplevel window.
-void
-ALF_SetDefaultButton(HWND win, WORD id);
-
-void
-ALF_DestroyWidget(HWND win, WORD id);
-
void
ALF_AddWidget(HWND win, int x, int y, HWND widget, int width, int height, DWORD flags);
@@ -256,21 +206,6 @@ void
ALF_SetTextColor(HWND win, ALFColor color);
void
-ALF_ResizeWindow(HWND win, int cptWidth, int cptHeight);
-
-void
-ALF_ResizeWindowPx(HWND win, int pxWidth, int pxHeight);
-
-int
-ALF_ShowModal(HWND win);
-
-void
-ALF_SetModalResult(HWND win, int result);
-
-int
-ALF_GetModalResult(HWND win);
-
-void
ALF_SetFocus(HWND target);
void
@@ -360,10 +295,89 @@ ALF_LayoutColumnExpandNumerator(HWND parent, int colno);
BOOL
ALF_LayoutSetColumnExpandNumerator(HWND parent, int colno, int expand);
-
void
ALF_FillRect(HDC dc, const RECT *rc, ALFColor color);
+void
+ALF_DestroyWidget(HWND win, WORD id);
+
+// toplevel window
+
+HWND
+ALF_CreateToplevelWindow(HWND hwndParent, ALFToplevelVTable *vtbl, void *closure);
+
+void
+ALF_Toplevel_Resize(HWND win, int cptWidth, int cptHeight);
+
+void
+ALF_Toplevel_ResizePx(HWND win, int pxWidth, int pxHeight);
+
+
+// To add to your message loop like IsDialogMessage
+// NOT TREAD SAFE: Only call from the thread owning the window
+// (accesses internal data structures directly for performance)
+BOOL
+ALF_Toplevel_PreTranslateMessage(HWND toplevel, MSG *msg);
+
+// Shows the window as a modal window (i.e. disabling the owner window)
+// returns once the modal window has been ended via ALF_Toplevel_SetModalResult
+// NOT THREAD SAFE: Only call from the thread owning the window
+// (accesses internal data structures directly for performance)
+LPARAM
+ALF_Toplevel_ShowModal(HWND toplevel);
+
+void
+ALF_Toplevel_SetModalResult(HWND win, LRESULT result);
+
+LRESULT
+ALF_Toplevel_GetModalResult(HWND win);
+
+LRESULT
+ALF_Toplevel_DefWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
+
+void
+ALF_Toplevel_EnsureBigEnough(HWND toplevel);
+
+// NOTE about default buttons:
+//
+// - 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.
+// - 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.
+// Otherwise the default button effect will be buggy when setting the focus
+// via WM_NEXTDLGCTL or ALF_SetFocus(), but it will work correctly when using
+// the TAB key.
+// - Changing the default button will only fully take effect after a focus change.
+// It might temporarily lead to artifacts such as having two or no default buttons.
+//
+// Recommendation: Set the default button during window initialization, and then
+// immediately set the focus via ALF_SetFocus(). If you want to support NT 3.51
+// or Win32s, ensure that the default button is a direct child of the toplevel window.
+void
+ALF_Toplevel_SetDefaultButton(HWND win, WORD id);
+
+// label
+
+HWND
+ALF_AddLabel(HWND win, WORD id, int x, int y, const TCHAR *text);
+
+DWORD
+ALF_LabelStyle(HWND hwndLabel);
+
+void
+ALF_LabelSetStyle(HWND hwndLabel, DWORD style);
+
+// edit
+
+HWND
+ALF_AddEdit(HWND win, WORD id, int x, int y, const TCHAR *text);
+
+// button
+
+HWND
+ALF_AddButton(HWND win, WORD id, int x, int y, const TCHAR *text);
// combo box