2016-04-23 15:47:44 -05:00
|
|
|
// 21 april 2016
|
2015-05-14 08:43:25 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
This file assumes that you have included <windows.h> and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls in Windows.
|
|
|
|
*/
|
|
|
|
|
2015-08-28 20:42:21 -05:00
|
|
|
#ifndef __LIBUI_UI_WINDOWS_H__
|
|
|
|
#define __LIBUI_UI_WINDOWS_H__
|
|
|
|
|
2015-11-16 09:55:44 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-08-29 19:38:12 -05:00
|
|
|
typedef struct uiWindowsSizing uiWindowsSizing;
|
|
|
|
|
2015-08-28 20:42:21 -05:00
|
|
|
typedef struct uiWindowsControl uiWindowsControl;
|
|
|
|
struct uiWindowsControl {
|
|
|
|
uiControl c;
|
2016-04-26 16:35:10 -05:00
|
|
|
uiControl *parent;
|
|
|
|
BOOL enabled;
|
|
|
|
BOOL visible;
|
|
|
|
void (*SetParentHWND)(uiWindowsControl *, HWND);
|
|
|
|
void (*MinimumSize)(uiWindowsControl *, intmax_t *, intmax_t *);
|
2016-04-26 16:37:16 -05:00
|
|
|
void (*ChildMinimumSizeChanged)(uiWIndowsControl *);
|
2015-09-01 20:36:33 -05:00
|
|
|
void (*AssignControlIDZOrder)(uiWindowsControl *, LONG_PTR *, HWND *);
|
2015-08-28 20:42:21 -05:00
|
|
|
};
|
2016-04-24 13:15:56 -05:00
|
|
|
#define uiWindowsControl(this) ((uiWindowsControl *) (this))
|
2015-08-28 20:42:21 -05:00
|
|
|
// TODO document
|
2016-04-26 16:35:10 -05:00
|
|
|
_UI_EXTERN void uiWindowsControlSetParentHWND(uiWindowsControl *, HWND);
|
|
|
|
_UI_EXTERN void uiWindowsControlMinimumSize(uiWindowsControl *, intmax_t *, intmax_t *);
|
2016-04-26 16:37:16 -05:00
|
|
|
_UI_EXTERN void uiWindowsControlChildMinimumSizeChanged(uiWindowsControl *);
|
2016-04-26 16:35:10 -05:00
|
|
|
_UI_EXTERN void uiWindowsControlAssignControlIDZOrder(uiWindowsControl *, LONG_PTR *, HWND *);
|
2015-08-28 20:42:21 -05:00
|
|
|
|
|
|
|
// TODO document
|
2016-04-26 16:35:10 -05:00
|
|
|
xxxx
|
2015-08-28 20:42:21 -05:00
|
|
|
|
2016-04-23 15:47:44 -05:00
|
|
|
// TODO document
|
2015-08-28 20:42:21 -05:00
|
|
|
_UI_EXTERN HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, HINSTANCE hInstance, LPVOID lpParam, BOOL useStandardControlFont);
|
|
|
|
|
2016-04-23 15:47:44 -05:00
|
|
|
// TODO document
|
2015-08-28 20:42:21 -05:00
|
|
|
_UI_EXTERN void uiWindowsEnsureDestroyWindow(HWND hwnd);
|
|
|
|
|
2016-04-23 15:47:44 -05:00
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN void uiWindowsEnsureSetParent(HWND hwnd, HWND parent);
|
2015-08-30 17:24:57 -05:00
|
|
|
|
2016-04-23 15:47:44 -05:00
|
|
|
// TODO document
|
2016-04-26 16:35:10 -05:00
|
|
|
_UI_EXTERN void uiWindowsEnsureAssignControlIDZOrder(HWND hwnd, LONG_PTR *controlID, HWND *insertAfter);
|
2015-09-01 20:36:33 -05:00
|
|
|
|
2016-04-23 15:47:44 -05:00
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN char *uiWindowsWindowText(HWND hwnd);
|
|
|
|
_UI_EXTERN void uiWindowsSetWindowText(HWND hwnd, const char *text);
|
|
|
|
|
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN intmax_t uiWindowsWindowTextWidth(HWND hwnd);
|
|
|
|
|
|
|
|
// TODO document
|
|
|
|
// TODO point out this should only be used in a resize cycle
|
|
|
|
_UI_EXTERN void uiWindowsEnsureMoveWindowDuringResize(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height);
|
|
|
|
|
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN void uiWindowsRegisterWM_COMMANDHandler(HWND hwnd, BOOL (*handler)(uiControl *, HWND, WORD, LRESULT *), uiControl *c);
|
|
|
|
_UI_EXTERN void uiWindowsUnregisterWM_COMMANDHandler(HWND hwnd);
|
|
|
|
|
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN void uiWindowsRegisterWM_NOTIFYHandler(HWND hwnd, BOOL (*handler)(uiControl *, HWND, NMHDR *, LRESULT *), uiControl *c);
|
|
|
|
_UI_EXTERN void uiWindowsUnregisterWM_NOTIFYHandler(HWND hwnd);
|
|
|
|
|
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN void uiWindowsRegisterWM_HSCROLLHandler(HWND hwnd, BOOL (*handler)(uiControl *, HWND, WORD, LRESULT *), uiControl *c);
|
|
|
|
_UI_EXTERN void uiWindowsUnregisterWM_HSCROLLHandler(HWND hwnd);
|
|
|
|
|
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN void uiWindowsRegisterReceiveWM_WININICHANGE(HWND hwnd);
|
|
|
|
_UI_EXTERN void uiWindowsUnregisterReceiveWM_WININICHANGE(HWND hwnd);
|
|
|
|
|
2016-04-26 16:35:10 -05:00
|
|
|
// TODO document
|
|
|
|
typedef struct uiWindowsSizing uiWindowsSizing;
|
2015-08-29 19:38:12 -05:00
|
|
|
struct uiWindowsSizing {
|
2015-05-14 08:43:25 -05:00
|
|
|
int BaseX;
|
|
|
|
int BaseY;
|
|
|
|
LONG InternalLeading;
|
|
|
|
};
|
2016-04-26 16:35:10 -05:00
|
|
|
_UI_EXTERN void uiWindowsGetSizing(HWND hwnd, uiWindowsSizing *sizing);
|
|
|
|
_UI_EXTERN void uiWindowsSizingDlgUnitsToPixels(HWND hwnd, uiWindowsSIzing *sizing, int *x, int *y);
|
|
|
|
// TODO make private
|
2015-05-14 08:43:25 -05:00
|
|
|
#define uiWindowsDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4)
|
|
|
|
#define uiWindowsDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8)
|
|
|
|
|
2016-04-26 16:35:10 -05:00
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN HWND uiWindowsMakeContainer(void (*onResize)(void *data), void *data);
|
2015-06-05 15:56:43 -05:00
|
|
|
|
2016-04-26 16:37:16 -05:00
|
|
|
// TODO document
|
|
|
|
_UI_EXTERN void uiWindowsControlNotifyMinimumSizeChanged(uiWindowsControl *);
|
|
|
|
|
2015-11-16 09:55:44 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-05-14 08:43:25 -05:00
|
|
|
#endif
|