2015-04-24 13:09:48 -05:00
// 6 january 2015
2015-04-24 12:59:49 -05:00
# 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 "../ui.h"
# include "../ui_windows.h"
2015-04-28 13:40:51 -05:00
# include "../uipriv.h"
2015-04-24 12:59:49 -05:00
// ui internal window messages
enum {
// redirected WM_COMMAND and WM_NOTIFY
msgCOMMAND = WM_APP + 0x40 , // start offset just to be safe
msgNOTIFY ,
msgUpdateChild , // fake because Windows seems to SWP_NOSIZE MoveWindow()s and SetWindowPos()s that don't change the window size (even if SWP_NOSIZE isn't specified)
2015-05-06 17:37:21 -05:00
msgHasTabStops ,
2015-04-24 12:59:49 -05:00
} ;
2015-04-24 13:09:48 -05:00
// debug.c
extern HRESULT logLastError ( const char * ) ;
extern HRESULT logHRESULT ( const char * , HRESULT ) ;
extern HRESULT logMemoryExhausted ( const char * ) ;
// init.c
extern HINSTANCE hInstance ;
extern int nCmdShow ;
extern HFONT hMessageFont ;
extern HBRUSH hollowBrush ;
// util.c
extern int windowClassOf ( HWND , . . . ) ;
2015-05-05 12:12:48 -05:00
extern void mapWindowRect ( HWND , HWND , RECT * ) ;
2015-05-06 17:05:07 -05:00
extern DWORD getStyle ( HWND ) ;
extern void setStyle ( HWND , DWORD ) ;
extern DWORD getExStyle ( HWND ) ;
extern void setExStyle ( HWND , DWORD ) ;
2015-05-07 16:40:13 -05:00
extern void moveWindow ( HWND , intmax_t , intmax_t , intmax_t , intmax_t ) ;
extern void moveAndReorderWindow ( HWND , HWND , intmax_t , intmax_t , intmax_t , intmax_t ) ;
2015-04-24 13:09:48 -05:00
// text.c
extern WCHAR * toUTF16 ( const char * ) ;
extern char * toUTF8 ( const WCHAR * ) ;
extern WCHAR * windowText ( HWND ) ;
// comctl32.c
extern BOOL ( * WINAPI fv_SetWindowSubclass ) ( HWND , SUBCLASSPROC , UINT_PTR , DWORD_PTR ) ;
extern BOOL ( * WINAPI fv_RemoveWindowSubclass ) ( HWND , SUBCLASSPROC , UINT_PTR ) ;
extern LRESULT ( * WINAPI fv_DefSubclassProc ) ( HWND , UINT , WPARAM , LPARAM ) ;
extern const char * initCommonControls ( void ) ;
// window.c
extern ATOM registerWindowClass ( HICON , HCURSOR ) ;
2015-04-27 21:25:27 -05:00
// container.c
extern HWND initialParent ;
extern const char * initContainer ( HICON , HCURSOR ) ;
2015-04-24 13:09:48 -05:00
// menu.c
extern HMENU makeMenubar ( void ) ;
extern const uiMenuItem * menuIDToItem ( UINT_PTR ) ;
2015-04-24 14:54:37 -05:00
extern void runMenuEvent ( WORD , uiWindow * ) ;
2015-04-30 16:05:41 -05:00
extern void freeMenubar ( HMENU ) ;
2015-05-08 13:23:22 -05:00
extern void uninitMenus ( void ) ;
2015-05-02 11:27:53 -05:00
// alloc.c
2015-05-02 11:29:55 -05:00
extern int initAlloc ( void ) ;
2015-05-08 13:05:16 -05:00
extern void uninitAlloc ( void ) ;
2015-05-06 17:37:21 -05:00
// tab.c
extern void tabEnterTabNavigation ( HWND ) ;
extern void tabLeaveTabNavigation ( HWND ) ;