Update the address of the Free Software Foundation.
[wine] / dlls / user / controls.h
1 /*
2  * User controls definitions
3  *
4  * Copyright 2000 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __WINE_CONTROLS_H
22 #define __WINE_CONTROLS_H
23
24 #include "winuser.h"
25 #include "winproc.h"
26
27 /* Built-in class names (see _Undocumented_Windows_ p.418) */
28 #define POPUPMENU_CLASS_ATOMA MAKEINTATOMA(32768)  /* PopupMenu */
29 #define POPUPMENU_CLASS_ATOMW MAKEINTATOMW(32768)  /* PopupMenu */
30 #define DESKTOP_CLASS_ATOM   MAKEINTATOMA(32769)  /* Desktop */
31 #define DIALOG_CLASS_ATOMA   MAKEINTATOMA(32770)  /* Dialog */
32 #define DIALOG_CLASS_ATOMW   MAKEINTATOMW(32770)  /* Dialog */
33 #define WINSWITCH_CLASS_ATOM MAKEINTATOMA(32771)  /* WinSwitch */
34 #define ICONTITLE_CLASS_ATOM MAKEINTATOMA(32772)  /* IconTitle */
35
36 /* Built-in class descriptor */
37 struct builtin_class_descr
38 {
39     LPCSTR    name;    /* class name */
40     UINT      style;   /* class style */
41     WNDPROC   procA;   /* ASCII window procedure */
42     WNDPROC   procW;   /* Unicode window procedure */
43     INT       extra;   /* window extra bytes */
44     ULONG_PTR cursor;  /* cursor id */
45     HBRUSH    brush;   /* brush or system color */
46 };
47
48
49 /* defwnd proc */
50 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType );
51
52 /* desktop */
53 extern BOOL DESKTOP_SetPattern( LPCWSTR pattern );
54
55 /* icon title */
56 extern HWND ICONTITLE_Create( HWND hwnd );
57
58 /* menu controls */
59 extern HWND MENU_IsMenuActive(void);
60 extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
61                                      INT orgX, INT orgY );
62 extern BOOL MENU_SetMenu(HWND, HMENU);
63 extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt );
64 extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar );
65 extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
66                                 HWND hwnd, BOOL suppress_draw );
67 extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
68
69 /* nonclient area */
70 extern LRESULT NC_HandleNCPaint( HWND hwnd , HRGN clip);
71 extern LRESULT NC_HandleNCActivate( HWND hwnd, WPARAM wParam );
72 extern LRESULT NC_HandleNCCalcSize( HWND hwnd, RECT *winRect );
73 extern LRESULT NC_HandleNCHitTest( HWND hwnd, POINT pt );
74 extern LRESULT NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam );
75 extern LRESULT NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam);
76 extern LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam );
77 extern LRESULT NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
78 extern BOOL NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
79 extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect );
80
81 /* scrollbar */
82 extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior );
83 extern void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt );
84 extern INT SCROLL_SetNCSbState( HWND hwnd, int vMin, int vMax, int vPos,
85                                 int hMin, int hMax, int hPos );
86
87 /* combo box */
88
89 #define ID_CB_LISTBOX           1000
90 #define ID_CB_EDIT              1001
91
92 /* internal flags */
93 #define CBF_DROPPED             0x0001
94 #define CBF_BUTTONDOWN          0x0002
95 #define CBF_NOROLLUP            0x0004
96 #define CBF_MEASUREITEM         0x0008
97 #define CBF_FOCUSED             0x0010
98 #define CBF_CAPTURE             0x0020
99 #define CBF_EDIT                0x0040
100 #define CBF_NORESIZE            0x0080
101 #define CBF_NOTIFY              0x0100
102 #define CBF_NOREDRAW            0x0200
103 #define CBF_SELCHANGE           0x0400
104 #define CBF_NOEDITNOTIFY        0x1000
105 #define CBF_NOLBSELECT          0x2000  /* do not change current selection */
106 #define CBF_EUI                 0x8000
107
108 /* combo state struct */
109 typedef struct
110 {
111    HWND           self;
112    HWND           owner;
113    UINT           dwStyle;
114    HWND           hWndEdit;
115    HWND           hWndLBox;
116    UINT           wState;
117    HFONT          hFont;
118    RECT           textRect;
119    RECT           buttonRect;
120    RECT           droppedRect;
121    INT            droppedIndex;
122    INT            fixedOwnerDrawHeight;
123    INT            droppedWidth;   /* last two are not used unless set */
124    INT            editHeight;     /* explicitly */
125 } HEADCOMBO,*LPHEADCOMBO;
126
127 extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
128
129 /* Dialog info structure */
130 typedef struct
131 {
132     HWND      hwndFocus;   /* Current control with focus */
133     HFONT     hUserFont;   /* Dialog font */
134     HMENU     hMenu;       /* Dialog menu */
135     UINT      xBaseUnit;   /* Dialog units (depends on the font) */
136     UINT      yBaseUnit;
137     INT       idResult;    /* EndDialog() result / default pushbutton ID */
138     UINT      flags;       /* EndDialog() called for this dialog */
139     HGLOBAL16 hDialogHeap;
140 } DIALOGINFO;
141
142 #define DF_END  0x0001
143 #define DF_OWNERENABLED 0x0002
144
145 /* offset of DIALOGINFO ptr in dialog extra bytes */
146 #define DWLP_WINE_DIALOGINFO (DWLP_USER+sizeof(ULONG_PTR))
147
148 extern DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create );
149 extern void DIALOG_EnableOwner( HWND hOwner );
150 extern BOOL DIALOG_DisableOwner( HWND hOwner );
151 extern INT DIALOG_DoDialogBox( HWND hwnd, HWND owner );
152
153 #endif  /* __WINE_CONTROLS_H */