| 1 | /* $Id: controls.h,v 1.1 2002-06-02 10:09:28 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Win32 common controls | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 1999 Christoph Bratschi | 
|---|
| 6 | * | 
|---|
| 7 | */ | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef __CONTROLS_H | 
|---|
| 10 | #define __CONTROLS_H | 
|---|
| 11 |  | 
|---|
| 12 | #include <win\win.h> | 
|---|
| 13 | #include <heapstring.h> | 
|---|
| 14 |  | 
|---|
| 15 | #define GetInfoPtr(hwnd) (GetWindowLongA(hwnd,0)) | 
|---|
| 16 | #define SetInfoPtr(hwnd,data) \ | 
|---|
| 17 | SetWindowLongA(hwnd,0,data) | 
|---|
| 18 |  | 
|---|
| 19 | void CONTROLS_Register(); | 
|---|
| 20 | void CONTROLS_Unregister(); | 
|---|
| 21 |  | 
|---|
| 22 | BOOL BUTTON_Register(); | 
|---|
| 23 | BOOL BUTTON_Unregister(); | 
|---|
| 24 | BOOL COMBO_Register(); | 
|---|
| 25 | BOOL COMBO_Unregister(); | 
|---|
| 26 | BOOL EDIT_Register(); | 
|---|
| 27 | BOOL EDIT_Unregister(); | 
|---|
| 28 | BOOL LISTBOX_Register(); | 
|---|
| 29 | BOOL LISTBOX_Unregister(); | 
|---|
| 30 | BOOL COMBOLBOX_Register(); | 
|---|
| 31 | BOOL COMBOLBOX_Unregister(); | 
|---|
| 32 | BOOL COMBOBOX_Register(); | 
|---|
| 33 | BOOL COMBOBOX_Unregister(); | 
|---|
| 34 | BOOL SCROLLBAR_Register(); | 
|---|
| 35 | BOOL SCROLLBAR_Unregister(); | 
|---|
| 36 | BOOL STATIC_Register(); | 
|---|
| 37 | BOOL STATIC_Unregister(); | 
|---|
| 38 |  | 
|---|
| 39 | #define BUTTON_CONTROL          0 | 
|---|
| 40 | #define STATIC_CONTROL          1 | 
|---|
| 41 | #define SCROLLBAR_CONTROL       2 | 
|---|
| 42 | #define LISTBOX_CONTROL         3 | 
|---|
| 43 | #define COMBOLBOX_CONTROL       4 | 
|---|
| 44 | #define COMBOBOX_CONTROL        5 | 
|---|
| 45 | #define EDIT_CONTROL            6 | 
|---|
| 46 | #define MDICLIENT_CONTROL       7 | 
|---|
| 47 | #define DIALOG_CONTROL          8 | 
|---|
| 48 | #define DESKTOP_CONTROL         9 | 
|---|
| 49 | #define WINSWITCH_CONTROL       10 | 
|---|
| 50 | #define ICONTITLE_CONTROL       11 | 
|---|
| 51 | #define POPUPMENU_CONTROL       12 | 
|---|
| 52 | #define MAX_CONTROLS            13 | 
|---|
| 53 |  | 
|---|
| 54 | /* desktop */ | 
|---|
| 55 | extern BOOL DESKTOP_SetPattern( LPCSTR pattern ); | 
|---|
| 56 |  | 
|---|
| 57 | /* icon title */ | 
|---|
| 58 | extern HWND ICONTITLE_Create( HWND hwnd ); | 
|---|
| 59 |  | 
|---|
| 60 | /* menu controls */ | 
|---|
| 61 | extern BOOL MENU_Init(void); | 
|---|
| 62 | extern BOOL MENU_IsMenuActive(void); | 
|---|
| 63 | extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup); | 
|---|
| 64 | extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, | 
|---|
| 65 | INT orgX, INT orgY ); | 
|---|
| 66 | extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt ); | 
|---|
| 67 | extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, INT vkey ); | 
|---|
| 68 | extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, | 
|---|
| 69 | HWND hwnd, BOOL suppress_draw ); | 
|---|
| 70 | extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget ); | 
|---|
| 71 |  | 
|---|
| 72 | /* scrollbar */ | 
|---|
| 73 | extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior ); | 
|---|
| 74 | extern void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt ); | 
|---|
| 75 | extern INT SCROLL_SetNCSbState( HWND hwnd, int vMin, int vMax, int vPos, | 
|---|
| 76 | int hMin, int hMax, int hPos ); | 
|---|
| 77 |  | 
|---|
| 78 | /* combo box */ | 
|---|
| 79 |  | 
|---|
| 80 | #define ID_CB_LISTBOX           1000 | 
|---|
| 81 | #define ID_CB_EDIT              1001 | 
|---|
| 82 |  | 
|---|
| 83 | /* internal flags */ | 
|---|
| 84 | #define CBF_DROPPED             0x0001 | 
|---|
| 85 | #define CBF_BUTTONDOWN          0x0002 | 
|---|
| 86 | #define CBF_NOROLLUP            0x0004 | 
|---|
| 87 | #define CBF_MEASUREITEM         0x0008 | 
|---|
| 88 | #define CBF_FOCUSED             0x0010 | 
|---|
| 89 | #define CBF_CAPTURE             0x0020 | 
|---|
| 90 | #define CBF_EDIT                0x0040 | 
|---|
| 91 | #define CBF_NORESIZE            0x0080 | 
|---|
| 92 | #define CBF_NOTIFY              0x0100 | 
|---|
| 93 | #define CBF_NOREDRAW            0x0200 | 
|---|
| 94 | #define CBF_SELCHANGE           0x0400 | 
|---|
| 95 | #define CBF_NOEDITNOTIFY        0x1000 | 
|---|
| 96 | #define CBF_NOLBSELECT          0x2000  /* do not change current selection */ | 
|---|
| 97 | #define CBF_EUI                 0x8000 | 
|---|
| 98 |  | 
|---|
| 99 | /* combo state struct */ | 
|---|
| 100 | typedef struct | 
|---|
| 101 | { | 
|---|
| 102 | HWND           self; | 
|---|
| 103 | HWND           owner; | 
|---|
| 104 | UINT           dwStyle; | 
|---|
| 105 | HWND           hWndEdit; | 
|---|
| 106 | HWND           hWndLBox; | 
|---|
| 107 | UINT           wState; | 
|---|
| 108 | HFONT          hFont; | 
|---|
| 109 | RECT           textRect; | 
|---|
| 110 | RECT           buttonRect; | 
|---|
| 111 | RECT           droppedRect; | 
|---|
| 112 | INT            droppedIndex; | 
|---|
| 113 | INT            fixedOwnerDrawHeight; | 
|---|
| 114 | INT            droppedWidth;   /* last two are not used unless set */ | 
|---|
| 115 | INT            editHeight;     /* explicitly */ | 
|---|
| 116 | } HEADCOMBO,*LPHEADCOMBO; | 
|---|
| 117 |  | 
|---|
| 118 | /* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */ | 
|---|
| 119 | #define CB_GETTYPE( lphc )    ((lphc)->dwStyle & (CBS_DROPDOWNLIST)) | 
|---|
| 120 |  | 
|---|
| 121 | extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL ); | 
|---|
| 122 |  | 
|---|
| 123 | /* Dialog info structure */ | 
|---|
| 124 | typedef struct | 
|---|
| 125 | { | 
|---|
| 126 | HWND      hwndFocus;   /* Current control with focus */ | 
|---|
| 127 | HFONT     hUserFont;   /* Dialog font */ | 
|---|
| 128 | HMENU     hMenu;       /* Dialog menu */ | 
|---|
| 129 | UINT      xBaseUnit;   /* Dialog units (depends on the font) */ | 
|---|
| 130 | UINT      yBaseUnit; | 
|---|
| 131 | INT       idResult;    /* EndDialog() result / default pushbutton ID */ | 
|---|
| 132 | UINT      flags;       /* EndDialog() called for this dialog */ | 
|---|
| 133 | HGLOBAL16 hDialogHeap; | 
|---|
| 134 | } DIALOGINFO; | 
|---|
| 135 |  | 
|---|
| 136 | #define DF_END  0x0001 | 
|---|
| 137 | #define DF_OWNERENABLED 0x0002 | 
|---|
| 138 |  | 
|---|
| 139 | /* offset of DIALOGINFO ptr in dialog extra bytes */ | 
|---|
| 140 | #define DWL_WINE_DIALOGINFO (DWL_USER+sizeof(ULONG_PTR)) | 
|---|
| 141 |  | 
|---|
| 142 | #define DIALOG_get_info( hwnd ) \ | 
|---|
| 143 | (DIALOGINFO *)GetWindowLongW( hwnd, DWL_WINE_DIALOGINFO ) | 
|---|
| 144 |  | 
|---|
| 145 | extern BOOL DIALOG_Init(void); | 
|---|
| 146 |  | 
|---|
| 147 | /* Wine look */ | 
|---|
| 148 |  | 
|---|
| 149 | typedef enum | 
|---|
| 150 | { | 
|---|
| 151 | WIN31_LOOK, | 
|---|
| 152 | WIN95_LOOK, | 
|---|
| 153 | WIN98_LOOK | 
|---|
| 154 | } WINE_LOOK; | 
|---|
| 155 |  | 
|---|
| 156 | extern WINE_LOOK TWEAK_WineLook; | 
|---|
| 157 |  | 
|---|
| 158 | #define WND_OTHER_PROCESS       0 | 
|---|
| 159 |  | 
|---|
| 160 | HWND WIN_GetFullHandle( HWND hwnd ); | 
|---|
| 161 | int  WIN_SuspendWndsLock( void ); | 
|---|
| 162 | void WIN_RestoreWndsLock(int ipreviousLock); | 
|---|
| 163 | HWND *WIN_ListParents( HWND hwnd ); | 
|---|
| 164 | HWND *WIN_ListChildren( HWND hwnd ); | 
|---|
| 165 | WND  *WIN_GetPtr( HWND hwnd ); | 
|---|
| 166 | WND*  WIN_FindWndPtr( HWND hwnd ); | 
|---|
| 167 | void  WIN_ReleaseWndPtr(WND *wndPtr); | 
|---|
| 168 | void  WIN_ReleasePtr( WND *ptr ); | 
|---|
| 169 | LONG  WIN_SetStyle( HWND hwnd, LONG style ); | 
|---|
| 170 | LONG  WIN_SetExStyle( HWND hwnd, LONG style ); | 
|---|
| 171 | void  WIN_SetOwner( HWND hwnd, HWND owner ); | 
|---|
| 172 |  | 
|---|
| 173 |  | 
|---|
| 174 | /* syscolor.c */ | 
|---|
| 175 | extern HPEN SYSCOLOR_GetPen( INT index ); | 
|---|
| 176 |  | 
|---|
| 177 | extern const char *SPY_GetMsgName( UINT msg, HWND hWnd ); | 
|---|
| 178 |  | 
|---|
| 179 | /* GetAncestor() constants */ | 
|---|
| 180 | #define GA_PARENT       1 | 
|---|
| 181 | #define GA_ROOT         2 | 
|---|
| 182 | #define GA_ROOTOWNER    3 | 
|---|
| 183 |  | 
|---|
| 184 | HWND        WINAPI GetAncestor(HWND,UINT); | 
|---|
| 185 |  | 
|---|
| 186 |  | 
|---|
| 187 | HMENU WIN32API getSysMenu(HWND hwnd); | 
|---|
| 188 | void GetWindowRectParent(HWND hwnd, RECT *pRect); | 
|---|
| 189 | VOID setSysMenu(HWND hwnd,HMENU hMenu); | 
|---|
| 190 |  | 
|---|
| 191 |  | 
|---|
| 192 | extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ); | 
|---|
| 193 |  | 
|---|
| 194 |  | 
|---|
| 195 | #endif // __CONTROLS_H | 
|---|