In CreateDIBSection function, if hdc is NULL it now uses the desktop DC
[wine.git] / include / ttydrv.h
blobb89a9da0d316de6e99de22923c168edfe7c590d3
1 /*
2 * TTY driver definitions
3 */
5 #ifndef __WINE_TTYDRV_H
6 #define __WINE_TTYDRV_H
8 #include "config.h"
10 #undef ERR
11 #ifdef HAVE_NCURSES_H
12 # include <ncurses.h>
13 #elif defined(HAVE_CURSES_H)
14 # include <curses.h>
15 #endif
17 #include "windef.h"
18 #include "wingdi.h"
19 #include "wine/winuser16.h"
20 #include "wine/wingdi16.h"
21 #include "user.h"
23 struct tagBITMAPOBJ;
24 struct tagCLASS;
25 struct tagDC;
26 struct tagDESKTOP;
27 struct tagPALETTEOBJ;
28 struct tagWND;
29 struct tagCURSORICONINFO;
30 struct tagCREATESTRUCTA;
31 struct tagWINDOWPOS;
32 struct tagKEYBOARD_CONFIG;
33 struct DIDEVICEOBJECTDATA;
35 #if defined(HAVE_LIBCURSES) || defined(HAVE_LIBNCURSES)
36 #define WINE_CURSES
37 #endif
39 /**************************************************************************
40 * TTY GDI driver
43 extern struct tagGDI_DRIVER TTYDRV_GDI_Driver;
45 extern BOOL TTYDRV_GDI_Initialize(void);
46 extern void TTYDRV_GDI_Finalize(void);
48 /* TTY GDI bitmap driver */
50 extern HBITMAP TTYDRV_BITMAP_CreateDIBSection(struct tagDC *dc, BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset);
51 extern HBITMAP16 TTYDRV_BITMAP_CreateDIBSection16(struct tagDC *dc, BITMAPINFO *bmi, UINT16 usage, SEGPTR *bits, HANDLE section, DWORD offset);
53 extern INT TTYDRV_BITMAP_SetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
54 extern INT TTYDRV_BITMAP_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
55 extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
57 #ifndef WINE_CURSES
58 typedef struct { int dummy; } WINDOW;
59 #endif
61 typedef struct {
62 WINDOW *window;
63 int cellWidth;
64 int cellHeight;
65 } TTYDRV_PDEVICE;
67 typedef struct {
68 int dummy; /* FIXME: Remove later */
69 } TTYDRV_PHYSBITMAP;
71 extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap);
73 extern BOOL TTYDRV_DC_Arc(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
74 extern LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags);
75 extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap);
76 extern BOOL TTYDRV_DC_CreateDC(struct tagDC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODEA *initData);
77 extern BOOL TTYDRV_DC_DeleteDC(struct tagDC *dc);
78 extern BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle);
79 extern BOOL TTYDRV_DC_BitBlt(struct tagDC *dcDst, INT xDst, INT yDst, INT width, INT height, struct tagDC *dcSrc, INT xSrc, INT ySrc, DWORD rop);
80 extern BOOL TTYDRV_DC_Chord(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
81 extern BOOL TTYDRV_DC_Ellipse(struct tagDC *dc, INT left, INT top, INT right, INT bottom);
82 extern INT TTYDRV_DC_Escape(struct tagDC *dc, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData);
83 extern BOOL TTYDRV_DC_ExtFloodFill(struct tagDC *dc, INT x, INT y, COLORREF color, UINT fillType);
84 extern BOOL TTYDRV_DC_ExtTextOut(struct tagDC *dc, INT x, INT y, UINT flags, const RECT *lpRect, LPCWSTR str, UINT count, const INT *lpDx);
85 extern BOOL TTYDRV_DC_GetCharWidth(struct tagDC *dc, UINT firstChar, UINT lastChar, LPINT buffer);
86 extern COLORREF TTYDRV_DC_GetPixel(struct tagDC *dc, INT x, INT y);
88 extern BOOL TTYDRV_DC_GetTextExtentPoint(struct tagDC *dc, LPCWSTR str, INT count, LPSIZE size);
89 extern BOOL TTYDRV_DC_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
90 extern BOOL TTYDRV_DC_LineTo(struct tagDC *dc, INT x, INT y);
91 extern HANDLE TTYDRV_DC_LoadOEMResource(WORD resid, WORD type);
92 extern BOOL TTYDRV_DC_PaintRgn(struct tagDC *dc, HRGN hrgn);
93 extern BOOL TTYDRV_DC_PatBlt(struct tagDC *dc, INT left, INT top, INT width, INT height, DWORD rop);
94 extern BOOL TTYDRV_DC_Pie(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
95 extern BOOL TTYDRV_DC_Polygon(struct tagDC *dc, const POINT* pt, INT count);
96 extern BOOL TTYDRV_DC_Polyline(struct tagDC *dc, const POINT* pt, INT count);
97 extern BOOL TTYDRV_DC_PolyPolygon(struct tagDC *dc, const POINT* pt, const INT* counts, UINT polygons);
98 extern BOOL TTYDRV_DC_PolyPolyline(struct tagDC *dc, const POINT* pt, const DWORD* counts, DWORD polylines);
99 extern BOOL TTYDRV_DC_Rectangle(struct tagDC *dc, INT left, INT top, INT right, INT bottom);
100 extern BOOL TTYDRV_DC_RoundRect(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height);
101 extern void TTYDRV_DC_SetDeviceClipping(struct tagDC *dc);
102 extern HGDIOBJ TTYDRV_DC_SelectObject(struct tagDC *dc, HGDIOBJ handle);
103 extern COLORREF TTYDRV_DC_SetBkColor(struct tagDC *dc, COLORREF color);
104 extern COLORREF TTYDRV_DC_SetPixel(struct tagDC *dc, INT x, INT y, COLORREF color);
105 extern COLORREF TTYDRV_DC_SetTextColor(struct tagDC *dc, COLORREF color);
106 extern BOOL TTYDRV_DC_StretchBlt(struct tagDC *dcDst, INT xDst, INT yDst, INT widthDst, INT heightDst, struct tagDC *dcSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop);
107 INT TTYDRV_DC_SetDIBitsToDevice(struct tagDC *dc, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse);
109 /* TTY GDI palette driver */
111 extern struct tagPALETTE_DRIVER TTYDRV_PALETTE_Driver;
113 extern BOOL TTYDRV_PALETTE_Initialize(void);
114 extern void TTYDRV_PALETTE_Finalize(void);
116 extern int TTYDRV_PALETTE_SetMapping(struct tagPALETTEOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapOnly);
117 extern int TTYDRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ *palPtr);
118 extern BOOL TTYDRV_PALETTE_IsDark(int pixel);
120 /**************************************************************************
121 * TTY USER driver
124 extern int cell_width;
125 extern int cell_height;
126 static inline int TTYDRV_GetCellWidth(void) { return cell_width; }
127 static inline int TTYDRV_GetCellHeight(void) { return cell_height; }
129 extern WINDOW *root_window;
130 static inline WINDOW *TTYDRV_GetRootWindow(void) { return root_window; }
132 extern BOOL TTYDRV_GetScreenSaveActive(void);
133 extern void TTYDRV_SetScreenSaveActive(BOOL bActivate);
134 extern int TTYDRV_GetScreenSaveTimeout(void);
135 extern void TTYDRV_SetScreenSaveTimeout(int nTimeout);
136 extern BOOL TTYDRV_IsSingleWindow(void);
138 /* TTY clipboard driver */
140 extern struct tagCLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
142 extern void TTYDRV_CLIPBOARD_Acquire(void);
143 extern void TTYDRV_CLIPBOARD_Release(void);
144 extern void TTYDRV_CLIPBOARD_SetData(UINT wFormat);
145 extern BOOL TTYDRV_CLIPBOARD_GetData(UINT wFormat);
146 extern BOOL TTYDRV_CLIPBOARD_IsFormatAvailable(UINT wFormat);
147 extern BOOL TTYDRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName );
148 extern BOOL TTYDRV_CLIPBOARD_IsSelectionowner();
149 extern void TTYDRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
151 /* TTY event driver */
153 extern void TTYDRV_EVENT_Synchronize(void);
154 extern BOOL TTYDRV_EVENT_CheckFocus(void);
155 extern void TTYDRV_EVENT_UserRepaintDisable(BOOL bDisable);
157 /* TTY keyboard driver */
159 extern void TTYDRV_KEYBOARD_Init(void);
160 extern WORD TTYDRV_KEYBOARD_VkKeyScan(CHAR cChar);
161 extern UINT16 TTYDRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
162 extern INT16 TTYDRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
163 extern INT16 TTYDRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
164 extern BOOL TTYDRV_KEYBOARD_GetBeepActive(void);
165 extern void TTYDRV_KEYBOARD_SetBeepActive(BOOL bActivate);
166 extern void TTYDRV_KEYBOARD_Beep(void);
167 extern BOOL TTYDRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr);
168 extern BOOL TTYDRV_KEYBOARD_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
169 extern void TTYDRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg);
170 extern void TTYDRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DWORD mask);
172 /* TTY mouse driver */
174 extern void TTYDRV_MOUSE_Init(LPMOUSE_EVENT_PROC);
175 extern void TTYDRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
176 extern void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
178 /* TTY windows driver */
180 extern struct tagWND_DRIVER TTYDRV_WND_Driver;
182 typedef struct tagTTYDRV_WND_DATA {
183 WINDOW *window;
184 } TTYDRV_WND_DATA;
186 WINDOW *TTYDRV_WND_GetCursesWindow(struct tagWND *wndPtr);
188 extern void TTYDRV_WND_Initialize(struct tagWND *wndPtr);
189 extern void TTYDRV_WND_Finalize(struct tagWND *wndPtr);
190 extern BOOL TTYDRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL bUnicode);
191 extern BOOL TTYDRV_WND_CreateWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, struct tagCREATESTRUCTA *cs, BOOL bUnicode);
192 extern BOOL TTYDRV_WND_DestroyWindow(struct tagWND *pWnd);
193 extern struct tagWND *TTYDRV_WND_SetParent(struct tagWND *wndPtr, struct tagWND *pWndParent);
194 extern void TTYDRV_WND_ForceWindowRaise(struct tagWND *pWnd);
195 extern void TTYDRV_WND_SetWindowPos(struct tagWND *wndPtr, const struct tagWINDOWPOS *winpos, BOOL bSMC_SETXPOS);
196 extern void TTYDRV_WND_SetText(struct tagWND *wndPtr, LPCWSTR text);
197 extern void TTYDRV_WND_SetFocus(struct tagWND *wndPtr);
198 extern void TTYDRV_WND_PreSizeMove(struct tagWND *wndPtr);
199 extern void TTYDRV_WND_PostSizeMove(struct tagWND *wndPtr);
200 extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
201 extern void TTYDRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
202 extern BOOL TTYDRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
203 extern BOOL TTYDRV_WND_IsSelfClipping(struct tagWND *wndPtr);
205 #endif /* !defined(__WINE_TTYDRV_H) */