4 * Copyright 1998,1999 Patrik Stridvall
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(ttydrv
);
17 WND_DRIVER TTYDRV_WND_Driver
=
19 TTYDRV_WND_Initialize
,
21 TTYDRV_WND_CreateDesktopWindow
,
22 TTYDRV_WND_CreateWindow
,
23 TTYDRV_WND_DestroyWindow
,
25 TTYDRV_WND_ForceWindowRaise
,
26 TTYDRV_WND_SetWindowPos
,
29 TTYDRV_WND_PreSizeMove
,
30 TTYDRV_WND_PostSizeMove
,
31 TTYDRV_WND_ScrollWindow
,
32 TTYDRV_WND_SetDrawable
,
33 TTYDRV_WND_SetHostAttr
,
34 TTYDRV_WND_IsSelfClipping
,
35 TTYDRV_WND_SetWindowRgn
39 /***********************************************************************
40 * TTYDRV_WND_GetCursesWindow
42 * Return the Curses window associated to a window.
44 WINDOW
*TTYDRV_WND_GetCursesWindow(WND
*wndPtr
)
46 return wndPtr
&& wndPtr
->pDriverData
?
47 ((TTYDRV_WND_DATA
*) wndPtr
->pDriverData
)->window
: 0;
50 /**********************************************************************
51 * TTYDRV_WND_Initialize
53 void TTYDRV_WND_Initialize(WND
*wndPtr
)
55 TTYDRV_WND_DATA
*pWndDriverData
=
56 (TTYDRV_WND_DATA
*) HeapAlloc(SystemHeap
, 0, sizeof(TTYDRV_WND_DATA
));
58 TRACE("(%p)\n", wndPtr
);
60 wndPtr
->pDriverData
= (void *) pWndDriverData
;
62 pWndDriverData
->window
= NULL
;
65 /**********************************************************************
68 void TTYDRV_WND_Finalize(WND
*wndPtr
)
70 TTYDRV_WND_DATA
*pWndDriverData
=
71 (TTYDRV_WND_DATA
*) wndPtr
->pDriverData
;
73 TRACE("(%p)\n", wndPtr
);
76 ERR("WND already destroyed\n");
80 if(pWndDriverData
->window
) {
81 ERR("WND destroyed without destroying the associated Curses Windows");
84 HeapFree(SystemHeap
, 0, pWndDriverData
);
85 wndPtr
->pDriverData
= NULL
;
88 /**********************************************************************
89 * TTYDRV_WND_CreateDesktopWindow
91 BOOL
TTYDRV_WND_CreateDesktopWindow(WND
*wndPtr
)
93 TTYDRV_WND_DATA
*pWndDriverData
=
94 (TTYDRV_WND_DATA
*) wndPtr
->pDriverData
;
96 TRACE("(%p)\n", wndPtr
);
98 if(!pWndDriverData
) { ERR("WND never initialized\n"); return FALSE
; }
100 pWndDriverData
->window
= TTYDRV_GetRootWindow();
104 /**********************************************************************
105 * TTYDRV_WND_CreateWindow
107 BOOL
TTYDRV_WND_CreateWindow(WND
*wndPtr
, CREATESTRUCTA
*cs
, BOOL bUnicode
)
111 INT cellWidth
=8, cellHeight
=8; /* FIXME: Hardcoded */
113 TRACE("(%p, %p, %d)\n", wndPtr
, cs
, bUnicode
);
115 /* Only create top-level windows */
116 if(cs
->style
& WS_CHILD
)
119 window
= subwin(TTYDRV_GetRootWindow(), cs
->cy
/cellHeight
, cs
->cx
/cellWidth
,
120 cs
->y
/cellHeight
, cs
->x
/cellWidth
);
125 #else /* defined(WINE_CURSES) */
126 FIXME("(%p, %p, %p, %d): stub\n", wndPtr
, cs
, bUnicode
);
129 #endif /* defined(WINE_CURSES) */
132 /***********************************************************************
133 * TTYDRV_WND_DestroyWindow
135 BOOL
TTYDRV_WND_DestroyWindow(WND
*wndPtr
)
140 TRACE("(%p)\n", wndPtr
);
142 window
= TTYDRV_WND_GetCursesWindow(wndPtr
);
143 if(window
&& window
!= TTYDRV_GetRootWindow()) {
148 #else /* defined(WINE_CURSES) */
149 FIXME("(%p): stub\n", wndPtr
);
152 #endif /* defined(WINE_CURSES) */
155 /*****************************************************************
156 * TTYDRV_WND_SetParent
158 WND
*TTYDRV_WND_SetParent(WND
*wndPtr
, WND
*pWndParent
)
160 FIXME("(%p, %p): stub\n", wndPtr
, pWndParent
);
165 /***********************************************************************
166 * TTYDRV_WND_ForceWindowRaise
168 void TTYDRV_WND_ForceWindowRaise(WND
*wndPtr
)
170 FIXME("(%p): stub\n", wndPtr
);
173 /***********************************************************************
174 * TTYDRV_WINPOS_SetWindowPos
176 void TTYDRV_WND_SetWindowPos(WND
*wndPtr
, const WINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
)
178 FIXME("(%p, %p, %d): stub\n", wndPtr
, winpos
, bSMC_SETXPOS
);
181 /*****************************************************************
184 void TTYDRV_WND_SetText(WND
*wndPtr
, LPCWSTR text
)
186 FIXME("(%p, %s): stub\n", wndPtr
, debugstr_w(text
));
189 /*****************************************************************
190 * TTYDRV_WND_SetFocus
192 void TTYDRV_WND_SetFocus(WND
*wndPtr
)
194 FIXME("(%p): stub\n", wndPtr
);
197 /*****************************************************************
198 * TTYDRV_WND_PreSizeMove
200 void TTYDRV_WND_PreSizeMove(WND
*wndPtr
)
202 FIXME("(%p): stub\n", wndPtr
);
205 /*****************************************************************
206 * TTYDRV_WND_PostSizeMove
208 void TTYDRV_WND_PostSizeMove(WND
*wndPtr
)
210 FIXME("(%p): stub\n", wndPtr
);
213 /*****************************************************************
214 * TTYDRV_WND_ScrollWindow
216 void TTYDRV_WND_ScrollWindow( WND
*wndPtr
, HDC hdc
, INT dx
, INT dy
,
217 const RECT
*clipRect
, BOOL bUpdate
)
219 FIXME("(%p, %x, %d, %d, %p, %d): stub\n",
220 wndPtr
, hdc
, dx
, dy
, clipRect
, bUpdate
);
223 /***********************************************************************
224 * TTYDRV_WND_SetDrawable
226 void TTYDRV_WND_SetDrawable(WND
*wndPtr
, HDC hdc
, WORD flags
, BOOL bSetClipOrigin
)
228 DC
*dc
= DC_GetDCPtr( hdc
);
230 TRACE("(%p, %p, %d, %d)\n", wndPtr
, dc
, flags
, bSetClipOrigin
);
232 /* FIXME: Should be done in the common code instead */
237 if(flags
& DCX_WINDOW
) {
238 dc
->DCOrgX
= wndPtr
->rectWindow
.left
;
239 dc
->DCOrgY
= wndPtr
->rectWindow
.top
;
241 dc
->DCOrgX
= wndPtr
->rectClient
.left
;
242 dc
->DCOrgY
= wndPtr
->rectClient
.top
;
245 GDI_ReleaseObj( hdc
);
248 /***********************************************************************
249 * TTYDRV_WND_SetHostAttr
251 BOOL
TTYDRV_WND_SetHostAttr(WND
*wndPtr
, INT attr
, INT value
)
253 FIXME("(%p): stub\n", wndPtr
);
258 /***********************************************************************
259 * TTYDRV_WND_IsSelfClipping
261 BOOL
TTYDRV_WND_IsSelfClipping(WND
*wndPtr
)
263 FIXME("(%p): semistub\n", wndPtr
);
268 /***********************************************************************
269 * TTYDRV_WND_SetWindowRgn
271 void TTYDRV_WND_SetWindowRgn(struct tagWND
*wndPtr
, HRGN hrgnWnd
)