4 * Copyright 1998,1999 Patrik Stridvall
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(ttydrv);
16 WND_DRIVER TTYDRV_WND_Driver =
18 TTYDRV_WND_Initialize,
20 TTYDRV_WND_CreateDesktopWindow,
21 TTYDRV_WND_CreateWindow,
22 TTYDRV_WND_DestroyWindow,
24 TTYDRV_WND_ForceWindowRaise,
25 TTYDRV_WND_SetWindowPos,
28 TTYDRV_WND_PreSizeMove,
29 TTYDRV_WND_PostSizeMove,
30 TTYDRV_WND_ScrollWindow,
31 TTYDRV_WND_SetDrawable,
32 TTYDRV_WND_SetHostAttr,
33 TTYDRV_WND_IsSelfClipping,
34 TTYDRV_WND_SetWindowRgn
38 /***********************************************************************
39 * TTYDRV_WND_GetCursesWindow
41 * Return the Curses window associated to a window.
43 WINDOW *TTYDRV_WND_GetCursesWindow(WND *wndPtr)
45 return wndPtr && wndPtr->pDriverData ?
46 ((TTYDRV_WND_DATA *) wndPtr->pDriverData)->window : 0;
49 /**********************************************************************
50 * TTYDRV_WND_Initialize
52 void TTYDRV_WND_Initialize(WND *wndPtr)
54 TTYDRV_WND_DATA *pWndDriverData = HeapAlloc(GetProcessHeap(), 0, sizeof(TTYDRV_WND_DATA));
56 TRACE("(%p)\n", wndPtr);
58 wndPtr->pDriverData = (void *) pWndDriverData;
60 pWndDriverData->window = NULL;
63 /**********************************************************************
66 void TTYDRV_WND_Finalize(WND *wndPtr)
68 TTYDRV_WND_DATA *pWndDriverData =
69 (TTYDRV_WND_DATA *) wndPtr->pDriverData;
71 TRACE("(%p)\n", wndPtr);
74 ERR("WND already destroyed\n");
78 if(pWndDriverData->window) {
79 ERR("WND destroyed without destroying the associated Curses Windows");
82 HeapFree(GetProcessHeap(), 0, pWndDriverData);
83 wndPtr->pDriverData = NULL;
86 /**********************************************************************
87 * TTYDRV_WND_CreateDesktopWindow
89 BOOL TTYDRV_WND_CreateDesktopWindow(WND *wndPtr)
91 TTYDRV_WND_DATA *pWndDriverData =
92 (TTYDRV_WND_DATA *) wndPtr->pDriverData;
94 TRACE("(%p)\n", wndPtr);
96 if(!pWndDriverData) { ERR("WND never initialized\n"); return FALSE; }
98 pWndDriverData->window = TTYDRV_GetRootWindow();
102 /**********************************************************************
103 * TTYDRV_WND_CreateWindow
105 BOOL TTYDRV_WND_CreateWindow(WND *wndPtr, CREATESTRUCTA *cs, BOOL bUnicode)
109 INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
111 TRACE("(%p, %p, %d)\n", wndPtr, cs, bUnicode);
113 /* Only create top-level windows */
114 if(cs->style & WS_CHILD)
117 window = subwin(TTYDRV_GetRootWindow(), cs->cy/cellHeight, cs->cx/cellWidth,
118 cs->y/cellHeight, cs->x/cellWidth);
123 #else /* defined(WINE_CURSES) */
124 FIXME("(%p, %p, %p, %d): stub\n", wndPtr, cs, bUnicode);
127 #endif /* defined(WINE_CURSES) */
130 /***********************************************************************
131 * TTYDRV_WND_DestroyWindow
133 BOOL TTYDRV_WND_DestroyWindow(WND *wndPtr)
138 TRACE("(%p)\n", wndPtr);
140 window = TTYDRV_WND_GetCursesWindow(wndPtr);
141 if(window && window != TTYDRV_GetRootWindow()) {
146 #else /* defined(WINE_CURSES) */
147 FIXME("(%p): stub\n", wndPtr);
150 #endif /* defined(WINE_CURSES) */
153 /*****************************************************************
154 * TTYDRV_WND_SetParent
156 WND *TTYDRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
158 FIXME("(%p, %p): stub\n", wndPtr, pWndParent);
163 /***********************************************************************
164 * TTYDRV_WND_ForceWindowRaise
166 void TTYDRV_WND_ForceWindowRaise(WND *wndPtr)
168 FIXME("(%p): stub\n", wndPtr);
171 /***********************************************************************
172 * TTYDRV_WINPOS_SetWindowPos
174 void TTYDRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bSMC_SETXPOS)
176 FIXME("(%p, %p, %d): stub\n", wndPtr, winpos, bSMC_SETXPOS);
179 /*****************************************************************
182 void TTYDRV_WND_SetText(WND *wndPtr, LPCWSTR text)
184 FIXME("(%p, %s): stub\n", wndPtr, debugstr_w(text));
187 /*****************************************************************
188 * TTYDRV_WND_SetFocus
190 void TTYDRV_WND_SetFocus(WND *wndPtr)
192 FIXME("(%p): stub\n", wndPtr);
195 /*****************************************************************
196 * TTYDRV_WND_PreSizeMove
198 void TTYDRV_WND_PreSizeMove(WND *wndPtr)
200 FIXME("(%p): stub\n", wndPtr);
203 /*****************************************************************
204 * TTYDRV_WND_PostSizeMove
206 void TTYDRV_WND_PostSizeMove(WND *wndPtr)
208 FIXME("(%p): stub\n", wndPtr);
211 /*****************************************************************
212 * TTYDRV_WND_ScrollWindow
214 void TTYDRV_WND_ScrollWindow( WND *wndPtr, HDC hdc, INT dx, INT dy,
215 const RECT *clipRect, BOOL bUpdate)
217 FIXME("(%p, %x, %d, %d, %p, %d): stub\n",
218 wndPtr, hdc, dx, dy, clipRect, bUpdate);
221 /***********************************************************************
222 * TTYDRV_WND_SetDrawable
224 void TTYDRV_WND_SetDrawable(WND *wndPtr, HDC hdc, WORD flags, BOOL bSetClipOrigin)
226 DC *dc = DC_GetDCPtr( hdc );
228 TRACE("(%p, %p, %d, %d)\n", wndPtr, dc, flags, bSetClipOrigin);
230 /* FIXME: Should be done in the common code instead */
235 if(flags & DCX_WINDOW) {
236 dc->DCOrgX = wndPtr->rectWindow.left;
237 dc->DCOrgY = wndPtr->rectWindow.top;
239 dc->DCOrgX = wndPtr->rectClient.left;
240 dc->DCOrgY = wndPtr->rectClient.top;
243 GDI_ReleaseObj( hdc );
246 /***********************************************************************
247 * TTYDRV_WND_SetHostAttr
249 BOOL TTYDRV_WND_SetHostAttr(WND *wndPtr, INT attr, INT value)
251 FIXME("(%p): stub\n", wndPtr);
256 /***********************************************************************
257 * TTYDRV_WND_IsSelfClipping
259 BOOL TTYDRV_WND_IsSelfClipping(WND *wndPtr)
261 FIXME("(%p): semistub\n", wndPtr);
266 /***********************************************************************
267 * TTYDRV_WND_SetWindowRgn
269 void TTYDRV_WND_SetWindowRgn(struct tagWND *wndPtr, HRGN hrgnWnd)