2015-05-14 08:43:25 -05:00
|
|
|
// 6 january 2015
|
|
|
|
#define UNICODE
|
|
|
|
#define _UNICODE
|
|
|
|
#define STRICT
|
|
|
|
#define STRICT_TYPED_ITEMIDS
|
|
|
|
#define CINTERFACE
|
|
|
|
#define COBJMACROS
|
|
|
|
// see https://github.com/golang/go/issues/9916#issuecomment-74812211
|
|
|
|
#define INITGUID
|
|
|
|
// get Windows version right; right now Windows XP
|
|
|
|
#define WINVER 0x0501
|
|
|
|
#define _WIN32_WINNT 0x0501
|
|
|
|
#define _WIN32_WINDOWS 0x0501 /* according to Microsoft's winperf.h */
|
|
|
|
#define _WIN32_IE 0x0600 /* according to Microsoft's sdkddkver.h */
|
|
|
|
#define NTDDI_VERSION 0x05010000 /* according to Microsoft's sdkddkver.h */
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <uxtheme.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <wchar.h>
|
|
|
|
#include <windowsx.h>
|
|
|
|
#include <vsstyle.h>
|
|
|
|
#include <vssym32.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <oleacc.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "../out/ui.h"
|
|
|
|
#include "../ui_windows.h"
|
|
|
|
#include "../uipriv.h"
|
2015-05-30 13:33:23 -05:00
|
|
|
#include "resources.h"
|
2015-05-14 08:43:25 -05:00
|
|
|
|
|
|
|
// ui internal window messages
|
|
|
|
enum {
|
|
|
|
// redirected WM_COMMAND and WM_NOTIFY
|
|
|
|
msgCOMMAND = WM_APP + 0x40, // start offset just to be safe
|
|
|
|
msgNOTIFY,
|
2015-05-19 22:16:46 -05:00
|
|
|
msgHSCROLL,
|
2015-05-14 08:43:25 -05:00
|
|
|
msgHasTabStops,
|
|
|
|
msgConsoleEndSession,
|
|
|
|
};
|
|
|
|
|
|
|
|
// init.c
|
|
|
|
extern HINSTANCE hInstance;
|
|
|
|
extern int nCmdShow;
|
|
|
|
extern HFONT hMessageFont;
|
|
|
|
extern HBRUSH hollowBrush;
|
|
|
|
|
|
|
|
// util.c
|
|
|
|
extern int windowClassOf(HWND, ...);
|
|
|
|
extern void mapWindowRect(HWND, HWND, RECT *);
|
|
|
|
extern DWORD getStyle(HWND);
|
|
|
|
extern void setStyle(HWND, DWORD);
|
|
|
|
extern DWORD getExStyle(HWND);
|
|
|
|
extern void setExStyle(HWND, DWORD);
|
|
|
|
|
|
|
|
// text.c
|
|
|
|
extern WCHAR *toUTF16(const char *);
|
|
|
|
extern char *toUTF8(const WCHAR *);
|
|
|
|
extern WCHAR *windowText(HWND);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-14 09:28:50 -05:00
|
|
|
|
|
|
|
/////////////////////////////////
|
|
|
|
|
|
|
|
// resize.c
|
|
|
|
extern void initResizes(void);
|
|
|
|
extern void uninitResizes(void);
|
|
|
|
extern void queueResize(uiControl *);
|
|
|
|
extern void doResizes(void);
|
2015-05-18 11:04:52 -05:00
|
|
|
extern void moveWindow(HWND, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *);
|
2015-05-30 02:40:14 -05:00
|
|
|
extern void setWindowInsertAfter(HWND, HWND);
|
2015-05-14 10:19:52 -05:00
|
|
|
|
|
|
|
// utilwindow.c
|
2015-05-15 15:19:21 -05:00
|
|
|
extern HWND utilWindow;
|
2015-05-14 10:19:52 -05:00
|
|
|
extern const char *initUtilWindow(HICON, HCURSOR);
|
|
|
|
extern void uninitUtilWindow(void);
|
2015-05-14 11:49:02 -05:00
|
|
|
|
|
|
|
// parent.c
|
2015-05-24 13:50:25 -05:00
|
|
|
extern void paintContainerBackground(HWND, HDC, RECT *);
|
2015-05-14 11:49:02 -05:00
|
|
|
extern BOOL handleParentMessages(HWND, UINT, WPARAM, LPARAM, LRESULT *);
|
2015-05-15 15:19:21 -05:00
|
|
|
|
|
|
|
// debug.c
|
|
|
|
extern HRESULT logLastError(const char *);
|
|
|
|
extern HRESULT logHRESULT(const char *, HRESULT);
|
|
|
|
extern HRESULT logMemoryExhausted(const char *);
|
|
|
|
|
|
|
|
// window.c
|
|
|
|
extern ATOM registerWindowClass(HICON, HCURSOR);
|
|
|
|
extern void unregisterWindowClass(void);
|
|
|
|
|
|
|
|
// container.c
|
2015-05-16 00:55:34 -05:00
|
|
|
#define containerClass L"libui_uiContainerClass"
|
2015-05-16 00:45:20 -05:00
|
|
|
extern ATOM initContainer(HICON, HCURSOR);
|
2015-05-15 15:19:21 -05:00
|
|
|
extern void uninitContainer(void);
|
|
|
|
|
|
|
|
// menu.c
|
|
|
|
extern HMENU makeMenubar(void);
|
|
|
|
extern const uiMenuItem *menuIDToItem(UINT_PTR);
|
|
|
|
extern void runMenuEvent(WORD, uiWindow *);
|
|
|
|
extern void freeMenubar(HMENU);
|
|
|
|
extern void uninitMenus(void);
|
|
|
|
|
|
|
|
// alloc.c
|
|
|
|
extern int initAlloc(void);
|
|
|
|
extern void uninitAlloc(void);
|
2015-05-15 17:54:13 -05:00
|
|
|
|
|
|
|
// tab.c
|
|
|
|
extern void tabEnterTabNavigation(HWND);
|
|
|
|
extern void tabLeaveTabNavigation(HWND);
|
2015-05-20 21:46:50 -05:00
|
|
|
|
|
|
|
// events.c
|
|
|
|
// TODO split the uiWindows ones to ui_windows.h
|
2015-05-21 13:52:21 -05:00
|
|
|
extern void uiWindowsRegisterWM_COMMANDHandler(HWND, BOOL (*)(uiControl *, HWND, WORD, LRESULT *), uiControl *);
|
|
|
|
extern void uiWindowsRegisterWM_NOTIFYHandler(HWND, BOOL (*)(uiControl *, HWND, NMHDR *, LRESULT *), uiControl *);
|
|
|
|
extern void uiWindowsRegisterWM_HSCROLLHandler(HWND, BOOL (*)(uiControl *, HWND, WORD, LRESULT *), uiControl *);
|
2015-05-20 21:46:50 -05:00
|
|
|
extern void uiWindowsUnregisterWM_COMMANDHandler(HWND);
|
2015-05-21 10:29:25 -05:00
|
|
|
extern void uiWindowsUnregisterWM_NOTIFYHandler(HWND);
|
|
|
|
extern void uiWindowsUnregisterWM_HSCROLLHandler(HWND);
|
2015-05-20 21:46:50 -05:00
|
|
|
extern BOOL runWM_COMMAND(WPARAM, LPARAM, LRESULT *);
|
2015-05-21 10:29:25 -05:00
|
|
|
extern BOOL runWM_NOTIFY(WPARAM, LPARAM, LRESULT *);
|
|
|
|
extern BOOL runWM_HSCROLL(WPARAM, LPARAM, LRESULT *);
|
2015-05-22 16:41:36 -05:00
|
|
|
|
|
|
|
// dialoghelper.c
|
|
|
|
extern void dialogHelperRegisterWindow(HWND);
|
|
|
|
extern void dialogHelperUnregisterWindow(HWND);
|
|
|
|
extern ATOM initDialogHelper(HICON, HCURSOR);
|
2015-05-22 18:14:25 -05:00
|
|
|
extern HWND beginDialogHelper(void);
|
|
|
|
extern void endDialogHelper(HWND);
|
2015-05-29 19:40:54 -05:00
|
|
|
|
|
|
|
// control.c
|
|
|
|
extern void setSingleHWNDFuncs(uiControl *);
|
2015-05-30 11:28:52 -05:00
|
|
|
|
|
|
|
// tabpage.c
|
|
|
|
extern uiControl *newTabPage(uiControl *);
|