Fixed some problems with scrolling in the edit control.
[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 struct tagWND;
14
15 /* Built-in class names (see _Undocumented_Windows_ p.418) */
16 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768)  /* PopupMenu */
17 #define DESKTOP_CLASS_ATOM   MAKEINTATOM(32769)  /* Desktop */
18 #define DIALOG_CLASS_ATOM    MAKEINTATOM(32770)  /* Dialog */
19 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771)  /* WinSwitch */
20 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772)  /* IconTitle */
21
22 /* Built-in class descriptor */
23 struct builtin_class_descr
24 {
25     LPCSTR  name;    /* class name */
26     UINT    style;   /* class style */
27     WNDPROC procA;   /* ASCII window procedure */
28     WNDPROC procW;   /* Unicode window procedure */
29     INT     extra;   /* window extra bytes */
30     LPCSTR  cursor;  /* cursor name */
31     HBRUSH  brush;   /* brush or system color */
32 };
33
34
35 /* desktop */
36 extern BOOL DESKTOP_SetPattern( LPCSTR pattern );
37
38 /* icon title */
39 extern HWND ICONTITLE_Create( struct tagWND * );
40
41 /* MDI client */
42 extern HWND MDI_CreateMDIWindowA(LPCSTR,LPCSTR,DWORD,INT,INT,INT,INT,HWND,HINSTANCE,LPARAM);
43 extern HWND MDI_CreateMDIWindowW(LPCWSTR,LPCWSTR,DWORD,INT,INT,INT,INT,HWND,HINSTANCE,LPARAM);
44
45 /* menu controls */
46 extern BOOL MENU_Init(void);
47 extern BOOL MENU_IsMenuActive(void);
48 extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
49 extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
50                                      INT orgX, INT orgY );
51 extern BOOL MENU_PatchResidentPopup( HQUEUE16, struct tagWND* );
52 extern void MENU_TrackMouseMenuBar( struct tagWND *wnd, INT ht, POINT pt );
53 extern void MENU_TrackKbdMenuBar( struct tagWND *wnd, UINT wParam, INT vkey );
54 extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
55                                 HWND hwnd, BOOL suppress_draw );
56 extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
57
58 /* scrollbar */
59 extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior );
60 extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt );
61 extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int vPos,
62                                 int hMin, int hMax, int hPos );
63
64 /* combo box */
65
66 #define ID_CB_LISTBOX           1000
67 #define ID_CB_EDIT              1001
68
69 /* internal flags */
70 #define CBF_DROPPED             0x0001
71 #define CBF_BUTTONDOWN          0x0002
72 #define CBF_NOROLLUP            0x0004
73 #define CBF_MEASUREITEM         0x0008
74 #define CBF_FOCUSED             0x0010
75 #define CBF_CAPTURE             0x0020
76 #define CBF_EDIT                0x0040
77 #define CBF_NORESIZE            0x0080
78 #define CBF_NOTIFY              0x0100
79 #define CBF_NOREDRAW            0x0200
80 #define CBF_SELCHANGE           0x0400
81 #define CBF_NOEDITNOTIFY        0x1000
82 #define CBF_NOLBSELECT          0x2000  /* do not change current selection */
83 #define CBF_EUI                 0x8000
84
85 /* combo state struct */
86 typedef struct
87 {
88    struct tagWND *self;
89    HWND           owner;
90    UINT           dwStyle;
91    HWND           hWndEdit;
92    HWND           hWndLBox;
93    UINT           wState;
94    HFONT          hFont;
95    RECT           textRect;
96    RECT           buttonRect;
97    RECT           droppedRect;
98    INT            droppedIndex;
99    INT            fixedOwnerDrawHeight;
100    INT            droppedWidth;   /* last two are not used unless set */
101    INT            editHeight;     /* explicitly */
102 } HEADCOMBO,*LPHEADCOMBO;
103
104 /* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */
105 #define CB_GETTYPE( lphc )    ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
106 #define CB_DISABLED( lphc )   ((lphc)->self->dwStyle & WS_DISABLED)
107 #define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
108 #define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
109 #define CB_HWND( lphc )       ((lphc)->self->hwndSelf)
110
111 extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
112 extern LRESULT COMBO_Directory( LPHEADCOMBO, UINT, LPSTR, BOOL );
113
114
115 /* Dialog info structure.
116  * This structure is stored into the window extra bytes (cbWndExtra).
117  * sizeof(DIALOGINFO) must be <= DLGWINDOWEXTRA (=30).
118  */
119 #include "pshpack1.h"
120
121 typedef struct
122 {
123     INT         msgResult;   /* 00 Last message result */
124     HWINDOWPROC dlgProc;     /* 04 Dialog procedure */
125     LONG        userInfo;    /* 08 User information (for DWL_USER) */
126
127     /* implementation-dependent part */
128
129     HWND16      hwndFocus;   /* 0c Current control with focus */
130     HFONT16     hUserFont;   /* 0e Dialog font */
131     HMENU16     hMenu;       /* 10 Dialog menu */
132     WORD        xBaseUnit;   /* 12 Dialog units (depends on the font) */
133     WORD        yBaseUnit;   /* 14 */
134     INT         idResult;    /* 16 EndDialog() result / default pushbutton ID */
135     UINT16      flags;       /* 1a EndDialog() called for this dialog */
136     HGLOBAL16   hDialogHeap; /* 1c */
137 } DIALOGINFO;
138
139 #include "poppack.h"
140
141 #define DF_END  0x0001
142 #define DF_OWNERENABLED 0x0002
143
144 extern BOOL DIALOG_Init(void);
145
146 #endif  /* __WINE_CONTROLS_H */