2014-08-14 09:42:10 -05:00
// 17 july 2014
2014-07-17 18:36:24 -05:00
2014-08-14 09:42:10 -05:00
// cgo will include this file multiple times
2014-07-17 22:52:07 -05:00
# ifndef __GO_UI_WINAPI_WINDOWS_H__
# define __GO_UI_WINAPI_WINDOWS_H__
2014-07-17 18:36:24 -05:00
# define UNICODE
# define _UNICODE
# define STRICT
# define STRICT_TYPED_ITEMIDS
2014-08-14 09:42:10 -05:00
// get Windows version right; right now Windows XP
2014-07-17 18:36:24 -05:00
# 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>
2014-07-25 14:58:24 -05:00
# include <uxtheme.h>
2014-08-01 18:15:03 -05:00
# include <string.h>
# include <wchar.h>
2014-08-05 11:49:08 -05:00
# include <windowsx.h>
2014-08-17 12:34:06 -05:00
# include <vsstyle.h>
# include <vssym32.h>
2014-07-17 18:36:24 -05:00
2014-08-14 09:42:10 -05:00
// global messages unique to everything
2014-07-17 18:36:24 -05:00
enum {
2014-08-14 09:42:10 -05:00
msgRequest = WM_APP + 1 , // + 1 just to be safe
msgCOMMAND , // WM_COMMAND proxy; see forwardCommand() in controls_windows.go
msgNOTIFY , // WM_NOTIFY proxy
2014-08-05 11:05:43 -05:00
msgAreaSizeChanged ,
2014-08-21 12:01:50 -05:00
msgAreaGetScroll ,
msgAreaRepaint ,
2014-08-05 11:05:43 -05:00
msgAreaRepaintAll ,
2014-08-14 12:05:31 -05:00
msgTabCurrentTabHasChildren ,
2014-08-21 04:37:24 -05:00
msgAreaKeyDown ,
msgAreaKeyUp ,
2014-08-25 15:53:47 -05:00
msgLoadImageList ,
msgTableMakeInitialCheckboxImageList ,
2014-08-26 11:52:32 -05:00
msgOpenFileDone ,
2014-07-17 18:36:24 -05:00
} ;
2014-11-05 12:35:39 -06:00
// there are a number of places where we need to know what window class an arbitrary handle has
// theoretically we could use the class atom to avoid a _wcsicmp()
// however, raymond chen advises against this - http://blogs.msdn.com/b/oldnewthing/archive/2004/10/11/240744.aspx (and we're not in control of the Tab class, before you say anything)
// MSDN says 256 is the maximum length of a class name; add a few characters just to be safe (because it doesn't say whether this includes the terminating null character)
// TODO localize this to a helper function
# define maxClassName 260
2014-08-14 09:42:10 -05:00
// uitask_windows.c
2014-07-17 18:36:24 -05:00
extern void uimsgloop ( void ) ;
extern void issue ( void * ) ;
extern HWND msgwin ;
extern DWORD makemsgwin ( char * * ) ;
2014-07-17 19:05:47 -05:00
2014-08-14 09:42:10 -05:00
// comctl32_windows.c
2014-08-12 11:05:23 -05:00
extern DWORD initCommonControls ( char * * ) ;
2014-08-14 09:42:10 -05:00
// these are listed as WINAPI in both Microsoft's and MinGW's headers, but not on MSDN for some reason
2014-07-17 19:05:47 -05:00
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 ) ;
2014-08-16 13:02:00 -05:00
extern HIMAGELIST ( * WINAPI fv_ImageList_Create ) ( int , int , UINT , int , int ) ;
extern int ( * WINAPI fv_ImageList_Add ) ( HIMAGELIST , HBITMAP , HBITMAP ) ;
2014-08-25 15:53:47 -05:00
extern BOOL ( * WINAPI fv_ImageList_Destroy ) ( HIMAGELIST ) ;
2014-07-17 21:16:32 -05:00
2014-08-14 09:42:10 -05:00
// control_windows.c
2014-08-03 20:52:21 -05:00
extern HWND newControl ( LPWSTR , DWORD , DWORD ) ;
2014-07-17 21:16:32 -05:00
extern void controlSetParent ( HWND , HWND ) ;
2014-07-18 10:20:18 -05:00
extern void controlSetControlFont ( HWND ) ;
2014-08-09 09:26:42 -05:00
extern void moveWindow ( HWND , int , int , int , int ) ;
extern LONG controlTextLength ( HWND , LPWSTR ) ;
2014-08-14 09:42:10 -05:00
// basicctrls_windows.c
2014-07-17 21:16:32 -05:00
extern void setButtonSubclass ( HWND , void * ) ;
2014-07-21 20:34:52 -05:00
extern void setCheckboxSubclass ( HWND , void * ) ;
extern BOOL checkboxChecked ( HWND ) ;
extern void checkboxSetChecked ( HWND , BOOL ) ;
2014-08-22 12:57:32 -05:00
# define textfieldStyle (ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP)
# define textfieldExtStyle (WS_EX_CLIENTEDGE)
2014-08-20 11:04:36 -05:00
extern void setTextFieldSubclass ( HWND , void * ) ;
2014-08-20 13:17:00 -05:00
extern void textfieldSetAndShowInvalidBalloonTip ( HWND , WCHAR * ) ;
extern void textfieldHideInvalidBalloonTip ( HWND ) ;
2014-11-05 11:59:44 -06:00
extern int textfieldReadOnly ( HWND ) ;
extern void textfieldSetReadOnly ( HWND , BOOL ) ;
2014-10-27 09:41:10 -05:00
extern void setGroupSubclass ( HWND , void * ) ;
2014-11-01 07:35:21 -05:00
extern HWND newUpDown ( HWND , void * ) ;
2014-11-02 19:49:39 -06:00
extern void setSpinboxEditSubclass ( HWND , void * ) ;
2014-11-04 08:18:57 -06:00
extern LPWSTR xPROGRESS_CLASS ;
2014-07-17 21:33:03 -05:00
2014-08-14 09:42:10 -05:00
// init_windows.c
2014-07-17 22:56:16 -05:00
extern HINSTANCE hInstance ;
2014-07-17 21:33:03 -05:00
extern int nCmdShow ;
extern HICON hDefaultIcon ;
extern HCURSOR hArrowCursor ;
2014-07-18 10:20:18 -05:00
extern HFONT controlFont ;
extern HFONT titleFont ;
extern HFONT smallTitleFont ;
extern HFONT menubarFont ;
extern HFONT statusbarFont ;
2014-08-05 15:30:12 -05:00
extern HBRUSH hollowBrush ;
2014-07-17 21:33:03 -05:00
extern DWORD initWindows ( char * * ) ;
2014-07-17 21:47:04 -05:00
2014-08-14 09:42:10 -05:00
// window_windows.c
2014-07-17 22:11:16 -05:00
extern DWORD makeWindowWindowClass ( char * * ) ;
2014-08-04 18:46:49 -05:00
extern HWND newWindow ( LPWSTR , int , int , void * ) ;
2014-07-17 22:11:16 -05:00
extern void windowClose ( HWND ) ;
2014-07-17 22:45:12 -05:00
2014-08-14 09:42:10 -05:00
// common_windows.c
2014-07-17 22:45:12 -05:00
extern LRESULT getWindowTextLen ( HWND ) ;
2014-08-01 17:25:59 -05:00
extern void getWindowText ( HWND , WPARAM , LPWSTR ) ;
extern void setWindowText ( HWND , LPWSTR ) ;
2014-07-17 22:45:12 -05:00
extern void updateWindow ( HWND ) ;
2014-10-18 16:03:07 -05:00
extern void * getWindowData ( HWND , UINT , WPARAM , LPARAM , LRESULT * ) ;
2014-08-14 15:00:31 -05:00
extern BOOL sharedWndProc ( HWND , UINT , WPARAM , LPARAM , LRESULT * ) ;
2014-08-28 09:30:53 -05:00
extern void paintControlBackground ( HWND , HDC ) ;
2014-07-17 22:52:07 -05:00
2014-08-14 09:42:10 -05:00
// tab_windows.go
2014-08-01 17:25:59 -05:00
extern LPWSTR xWC_TABCONTROL ;
2014-07-25 14:58:24 -05:00
extern void setTabSubclass ( HWND , void * ) ;
2014-08-01 17:25:59 -05:00
extern void tabAppend ( HWND , LPWSTR ) ;
2014-07-25 14:58:24 -05:00
extern void tabGetContentRect ( HWND , RECT * ) ;
2014-08-02 10:05:18 -05:00
extern LONG tabGetTabHeight ( HWND ) ;
2014-08-14 10:30:48 -05:00
extern void tabEnterChildren ( HWND ) ;
extern void tabLeaveChildren ( HWND ) ;
2014-07-25 14:58:24 -05:00
2014-08-14 09:42:10 -05:00
// table_windows.go
2014-08-01 17:25:59 -05:00
extern LPWSTR xWC_LISTVIEW ;
2014-07-28 19:52:32 -05:00
extern void setTableSubclass ( HWND , void * ) ;
2014-08-01 17:25:59 -05:00
extern void tableAppendColumn ( HWND , int , LPWSTR ) ;
2014-07-28 19:52:32 -05:00
extern void tableUpdate ( HWND , int ) ;
2014-07-28 22:47:45 -05:00
extern void tableAddExtendedStyles ( HWND , LPARAM ) ;
2014-08-14 08:20:20 -05:00
extern void tableAutosizeColumns ( HWND , int ) ;
2014-08-18 01:22:27 -05:00
extern intptr_t tableSelectedItem ( HWND ) ;
extern void tableSelectItem ( HWND , intptr_t ) ;
2014-07-28 19:52:32 -05:00
2014-08-14 09:42:10 -05:00
// container_windows.c
2014-10-18 16:03:07 -05:00
extern RECT containerBounds ( HWND ) ;
2014-08-09 09:26:42 -05:00
extern void calculateBaseUnits ( HWND , int * , int * , LONG * ) ;
2014-08-04 18:46:49 -05:00
2014-08-23 19:39:47 -05:00
// area_windows.c
2014-08-13 09:41:27 -05:00
# define areaWindowClass L"gouiarea"
2014-08-21 12:01:50 -05:00
extern void repaintArea ( HWND , RECT * ) ;
2014-08-05 11:05:43 -05:00
extern DWORD makeAreaWindowClass ( char * * ) ;
2014-08-05 11:17:44 -05:00
extern HWND newArea ( void * ) ;
2014-08-23 19:39:47 -05:00
extern HWND newAreaTextField ( HWND , void * ) ;
extern void areaOpenTextField ( HWND , HWND , int , int , int , int ) ;
extern void areaMarkTextFieldDone ( HWND ) ;
2014-08-05 11:05:43 -05:00
2014-08-16 13:02:00 -05:00
// imagelist_windows.c
extern HBITMAP unscaledBitmap ( void * , intptr_t , intptr_t ) ;
extern HIMAGELIST newImageList ( int , int ) ;
2014-08-16 16:37:21 -05:00
extern void addImage ( HIMAGELIST , HWND , HBITMAP , int , int , int , int ) ;
2014-08-25 15:53:47 -05:00
extern void applyImageList ( HWND , UINT , WPARAM , HIMAGELIST , HIMAGELIST ) ;
2014-08-17 12:34:06 -05:00
enum {
checkboxStateChecked = 1 < < 0 ,
checkboxStateHot = 1 < < 1 ,
checkboxStatePushed = 1 < < 2 ,
checkboxnStates = 1 < < 3 ,
} ;
2014-08-25 13:04:20 -05:00
extern HIMAGELIST makeCheckboxImageList ( HWND , HTHEME * ) ;
2014-08-16 13:02:00 -05:00
2014-08-18 18:01:56 -05:00
// dialog_windows.c
2014-08-26 11:52:32 -05:00
extern void openFile ( HWND , void * ) ;
2014-08-18 18:01:56 -05:00
2014-07-17 22:52:07 -05:00
# endif