4 * Copyright 1998,1999 Patrik Stridvall
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(ttydrv
);
18 WND_DRIVER TTYDRV_WND_Driver
=
20 TTYDRV_WND_Initialize
,
22 TTYDRV_WND_CreateDesktopWindow
,
23 TTYDRV_WND_CreateWindow
,
24 TTYDRV_WND_DestroyWindow
,
26 TTYDRV_WND_ForceWindowRaise
,
27 TTYDRV_WND_SetWindowPos
,
30 TTYDRV_WND_PreSizeMove
,
31 TTYDRV_WND_PostSizeMove
,
32 TTYDRV_WND_ScrollWindow
,
33 TTYDRV_WND_SetDrawable
,
34 TTYDRV_WND_SetHostAttr
,
35 TTYDRV_WND_IsSelfClipping
,
36 TTYDRV_WND_SetWindowRgn
40 /***********************************************************************
41 * TTYDRV_WND_GetCursesWindow
43 * Return the Curses window associated to a window.
45 WINDOW
*TTYDRV_WND_GetCursesWindow(WND
*wndPtr
)
47 return wndPtr
&& wndPtr
->pDriverData
?
48 ((TTYDRV_WND_DATA
*) wndPtr
->pDriverData
)->window
: 0;
51 /**********************************************************************
52 * TTYDRV_WND_Initialize
54 void TTYDRV_WND_Initialize(WND
*wndPtr
)
56 TTYDRV_WND_DATA
*pWndDriverData
=
57 (TTYDRV_WND_DATA
*) HeapAlloc(SystemHeap
, 0, sizeof(TTYDRV_WND_DATA
));
59 TRACE("(%p)\n", wndPtr
);
61 wndPtr
->pDriverData
= (void *) pWndDriverData
;
63 pWndDriverData
->window
= NULL
;
66 /**********************************************************************
69 void TTYDRV_WND_Finalize(WND
*wndPtr
)
71 TTYDRV_WND_DATA
*pWndDriverData
=
72 (TTYDRV_WND_DATA
*) wndPtr
->pDriverData
;
74 TRACE("(%p)\n", wndPtr
);
77 ERR("WND already destroyed\n");
81 if(pWndDriverData
->window
) {
82 ERR("WND destroyed without destroying the associated Curses Windows");
85 HeapFree(SystemHeap
, 0, pWndDriverData
);
86 wndPtr
->pDriverData
= NULL
;
89 /**********************************************************************
90 * TTYDRV_WND_CreateDesktopWindow
92 BOOL
TTYDRV_WND_CreateDesktopWindow(WND
*wndPtr
, CLASS
*classPtr
, BOOL bUnicode
)
94 TTYDRV_WND_DATA
*pWndDriverData
=
95 (TTYDRV_WND_DATA
*) wndPtr
->pDriverData
;
97 TRACE("(%p, %p, %d)\n", wndPtr
, classPtr
, bUnicode
);
99 if(!pWndDriverData
) { ERR("WND never initialized\n"); return FALSE
; }
101 pWndDriverData
->window
= TTYDRV_GetRootWindow();
105 /**********************************************************************
106 * TTYDRV_WND_CreateWindow
108 BOOL
TTYDRV_WND_CreateWindow(WND
*wndPtr
, CLASS
*classPtr
, CREATESTRUCTA
*cs
, BOOL bUnicode
)
112 INT cellWidth
=8, cellHeight
=8; /* FIXME: Hardcoded */
114 TRACE("(%p, %p, %p, %d)\n", wndPtr
, classPtr
, cs
, bUnicode
);
116 /* Only create top-level windows */
117 if(cs
->style
& WS_CHILD
)
120 window
= subwin(TTYDRV_GetRootWindow(), cs
->cy
/cellHeight
, cs
->cx
/cellWidth
,
121 cs
->y
/cellHeight
, cs
->x
/cellWidth
);
126 #else /* defined(WINE_CURSES) */
127 FIXME("(%p, %p, %p, %d): stub\n", wndPtr
, classPtr
, cs
, bUnicode
);
130 #endif /* defined(WINE_CURSES) */
133 /***********************************************************************
134 * TTYDRV_WND_DestroyWindow
136 BOOL
TTYDRV_WND_DestroyWindow(WND
*wndPtr
)
141 TRACE("(%p)\n", wndPtr
);
143 window
= TTYDRV_WND_GetCursesWindow(wndPtr
);
144 if(window
&& window
!= TTYDRV_GetRootWindow()) {
149 #else /* defined(WINE_CURSES) */
150 FIXME("(%p): stub\n", wndPtr
);
153 #endif /* defined(WINE_CURSES) */
156 /*****************************************************************
157 * TTYDRV_WND_SetParent
159 WND
*TTYDRV_WND_SetParent(WND
*wndPtr
, WND
*pWndParent
)
161 FIXME("(%p, %p): stub\n", wndPtr
, pWndParent
);
166 /***********************************************************************
167 * TTYDRV_WND_ForceWindowRaise
169 void TTYDRV_WND_ForceWindowRaise(WND
*wndPtr
)
171 FIXME("(%p): stub\n", wndPtr
);
174 /***********************************************************************
175 * TTYDRV_WINPOS_SetWindowPos
177 void TTYDRV_WND_SetWindowPos(WND
*wndPtr
, const WINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
)
179 FIXME("(%p, %p, %d): stub\n", wndPtr
, winpos
, bSMC_SETXPOS
);
182 /*****************************************************************
185 void TTYDRV_WND_SetText(WND
*wndPtr
, LPCWSTR text
)
187 FIXME("(%p, %s): stub\n", wndPtr
, debugstr_w(text
));
190 /*****************************************************************
191 * TTYDRV_WND_SetFocus
193 void TTYDRV_WND_SetFocus(WND
*wndPtr
)
195 FIXME("(%p): stub\n", wndPtr
);
198 /*****************************************************************
199 * TTYDRV_WND_PreSizeMove
201 void TTYDRV_WND_PreSizeMove(WND
*wndPtr
)
203 FIXME("(%p): stub\n", wndPtr
);
206 /*****************************************************************
207 * TTYDRV_WND_PostSizeMove
209 void TTYDRV_WND_PostSizeMove(WND
*wndPtr
)
211 FIXME("(%p): stub\n", wndPtr
);
214 /*****************************************************************
215 * TTYDRV_WND_ScrollWindow
217 void TTYDRV_WND_ScrollWindow( WND
*wndPtr
, HDC hdc
, INT dx
, INT dy
,
218 const RECT
*clipRect
, BOOL bUpdate
)
220 FIXME("(%p, %x, %d, %d, %p, %d): stub\n",
221 wndPtr
, hdc
, dx
, dy
, clipRect
, bUpdate
);
224 /***********************************************************************
225 * TTYDRV_WND_SetDrawable
227 void TTYDRV_WND_SetDrawable(WND
*wndPtr
, HDC hdc
, WORD flags
, BOOL bSetClipOrigin
)
229 DC
*dc
= DC_GetDCPtr( hdc
);
231 TRACE("(%p, %p, %d, %d)\n", wndPtr
, dc
, flags
, bSetClipOrigin
);
233 /* FIXME: Should be done in the common code instead */
238 if(flags
& DCX_WINDOW
) {
239 dc
->DCOrgX
= wndPtr
->rectWindow
.left
;
240 dc
->DCOrgY
= wndPtr
->rectWindow
.top
;
242 dc
->DCOrgX
= wndPtr
->rectClient
.left
;
243 dc
->DCOrgY
= wndPtr
->rectClient
.top
;
246 GDI_ReleaseObj( hdc
);
249 /***********************************************************************
250 * TTYDRV_WND_SetHostAttr
252 BOOL
TTYDRV_WND_SetHostAttr(WND
*wndPtr
, INT attr
, INT value
)
254 FIXME("(%p): stub\n", wndPtr
);
259 /***********************************************************************
260 * TTYDRV_WND_IsSelfClipping
262 BOOL
TTYDRV_WND_IsSelfClipping(WND
*wndPtr
)
264 FIXME("(%p): semistub\n", wndPtr
);
269 /***********************************************************************
270 * TTYDRV_WND_SetWindowRgn
272 void TTYDRV_WND_SetWindowRgn(struct tagWND
*wndPtr
, HRGN hrgnWnd
)