Moved MAKEINTATOM to winbase.h and added Unicode version.
[wine] / dlls / user / controls.h
1 /*
2  * User controls definitions
3  *
4  * Copyright 2000 Alexandre Julliard
5  */
6
7 #ifndef __WINE_CONTROLS_H
8 #define __WINE_CONTROLS_H
9
10 #include "winuser.h"
11 #include "winproc.h"
12
13 /* Built-in class names (see _Undocumented_Windows_ p.418) */
14 #define POPUPMENU_CLASS_ATOM MAKEINTATOMA(32768)  /* PopupMenu */
15 #define DESKTOP_CLASS_ATOM   MAKEINTATOMA(32769)  /* Desktop */
16 #define DIALOG_CLASS_ATOM    MAKEINTATOMA(32770)  /* Dialog */
17 #define WINSWITCH_CLASS_ATOM MAKEINTATOMA(32771)  /* WinSwitch */
18 #define ICONTITLE_CLASS_ATOM MAKEINTATOMA(32772)  /* IconTitle */
19
20 /* Built-in class descriptor */
21 struct builtin_class_descr
22 {
23     LPCSTR  name;    /* class name */
24     UINT    style;   /* class style */
25     WNDPROC procA;   /* ASCII window procedure */
26     WNDPROC procW;   /* Unicode window procedure */
27     INT     extra;   /* window extra bytes */
28     LPCSTR  cursor;  /* cursor name */
29     HBRUSH  brush;   /* brush or system color */
30 };
31
32
33 /* desktop */
34 extern BOOL DESKTOP_SetPattern( LPCSTR pattern );
35
36 /* icon title */
37 extern HWND ICONTITLE_Create( HWND hwnd );
38
39 /* menu controls */
40 extern BOOL MENU_Init(void);
41 extern BOOL MENU_IsMenuActive(void);
42 extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
43 extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
44                                      INT orgX, INT orgY );
45 extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt );
46 extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, INT vkey );
47 extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
48                                 HWND hwnd, BOOL suppress_draw );
49 extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
50
51 /* scrollbar */
52 extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior );
53 extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt );
54 extern INT SCROLL_SetNCSbState( HWND hwnd, int vMin, int vMax, int vPos,
55                                 int hMin, int hMax, int hPos );
56
57 /* combo box */
58
59 #define ID_CB_LISTBOX           1000
60 #define ID_CB_EDIT              1001
61
62 /* internal flags */
63 #define CBF_DROPPED             0x0001
64 #define CBF_BUTTONDOWN          0x0002
65 #define CBF_NOROLLUP            0x0004
66 #define CBF_MEASUREITEM         0x0008
67 #define CBF_FOCUSED             0x0010
68 #define CBF_CAPTURE             0x0020
69 #define CBF_EDIT                0x0040
70 #define CBF_NORESIZE            0x0080
71 #define CBF_NOTIFY              0x0100
72 #define CBF_NOREDRAW            0x0200
73 #define CBF_SELCHANGE           0x0400
74 #define CBF_NOEDITNOTIFY        0x1000
75 #define CBF_NOLBSELECT          0x2000  /* do not change current selection */
76 #define CBF_EUI                 0x8000
77
78 /* combo state struct */
79 typedef struct
80 {
81    HWND           self;
82    HWND           owner;
83    UINT           dwStyle;
84    HWND           hWndEdit;
85    HWND           hWndLBox;
86    UINT           wState;
87    HFONT          hFont;
88    RECT           textRect;
89    RECT           buttonRect;
90    RECT           droppedRect;
91    INT            droppedIndex;
92    INT            fixedOwnerDrawHeight;
93    INT            droppedWidth;   /* last two are not used unless set */
94    INT            editHeight;     /* explicitly */
95 } HEADCOMBO,*LPHEADCOMBO;
96
97 /* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */
98 #define CB_GETTYPE( lphc )    ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
99
100 extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
101
102 /* Dialog info structure */
103 typedef struct
104 {
105     HWND      hwndFocus;   /* Current control with focus */
106     HFONT     hUserFont;   /* Dialog font */
107     HMENU     hMenu;       /* Dialog menu */
108     UINT      xBaseUnit;   /* Dialog units (depends on the font) */
109     UINT      yBaseUnit;
110     INT       idResult;    /* EndDialog() result / default pushbutton ID */
111     UINT      flags;       /* EndDialog() called for this dialog */
112     HGLOBAL16 hDialogHeap;
113 } DIALOGINFO;
114
115 #define DF_END  0x0001
116 #define DF_OWNERENABLED 0x0002
117
118 /* offset of DIALOGINFO ptr in dialog extra bytes */
119 #define DWL_WINE_DIALOGINFO (DWL_USER+sizeof(ULONG_PTR))
120
121 inline static DIALOGINFO *DIALOG_get_info( HWND hwnd )
122 {
123     return (DIALOGINFO *)GetWindowLongW( hwnd, DWL_WINE_DIALOGINFO );
124 }
125
126 extern BOOL DIALOG_Init(void);
127
128 #endif  /* __WINE_CONTROLS_H */