1 /* Cockos SWELL (Simple/Small Win32 Emulation Layer for Linux/OSX)
2 Copyright (C) 2006 and later, Cockos, Inc.
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
21 SWELL provides _EXTREMELY BASIC_ win32 wrapping for OS X and maybe other platforms.
25 #ifndef _WDL_SWELL_H_TYPES_DEFINED_
26 #define _WDL_SWELL_H_TYPES_DEFINED_
32 #include <sys/types.h>
37 #if defined(__cplusplus)
42 typedef intptr_t INT_PTR
, *PINT_PTR
, LONG_PTR
, *PLONG_PTR
;
43 typedef uintptr_t UINT_PTR
, *PUINT_PTR
, ULONG_PTR
, *PULONG_PTR
, DWORD_PTR
, *PDWORD_PTR
;
60 // the byte ordering of RGB() etc is different than on win32
61 #define RGB(r,g,b) (((r)<<16)|((g)<<8)|(b))
62 #define GetRValue(x) (((x)>>16)&0xff)
63 #define GetGValue(x) (((x)>>8)&0xff)
64 #define GetBValue(x) ((x)&0xff)
66 // basic platform compat defines
68 #define stricmp(x,y) strcasecmp(x,y)
71 #define strnicmp(x,y,z) strncasecmp(x,y,z)
74 #define DeleteFile(x) (!unlink(x))
75 #define MoveFile(x,y) (!rename(x,y))
76 #define GetCurrentDirectory(sz,buf) (!getcwd(buf,sz))
77 #define SetCurrentDirectory(buf) (!chdir(buf))
78 #define CreateDirectory(x,y) (!mkdir((x),0755))
81 #define wsprintf sprintf
85 #define MAKEWORD(a, b) ((unsigned short)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
86 #define MAKELONG(a, b) ((int)(((unsigned short)(a)) | ((DWORD)((unsigned short)(b))) << 16))
87 #define MAKEWPARAM(l, h) (WPARAM)MAKELONG(l, h)
88 #define MAKELPARAM(l, h) (LPARAM)MAKELONG(l, h)
89 #define MAKELRESULT(l, h) (LRESULT)MAKELONG(l, h)
90 #define LOWORD(l) ((unsigned short)(l))
91 #define HIWORD(l) ((unsigned short)(((unsigned int)(l) >> 16) & 0xFFFF))
92 #define LOBYTE(w) ((BYTE)(w))
93 #define HIBYTE(w) ((BYTE)(((unsigned short)(w) >> 8) & 0xFF))
96 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
97 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
99 #define UNREFERENCED_PARAMETER(P) (P)
102 #define CallWindowProc(A,B,C,D,E) ((WNDPROC)A)(B,C,D,E)
103 #define OffsetRect WinOffsetRect //to avoid OSX's OffsetRect function
104 #define SetRect WinSetRect //to avoid OSX's SetRect function
105 #define UnionRect WinUnionRect
106 #define IntersectRect WinIntersectRect
109 #define MAX_PATH 1024
112 #if !defined(max) && !defined(WDL_NO_DEFINE_MINMAX) && !defined(NOMINMAX)
113 #define max(x,y) ((x)<(y)?(y):(x))
114 #define min(x,y) ((x)<(y)?(x):(y))
117 // SWELLAPP stuff (swellappmain.mm)
121 INT_PTR
SWELLAppMain(int msg
, INT_PTR parm1
, INT_PTR parm2
); // to be implemented by app (if using swellappmain.mm)
126 #define SWELLAPP_ONLOAD 0x0001 // initialization of app vars etc
127 #define SWELLAPP_LOADED 0x0002 // create dialogs etc
128 #define SWELLAPP_DESTROY 0x0003 // about to destroy (cleanup etc)
129 #define SWELLAPP_SHOULDDESTROY 0x0004 // return 0 to allow app to terminate, >0 to prevent
131 #define SWELLAPP_OPENFILE 0x0050 // parm1= (const char *)string, return >0 if allowed
132 #define SWELLAPP_NEWFILE 0x0051 // new file, return >0 if allowed
133 #define SWELLAPP_SHOULDOPENNEWFILE 0x0052 // allow opening new file? >0 if allowed
135 #define SWELLAPP_ONCOMMAND 0x0099 // parm1 = (int) command ID, parm2 = (id) sender
136 #define SWELLAPP_PROCESSMESSAGE 0x0100 // parm1=(MSG *)msg (loosely), parm2= (NSEvent *) the event . return >0 to eat
138 #define SWELLAPP_ACTIVATE 0x1000 // parm1 = (bool) isactive. return nonzero to prevent WM_ACTIVATEAPP from being broadcasted
145 typedef signed char BOOL
;
146 typedef unsigned char BYTE
;
147 typedef unsigned short WORD
;
148 typedef unsigned int DWORD
;
149 typedef DWORD COLORREF
;
150 typedef unsigned int UINT
;
153 typedef ULONG_PTR WPARAM
;
154 typedef LONG_PTR LPARAM
;
155 typedef LONG_PTR LRESULT
;
158 typedef void *LPVOID
, *PVOID
;
160 #if defined(__APPLE__) && !defined(__LP64__)
161 typedef signed long HRESULT
;
162 typedef signed long LONG
;
163 typedef unsigned long ULONG
;
165 typedef signed int HRESULT
;
166 typedef signed int LONG
;
167 typedef unsigned int ULONG
;
173 typedef char *LPSTR
, *LPTSTR
;
174 typedef const char *LPCSTR
, *LPCTSTR
;
176 #define __int64 long long // define rather than typedef, for unsigned __int64 support
178 typedef unsigned __int64 ULONGLONG
;
181 unsigned long long QuadPart
;
194 typedef struct HWND__
*HWND
;
195 typedef struct HMENU__
*HMENU
;
196 typedef void *HANDLE
, *HINSTANCE
, *HDROP
;
197 typedef void *HGLOBAL
;
199 typedef void (*TIMERPROC
)(HWND hwnd
, UINT uMsg
, UINT_PTR idEvent
, DWORD dwTime
);
216 LONG left
,top
, right
, bottom
;
222 unsigned short key
,cmd
;
228 DWORD dwHighDateTime
;
231 typedef struct _GUID
{
233 unsigned short Data2
;
234 unsigned short Data3
;
235 unsigned char Data4
[8];
247 typedef struct HDC__
*HDC
;
248 typedef struct HCURSOR__
*HCURSOR
;
249 typedef struct HRGN__
*HRGN
;
251 typedef struct HGDIOBJ__
*HBITMAP
;
252 typedef struct HGDIOBJ__
*HICON
;
253 typedef struct HGDIOBJ__
*HGDIOBJ
;
254 typedef struct HGDIOBJ__
*HBRUSH
;
255 typedef struct HGDIOBJ__
*HPEN
;
256 typedef struct HGDIOBJ__
*HFONT
;
269 DWORD_PTR dwItemSpec
;
270 DWORD_PTR dwItemData
;
273 } NMMOUSE
, *LPNMMOUSE
;
274 typedef NMMOUSE NMCLICK
;
275 typedef LPNMMOUSE LPNMCLICK
;
281 int cchTextMax
, iSubItem
;
285 int mask
, iItem
, iSubItem
, state
, stateMask
;
287 int cchTextMax
, iImage
;
291 typedef int (*PFNLVCOMPARE
)(LPARAM
, LPARAM
, LPARAM
);
293 typedef struct HIMAGELIST__
*HIMAGELIST
;
300 int iSubItem
; // this is was NOT in win95. valid only for LVM_SUBITEMHITTEST
301 } LVHITTESTINFO
, *LPLVHITTESTINFO
;
314 } NMLISTVIEW
, *LPNMLISTVIEW
;
320 } NMLVDISPINFO
, *LPNMLVDISPINFO
;
338 typedef struct TCITEM
350 typedef struct tagDRAWITEMSTRUCT
{
360 } DRAWITEMSTRUCT
, *PDRAWITEMSTRUCT
, *LPDRAWITEMSTRUCT
;
362 typedef struct tagBITMAP
{
369 } BITMAP
, *PBITMAP
, *LPBITMAP
;
371 #define ODT_LISTBOX 2
372 #define ODT_COMBOBOX 3
375 #define ODS_SELECTED 0x0001
386 UINT uCallbackMessage
;
389 } NOTIFYICONDATA
,*PNOTIFYICONDATA
, *LPNOTIFYICONDATA
;
392 #define NIM_ADD 0x00000000
393 #define NIM_MODIFY 0x00000001
394 #define NIM_DELETE 0x00000002
396 #define NIF_MESSAGE 0x00000001
397 #define NIF_ICON 0x00000002
398 #define NIF_TIP 0x00000004
402 typedef struct HTREEITEM__
*HTREEITEM
;
404 #define TVIF_TEXT 0x0001
405 #define TVIF_IMAGE 0x0002
406 #define TVIF_PARAM 0x0004
407 #define TVIF_STATE 0x0008
408 #define TVIF_HANDLE 0x0010
409 #define TVIF_SELECTEDIMAGE 0x0020
410 #define TVIF_CHILDREN 0x0040
412 #define TVIS_SELECTED 0x0002
413 #define TVIS_DROPHILITED 0x0008
414 #define TVIS_BOLD 0x0010
415 #define TVIS_EXPANDED 0x0020
417 #define TVE_COLLAPSE 0x0001
418 #define TVE_EXPAND 0x0002
419 #define TVE_TOGGLE 0x0003
421 #define TVN_FIRST (0U-400U) // treeview
422 #define TVN_SELCHANGED (TVN_FIRST-2)
424 #define TVI_ROOT ((HTREEITEM)0xFFFF0000)
425 #define TVI_FIRST ((HTREEITEM)0xFFFF0001)
426 #define TVI_LAST ((HTREEITEM)0xFFFF0002)
427 #define TVI_SORT ((HTREEITEM)0xFFFF0003)
429 #define TVHT_NOWHERE 0x0001
430 #define TVHT_ONITEMICON 0x0002
431 #define TVHT_ONITEMLABEL 0x0004
432 #define TVHT_ONITEM (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
433 #define TVHT_ONITEMINDENT 0x0008
434 #define TVHT_ONITEMBUTTON 0x0010
435 #define TVHT_ONITEMRIGHT 0x0020
436 #define TVHT_ONITEMSTATEICON 0x0040
438 #define TVHT_ABOVE 0x0100
439 #define TVHT_BELOW 0x0200
440 #define TVHT_TORIGHT 0x0400
441 #define TVHT_TOLEFT 0x0800
454 } TVITEM
, TV_ITEM
, *LPTVITEM
, *LPTV_ITEM
;
458 HTREEITEM hInsertAfter
;
460 } TVINSERTSTRUCT
, *LPTVINSERTSTRUCT
, TV_INSERTSTRUCT
, *LPTV_INSERTSTRUCT
;
466 } TVHITTESTINFO
, *LPTVHITTESTINFO
;
474 } NMTREEVIEW
, *LPNMTREEVIEW
;
479 unsigned int cbSize
, fMask
, fType
, fState
, wID
;
481 HICON hbmpChecked
,hbmpUnchecked
;
482 DWORD_PTR dwItemData
;
488 #define SetMenuDefaultItem(a,b,c) do { if ((a)||(b)||(c)) { } } while(0)
491 POINT ptReserved
, ptMaxSize
, ptMaxPosition
, ptMinTrackSize
, ptMaxTrackSize
;
492 } MINMAXINFO
, *LPMINMAXINFO
;
497 int lfHeight
, lfWidth
, lfEscapement
,lfOrientation
, lfWeight
;
498 char lfItalic
, lfUnderline
, lfStrikeOut
, lfCharSet
, lfOutPrecision
, lfClipPrecision
,
499 lfQuality
, lfPitchAndFamily
;
507 LONG tmInternalLeading
;
509 // todo: implement rest
527 } SCROLLINFO
, *LPSCROLLINFO
;
533 } STYLESTRUCT
, *LPSTYLESTRUCT
;
535 typedef struct _DROPFILES
{
536 DWORD pFiles
; // offset of file list
537 POINT pt
; // drop point (client coords)
538 BOOL fNC
; // is it on NonClient area
539 // and pt is in screen coords
540 BOOL fWide
; // WIDE character switch
541 } DROPFILES
, *LPDROPFILES
;
547 HWND hwndInsertAfter
;
553 } WINDOWPOS
, *LPWINDOWPOS
, *PWINDOWPOS
;
559 } NCCALCSIZE_PARAMS
, *LPNCCALCSIZE_PARAMS
;
563 typedef INT_PTR (*DLGPROC
)(HWND
, UINT
, WPARAM
, LPARAM
);
564 typedef LRESULT (*WNDPROC
)(HWND
, UINT
, WPARAM
, LPARAM
);
577 #define GID_TWOFINGERTAP 6
578 #define GID_ROLLOVER 7
580 typedef struct tagGESTUREINFO
589 ULONGLONG ullArguments
;
593 // not using this stuff yet
595 #define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 2
596 #define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 4
598 typedef struct tagGESTURECONFIG
616 typedef BOOL (*PROPENUMPROCEX
)(HWND hwnd
, const char *lpszString
, HANDLE hData
, LPARAM lParam
);
618 // swell specific type
619 typedef HWND (*SWELL_ControlCreatorProc
)(HWND parent
, const char *cname
, int idx
, const char *classname
, int style
, int x
, int y
, int w
, int h
);
621 #define DLL_PROCESS_DETACH 0
622 #define DLL_PROCESS_ATTACH 1
624 // if the user implements this (and links with swell-modstub[-generic], this will get called for DLL_PROCESS_[AT|DE]TACH
628 __attribute__ ((visibility ("default"))) BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpvReserved
);
634 ** win32 specific constants
637 #define MB_OKCANCEL 1
638 #define MB_YESNOCANCEL 3
640 #define MB_RETRYCANCEL 5
642 #define MB_ICONERROR 0
643 #define MB_ICONSTOP 0
644 #define MB_ICONINFORMATION 0
654 #define GW_HWNDFIRST 0
655 #define GW_HWNDLAST 1
656 #define GW_HWNDNEXT 2
657 #define GW_HWNDPREV 3
661 #define GWL_USERDATA (-21)
663 #define GWL_STYLE (-16) // only supported for BS_ for now I think
664 #define GWL_EXSTYLE (-20)
665 #define GWL_WNDPROC (-4)
666 #define DWL_DLGPROC (-8)
668 #define SWELL_NOT_WS_VISIBLE ((int)0x80000000)
669 #define WS_CHILDWINDOW (WS_CHILD)
670 #define WS_CHILD 0x40000000L
671 #define WS_DISABLED 0x08000000L
672 #define WS_CAPTION 0x00C00000L
673 #define WS_VSCROLL 0x00200000L
674 #define WS_HSCROLL 0x00100000L
675 #define WS_SYSMENU 0x00080000L
676 #define WS_THICKFRAME 0x00040000L
677 #define WS_GROUP 0x00020000L
678 #define WS_TABSTOP 0x00010000L
680 #define WS_BORDER 0 // ignored for now
684 #define WM_CTLCOLORMSGBOX 0x0132
685 #define WM_CTLCOLOREDIT 0x0133
686 #define WM_CTLCOLORLISTBOX 0x0134
687 #define WM_CTLCOLORBTN 0x0135
688 #define WM_CTLCOLORDLG 0x0136
689 #define WM_CTLCOLORSCROLLBAR 0x0137
690 #define WM_CTLCOLORSTATIC 0x0138
692 #define CB_ADDSTRING 0x0143
693 #define CB_DELETESTRING 0x0144
694 #define CB_GETCOUNT 0x0146
695 #define CB_GETCURSEL 0x0147
696 #define CB_GETLBTEXT 0x0148
697 #define CB_GETLBTEXTLEN 0x0149
698 #define CB_INSERTSTRING 0x014A
699 #define CB_RESETCONTENT 0x014B
700 #define CB_FINDSTRING 0x014C
701 #define CB_SETCURSEL 0x014E
702 #define CB_GETITEMDATA 0x0150
703 #define CB_SETITEMDATA 0x0151
704 #define CB_FINDSTRINGEXACT 0x0158
705 #define CB_INITSTORAGE 0x0161
707 #define LB_ADDSTRING 0x0180 // oops these don't all match real windows, todo fix (maybe)
708 #define LB_INSERTSTRING 0x0181
709 #define LB_DELETESTRING 0x0182
710 #define LB_GETTEXT 0x0183
711 #define LB_RESETCONTENT 0x0184
712 #define LB_SETSEL 0x0185
713 #define LB_SETCURSEL 0x0186
714 #define LB_GETSEL 0x0187
715 #define LB_GETCURSEL 0x0188
716 #define LB_GETTEXTLEN 0x018A
717 #define LB_GETCOUNT 0x018B
718 #define LB_GETSELCOUNT 0x0190
719 #define LB_GETITEMDATA 0x0199
720 #define LB_SETITEMDATA 0x019A
722 #define TBM_GETPOS (WM_USER)
723 #define TBM_SETTIC (WM_USER+4)
724 #define TBM_SETPOS (WM_USER+5)
725 #define TBM_SETRANGE (WM_USER+6)
726 #define TBM_SETSEL (WM_USER+10)
728 #define PBM_SETRANGE (WM_USER+1)
729 #define PBM_SETPOS (WM_USER+2)
730 #define PBM_DELTAPOS (WM_USER+3)
732 #define BM_GETCHECK 0x00F0
733 #define BM_SETCHECK 0x00F1
734 #define BM_GETIMAGE 0x00F6
735 #define BM_SETIMAGE 0x00F7
736 #define IMAGE_BITMAP 0
739 #define NM_FIRST (0U- 0U) // generic to all controls
740 #define NM_LAST (0U- 99U)
741 #define NM_CLICK (NM_FIRST-2) // uses NMCLICK struct
742 #define NM_DBLCLK (NM_FIRST-3)
743 #define NM_RCLICK (NM_FIRST-5) // uses NMCLICK struct
746 #define LVSIL_STATE 1
747 #define LVSIL_SMALL 2
749 #define LVIR_BOUNDS 0
752 #define LVIR_SELECTBOUNDS 3
755 #define LVHT_NOWHERE 0x0001
756 #define LVHT_ONITEMICON 0x0002
757 #define LVHT_ONITEMLABEL 0x0004
758 #define LVHT_ONITEMSTATEICON 0x0008
759 #define LVHT_ONITEM (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
761 #define LVHT_ABOVE 0x0010
762 #define LVHT_BELOW 0x0020
763 #define LVHT_TORIGHT 0x0040
764 #define LVHT_TOLEFT 0x0080
770 #define LVCFMT_LEFT 0
771 #define LVCFMT_RIGHT 1
772 #define LVCFMT_CENTER 2
779 #define LVIS_SELECTED 1
780 #define LVIS_FOCUSED 2
781 #define LVNI_SELECTED 1
782 #define LVNI_FOCUSED 2
783 #define INDEXTOSTATEIMAGEMASK(x) ((x)<<16)
784 #define LVIS_STATEIMAGEMASK (255<<16)
786 #define LVN_FIRST (0U-100U) // listview
787 #define LVN_LAST (0U-199U)
788 #define LVN_BEGINDRAG (LVN_FIRST-9)
789 #define LVN_COLUMNCLICK (LVN_FIRST-8)
790 #define LVN_ITEMCHANGED (LVN_FIRST-1)
791 #define LVN_ODFINDITEM (LVN_FIRST-52)
792 #define LVN_GETDISPINFO (LVN_FIRST-50)
794 #define LVS_EX_GRIDLINES 0x01
795 #define LVS_EX_HEADERDRAGDROP 0x10
796 #define LVS_EX_FULLROWSELECT 0x20 // ignored for now (enabled by default on OSX)
798 #define HDI_FORMAT 0x4
799 #define HDF_SORTUP 0x0400
800 #define HDF_SORTDOWN 0x0200
802 #define TCIF_TEXT 0x0001
803 #define TCIF_IMAGE 0x0002
804 #define TCIF_PARAM 0x0008
805 //#define TCIF_STATE 0x0010
809 #define TCN_FIRST (0U-550U) // tab control
810 #define TCN_LAST (0U-580U)
811 #define TCN_SELCHANGE (TCN_FIRST - 1)
814 #define BS_AUTOCHECKBOX 0x00000003L
815 #define BS_AUTO3STATE 0x00000006L
816 #define BS_AUTORADIOBUTTON 0x00000009L
817 #define BS_OWNERDRAW 0x0000000BL
818 #define BS_BITMAP 0x00000080L
822 #define BST_CHECKED 1
823 #define BST_UNCHECKED 0
824 #define BST_INDETERMINATE 2
826 // note: these differ in values from their win32 counterparts, because we got them
827 // wrong to begin with, and we'd like to keep backwards compatability for things compiled
828 // against an old swell.h (and using the SWELL API via an exported mechanism, i.e. third party
831 #define SW_SHOWNA 1 // 8 on win32
832 #define SW_SHOW 2 // 1 on win32
833 #define SW_SHOWMINIMIZED 3 // 2 on win32
835 // aliases (todo implement these as needed)
836 #define SW_SHOWNOACTIVATE SW_SHOWNA
837 #define SW_NORMAL SW_SHOW
838 #define SW_SHOWNORMAL SW_SHOW
839 #define SW_SHOWMAXIMIZED SW_SHOW
840 #define SW_SHOWDEFAULT SW_SHOWNORMAL
841 #define SW_RESTORE SW_SHOWNA
845 #define SWP_NOZORDER 4
846 #define SWP_NOACTIVATE 8
847 #define SWP_SHOWWINDOW 16
848 #define SWP_FRAMECHANGED 32
849 #define SWP_NOCOPYBITS 0
850 #define HWND_TOP ((HWND)0)
851 #define HWND_BOTTOM ((HWND)1)
852 #define HWND_TOPMOST ((HWND)-1)
853 #define HWND_NOTOPMOST ((HWND)-2)
855 // most of these are ignored, actually, but TPM_NONOTIFY and TPM_RETURNCMD are now used
856 #define TPM_LEFTBUTTON 0x0000L
857 #define TPM_RIGHTBUTTON 0x0002L
858 #define TPM_LEFTALIGN 0x0000L
859 #define TPM_CENTERALIGN 0x0004L
860 #define TPM_RIGHTALIGN 0x0008L
861 #define TPM_TOPALIGN 0x0000L
862 #define TPM_VCENTERALIGN 0x0010L
863 #define TPM_BOTTOMALIGN 0x0020L
864 #define TPM_HORIZONTAL 0x0000L /* Horz alignment matters more */
865 #define TPM_VERTICAL 0x0040L /* Vert alignment matters more */
866 #define TPM_NONOTIFY 0x0080L /* Don't send any notification msgs */
867 #define TPM_RETURNCMD 0x0100L
872 #define MIIM_SUBMENU 8
874 #define MIIM_BITMAP 0x80
878 #define MF_DISABLED 2
881 #define MF_UNCHECKED 0
883 #define MF_POPUP 0x10
884 #define MF_BYCOMMAND 0
885 #define MF_BYPOSITION 0x400
886 #define MF_SEPARATOR 0x800
888 #define MFT_STRING MF_STRING
889 #define MFT_BITMAP MF_BITMAP
890 #define MFT_SEPARATOR MF_SEPARATOR
891 #define MFT_RADIOCHECK 0x200
893 #define MFS_GRAYED (MF_GRAYED|MF_DISABLED)
894 #define MFS_DISABLED MFS_GRAYED
895 #define MFS_CHECKED MF_CHECKED
896 #define MFS_ENABLED MF_ENABLED
897 #define MFS_UNCHECKED MF_UNCHECKED
899 #define EN_SETFOCUS 0x0100
900 #define EN_KILLFOCUS 0x0200
901 #define EN_CHANGE 0x0300
902 #define STN_CLICKED 0
904 #define WM_CREATE 0x0001
905 #define WM_DESTROY 0x0002
906 #define WM_MOVE 0x0003
907 #define WM_SIZE 0x0005
908 #define WM_ACTIVATE 0x0006
909 #define WM_SETREDRAW 0x000B // implemented on macOS NSTableViews, maybe elsewhere?
910 #define WM_SETTEXT 0x000C // not implemented on OSX, used internally on Linux
911 #define WM_PAINT 0x000F
912 #define WM_CLOSE 0x0010
913 #define WM_ERASEBKGND 0x0014
914 #define WM_SHOWWINDOW 0x0018
915 #define WM_ACTIVATEAPP 0x001C
916 #define WM_SETCURSOR 0x0020
917 #define WM_MOUSEACTIVATE 0x0021
918 #define WM_GETMINMAXINFO 0x0024
919 #define WM_DRAWITEM 0x002B
920 #define WM_SETFONT 0x0030
921 #define WM_GETFONT 0x0031
922 #define WM_GETOBJECT 0x003D // implemented differently than win32 -- see virtwnd/virtwnd-nsaccessibility.mm
923 #define WM_COPYDATA 0x004A
924 #define WM_NOTIFY 0x004E
925 #define WM_CONTEXTMENU 0x007B
926 #define WM_STYLECHANGED 0x007D
927 #define WM_DISPLAYCHANGE 0x007E
928 #define WM_NCDESTROY 0x0082
929 #define WM_NCCALCSIZE 0x0083
930 #define WM_NCHITTEST 0x0084
931 #define WM_NCPAINT 0x0085
932 #define WM_NCMOUSEMOVE 0x00A0
933 #define WM_NCLBUTTONDOWN 0x00A1
934 #define WM_NCLBUTTONUP 0x00A2
935 #define WM_NCLBUTTONDBLCLK 0x00A3
936 #define WM_NCRBUTTONDOWN 0x00A4
937 #define WM_NCRBUTTONUP 0x00A5
938 #define WM_NCRBUTTONDBLCLK 0x00A6
939 #define WM_NCMBUTTONDOWN 0x00A7
940 #define WM_NCMBUTTONUP 0x00A8
941 #define WM_NCMBUTTONDBLCLK 0x00A9
942 #define WM_KEYFIRST 0x0100
943 #define WM_KEYDOWN 0x0100
944 #define WM_KEYUP 0x0101
945 #define WM_CHAR 0x0102
946 #define WM_DEADCHAR 0x0103
947 #define WM_SYSKEYDOWN 0x0104
948 #define WM_SYSKEYUP 0x0105
949 #define WM_SYSCHAR 0x0106
950 #define WM_SYSDEADCHAR 0x0107
951 #define WM_KEYLAST 0x0108
952 #define WM_INITDIALOG 0x0110
953 #define WM_COMMAND 0x0111
954 #define WM_SYSCOMMAND 0x0112
955 #define SC_CLOSE 0xF060
956 #define WM_TIMER 0x0113
957 #define WM_HSCROLL 0x0114
958 #define WM_VSCROLL 0x0115
959 #define WM_INITMENUPOPUP 0x0117
960 #define WM_GESTURE 0x0119
961 #define WM_MOUSEFIRST 0x0200
962 #define WM_MOUSEMOVE 0x0200
963 #define WM_LBUTTONDOWN 0x0201
964 #define WM_LBUTTONUP 0x0202
965 #define WM_LBUTTONDBLCLK 0x0203
966 #define WM_RBUTTONDOWN 0x0204
967 #define WM_RBUTTONUP 0x0205
968 #define WM_RBUTTONDBLCLK 0x0206
969 #define WM_MBUTTONDOWN 0x0207
970 #define WM_MBUTTONUP 0x0208
971 #define WM_MBUTTONDBLCLK 0x0209
972 #define WM_MOUSEWHEEL 0x020A
973 #define WM_MOUSEHWHEEL 0x020E
974 #define WM_MOUSELAST 0x020A
975 #define WM_CAPTURECHANGED 0x0215
976 #define WM_DROPFILES 0x0233
977 #define WM_USER 0x0400
980 #define HTBOTTOMRIGHT 17
982 #define WA_INACTIVE 0
984 #define WA_CLICKACTIVE 2
988 #define LBN_SELCHANGE 1
992 #define CBN_SELCHANGE 1
993 #define CBN_EDITCHANGE 5
994 #define CBN_DROPDOWN 7
995 #define CBN_CLOSEUP 8
998 #define EM_GETSEL 0xF0B0
999 #define EM_SETSEL 0xF0B1
1000 #define EM_SCROLL 0xF0B5
1001 #define EM_SETPASSWORDCHAR 0xF0CC
1009 #define SB_LINELEFT 0
1010 #define SB_LINEDOWN 1
1011 #define SB_LINERIGHT 1
1013 #define SB_PAGELEFT 2
1014 #define SB_PAGEDOWN 3
1015 #define SB_PAGERIGHT 3
1016 #define SB_THUMBPOSITION 4
1017 #define SB_THUMBTRACK 5
1022 #define SB_ENDSCROLL 8
1024 #define DFCS_SCROLLUP 0x0000
1025 #define DFCS_SCROLLDOWN 0x0001
1026 #define DFCS_SCROLLLEFT 0x0002
1027 #define DFCS_SCROLLRIGHT 0x0003
1028 #define DFCS_SCROLLCOMBOBOX 0x0005
1029 #define DFCS_SCROLLSIZEGRIP 0x0008
1030 #define DFCS_SCROLLSIZEGRIPRIGHT 0x0010
1032 #define DFCS_INACTIVE 0x0100
1033 #define DFCS_PUSHED 0x0200
1034 #define DFCS_CHECKED 0x0400
1035 #define DFCS_FLAT 0x4000
1037 #define DFCS_BUTTONPUSH 0x0010
1039 #define DFC_SCROLL 3
1040 #define DFC_BUTTON 4
1042 #define ESB_ENABLE_BOTH 0x0000
1043 #define ESB_DISABLE_BOTH 0x0003
1045 #define ESB_DISABLE_LEFT 0x0001
1046 #define ESB_DISABLE_RIGHT 0x0002
1048 #define ESB_DISABLE_UP 0x0001
1049 #define ESB_DISABLE_DOWN 0x0002
1051 #define BDR_RAISEDOUTER 0x0001
1052 #define BDR_SUNKENOUTER 0x0002
1053 #define BDR_RAISEDINNER 0x0004
1054 #define BDR_SUNKENINNER 0x0008
1056 #define BDR_OUTER 0x0003
1057 #define BDR_INNER 0x000c
1059 #define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER)
1060 #define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER)
1061 #define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER)
1062 #define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER)
1064 #define BF_ADJUST 0x2000
1065 #define BF_FLAT 0x4000
1066 #define BF_LEFT 0x0001
1067 #define BF_TOP 0x0002
1068 #define BF_RIGHT 0x0004
1069 #define BF_BOTTOM 0x0008
1070 #define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM)
1072 #define PATCOPY (DWORD)0x00F00021
1077 #define WS_EX_LEFTSCROLLBAR 0x00004000L
1078 #define WS_EX_ACCEPTFILES 0x00000010L
1080 #define SIF_RANGE 0x0001
1081 #define SIF_PAGE 0x0002
1082 #define SIF_POS 0x0004
1083 #define SIF_DISABLENOSCROLL 0x0008
1084 #define SIF_TRACKPOS 0x0010
1085 #define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
1087 #define SIZE_RESTORED 0
1088 #define SIZE_MINIMIZED 1
1089 #define SIZE_MAXIMIZED 2
1090 #define SIZE_MAXSHOW 3
1091 #define SIZE_MAXHIDE 4
1094 #ifndef MAKEINTRESOURCE
1095 #define MAKEINTRESOURCE(x) ((const char *)(UINT_PTR)(x))
1104 #define FCONTROL 0x08
1109 #define VK_LBUTTON 0x01
1110 #define VK_RBUTTON 0x02
1111 #define VK_MBUTTON 0x04
1113 #define VK_BACK 0x08
1116 #define VK_CLEAR 0x0C
1117 #define VK_RETURN 0x0D
1119 #define VK_SHIFT 0x10
1120 #define VK_CONTROL 0x11
1121 #define VK_MENU 0x12
1122 #define VK_PAUSE 0x13
1123 #define VK_CAPITAL 0x14
1125 #define VK_ESCAPE 0x1B
1127 #define VK_SPACE 0x20
1128 #define VK_PRIOR 0x21
1129 #define VK_NEXT 0x22
1131 #define VK_HOME 0x24
1132 #define VK_LEFT 0x25
1134 #define VK_RIGHT 0x27
1135 #define VK_DOWN 0x28
1136 #define VK_SELECT 0x29
1137 #define VK_PRINT 0x2A
1138 #define VK_SNAPSHOT 0x2C
1139 #define VK_INSERT 0x2D
1140 #define VK_DELETE 0x2E
1141 #define VK_HELP 0x2F
1143 #define VK_LWIN 0x5B
1145 #define VK_NUMPAD0 0x60
1146 #define VK_NUMPAD1 0x61
1147 #define VK_NUMPAD2 0x62
1148 #define VK_NUMPAD3 0x63
1149 #define VK_NUMPAD4 0x64
1150 #define VK_NUMPAD5 0x65
1151 #define VK_NUMPAD6 0x66
1152 #define VK_NUMPAD7 0x67
1153 #define VK_NUMPAD8 0x68
1154 #define VK_NUMPAD9 0x69
1155 #define VK_MULTIPLY 0x6A
1157 #define VK_SEPARATOR 0x6C
1158 #define VK_SUBTRACT 0x6D
1159 #define VK_DECIMAL 0x6E
1160 #define VK_DIVIDE 0x6F
1186 #define VK_NUMLOCK 0x90
1187 #define VK_SCROLL 0x91
1189 #define MK_LBUTTON 0x01
1190 #define MK_RBUTTON 0x02
1191 #define MK_MBUTTON 0x10
1194 #define IDC_SIZENESW MAKEINTRESOURCE(32643)
1195 #define IDC_SIZENWSE MAKEINTRESOURCE(32642)
1196 #define IDC_IBEAM MAKEINTRESOURCE(32513)
1197 #define IDC_UPARROW MAKEINTRESOURCE(32516)
1198 #define IDC_NO MAKEINTRESOURCE(32648)
1199 #define IDC_SIZEALL MAKEINTRESOURCE(32646)
1200 #define IDC_SIZENS MAKEINTRESOURCE(32645)
1201 #define IDC_SIZEWE MAKEINTRESOURCE(32644)
1202 #define IDC_ARROW MAKEINTRESOURCE(32512)
1203 #define IDC_HAND MAKEINTRESOURCE(32649)
1207 #define COLOR_3DSHADOW 0
1208 #define COLOR_3DHILIGHT 1
1209 #define COLOR_3DFACE 2
1210 #define COLOR_BTNTEXT 3
1211 #define COLOR_WINDOW 4
1212 #define COLOR_SCROLLBAR 5
1213 #define COLOR_3DDKSHADOW 6
1214 #define COLOR_BTNFACE 7
1215 #define COLOR_INFOBK 8
1216 #define COLOR_INFOTEXT 9
1219 #define SRCCOPY_USEALPHACHAN 0xdeadbeef
1226 #define DT_VCENTER 4
1228 #define DT_WORDBREAK 0x10
1229 #define DT_SINGLELINE 0x20
1230 #define DT_NOCLIP 0x100
1231 #define DT_CALCRECT 0x400
1232 #define DT_NOPREFIX 0x800
1233 #define DT_END_ELLIPSIS 0x8000
1235 #define FW_DONTCARE 0
1237 #define FW_EXTRALIGHT 200
1238 #define FW_LIGHT 300
1239 #define FW_NORMAL 400
1240 #define FW_MEDIUM 500
1241 #define FW_SEMIBOLD 600
1243 #define FW_EXTRABOLD 800
1244 #define FW_HEAVY 900
1246 #define FW_ULTRALIGHT FW_EXTRALIGHT
1247 #define FW_REGULAR FW_NORMAL
1248 #define FW_DEMIBOLD FW_SEMIBOLD
1249 #define FW_ULTRABOLD FW_EXTRABOLD
1250 #define FW_BLACK FW_HEAVY
1252 #define OUT_DEFAULT_PRECIS 0
1253 #define CLIP_DEFAULT_PRECIS 0
1254 #define DEFAULT_QUALITY 0
1255 #define DRAFT_QUALITY 1
1256 #define PROOF_QUALITY 2
1257 #define NONANTIALIASED_QUALITY 3
1258 #define ANTIALIASED_QUALITY 4
1259 #define CLEARTYPE_QUALITY ANTIALIASED_QUALITY
1260 #define DEFAULT_PITCH 0
1261 #define DEFAULT_CHARSET 0
1262 #define ANSI_CHARSET 0
1263 #define TRANSPARENT 0
1267 #define NULL_BRUSH 2
1269 #define GGI_MARK_NONEXISTING_GLYPHS 1
1271 #define GMEM_ZEROINIT 1
1272 #define GMEM_FIXED 0
1273 #define GMEM_MOVEABLE 0
1274 #define GMEM_DDESHARE 0
1275 #define GMEM_DISCARDABLE 0
1276 #define GMEM_SHARE 0
1277 #define GMEM_LOWER 0
1278 #define GHND (GMEM_MOVEABLE|GM_ZEROINIT)
1279 #define GPTR (GMEM_FIXED|GMEM_ZEROINIT)
1282 #define _MCW_RC 0x00000300 /* Rounding Control */
1283 #define _RC_NEAR 0x00000000 /* near */
1284 #define _RC_DOWN 0x00000100 /* down */
1285 #define _RC_UP 0x00000200 /* up */
1286 #define _RC_CHOP 0x00000300 /* chop */
1289 extern struct SWELL_DialogResourceIndex
*SWELL_curmodule_dialogresource_head
;
1290 extern struct SWELL_MenuResourceIndex
*SWELL_curmodule_menuresource_head
;
1298 #define SM_CXSCREEN 0
1299 #define SM_CYSCREEN 1
1300 #define SM_CXVSCROLL 2
1301 #define SM_CYHSCROLL 3
1302 #define SM_CYVSCROLL 20
1303 #define SM_CXHSCROLL 21
1306 #if 0 // these are disabled until implemented
1308 #define SM_CYCAPTION 4
1309 #define SM_CXBORDER 5
1310 #define SM_CYBORDER 6
1311 #define SM_CXDLGFRAME 7
1312 #define SM_CYDLGFRAME 8
1313 #define SM_CYVTHUMB 9
1314 #define SM_CXHTHUMB 10
1315 #define SM_CXICON 11
1316 #define SM_CYICON 12
1317 #define SM_CXCURSOR 13
1318 #define SM_CYCURSOR 14
1319 #define SM_CYMENU 15
1320 #define SM_CXFULLSCREEN 16
1321 #define SM_CYFULLSCREEN 17
1322 #define SM_CYKANJIWINDOW 18
1323 #define SM_MOUSEPRESENT 19
1325 #define SM_SWAPBUTTON 23
1328 #define SM_CXSIZE 30
1329 #define SM_CYSIZE 31
1330 #define SM_CXFRAME 32
1331 #define SM_CYFRAME 33
1332 #define SM_CXMINTRACK 34
1333 #define SM_CYMINTRACK 35
1334 #define SM_CXDOUBLECLK 36
1335 #define SM_CYDOUBLECLK 37
1336 #define SM_CXICONSPACING 38
1337 #define SM_CYICONSPACING 39
1339 #endif // unimplemented system metrics
1342 #define THREAD_BASE_PRIORITY_LOWRT 15
1343 #define THREAD_BASE_PRIORITY_MAX 2
1344 #define THREAD_BASE_PRIORITY_MIN -2
1345 #define THREAD_BASE_PRIORITY_IDLE -15
1346 #define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN
1347 #define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1)
1348 #define THREAD_PRIORITY_NORMAL 0
1349 #define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX
1350 #define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1)
1351 #define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT
1352 #define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
1356 #define WAIT_OBJECT_0 (0 )
1357 #define WAIT_TIMEOUT (0x00000102L)
1358 #define WAIT_FAILED (DWORD)0xFFFFFFFF
1359 #define INFINITE 0xFFFFFFFF
1362 #define FR_PRIVATE 1 // AddFontResourceEx()
1364 typedef struct _ICONINFO
1371 } ICONINFO
, *PICONINFO
;
1373 typedef struct _COPYDATASTRUCT
1378 } COPYDATASTRUCT
, *PCOPYDATASTRUCT
;
1381 #endif //_WDL_SWELL_H_TYPES_DEFINED_