4 * Copyright 1998,1999 Patrik Stridvall
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(ttydrv
)
18 /***********************************************************************
19 * TTYDRV_WND_GetCursesWindow
21 * Return the Curses window associated to a window.
24 WINDOW
*TTYDRV_WND_GetCursesWindow(WND
*wndPtr
)
26 return wndPtr
&& wndPtr
->pDriverData
?
27 ((TTYDRV_WND_DATA
*) wndPtr
->pDriverData
)->window
: 0;
29 #endif /* defined(HAVE_LIBCURSES) */
31 /**********************************************************************
32 * TTYDRV_WND_Initialize
34 void TTYDRV_WND_Initialize(WND
*wndPtr
)
36 TTYDRV_WND_DATA
*pWndDriverData
=
37 (TTYDRV_WND_DATA
*) HeapAlloc(SystemHeap
, 0, sizeof(TTYDRV_WND_DATA
));
39 TRACE("(%p)\n", wndPtr
);
41 wndPtr
->pDriverData
= (void *) pWndDriverData
;
44 pWndDriverData
->window
= NULL
;
45 #endif /* defined(HAVE_LIBCURSES) */
48 /**********************************************************************
51 void TTYDRV_WND_Finalize(WND
*wndPtr
)
53 TTYDRV_WND_DATA
*pWndDriverData
=
54 (TTYDRV_WND_DATA
*) wndPtr
->pDriverData
;
56 TRACE("(%p)\n", wndPtr
);
59 ERR("WND already destroyed\n");
64 if(pWndDriverData
->window
) {
65 ERR("WND destroyed without destroying the associated Curses Windows");
67 #endif /* defined(HAVE_LIBCURSES) */
69 HeapFree(SystemHeap
, 0, pWndDriverData
);
70 wndPtr
->pDriverData
= NULL
;
73 /**********************************************************************
74 * TTYDRV_WND_CreateDesktopWindow
76 BOOL
TTYDRV_WND_CreateDesktopWindow(WND
*wndPtr
, CLASS
*classPtr
, BOOL bUnicode
)
78 TTYDRV_WND_DATA
*pWndDriverData
=
79 (TTYDRV_WND_DATA
*) wndPtr
->pDriverData
;
81 TRACE("(%p, %p, %d)\n", wndPtr
, classPtr
, bUnicode
);
83 if(!pWndDriverData
) { ERR("WND never initialized\n"); return FALSE
; }
86 pWndDriverData
->window
= TTYDRV_WND_GetCursesRootWindow(wndPtr
);
87 #endif /* defined(HAVE_LIBCURSES) */
92 /**********************************************************************
93 * TTYDRV_WND_CreateWindow
95 BOOL
TTYDRV_WND_CreateWindow(WND
*wndPtr
, CLASS
*classPtr
, CREATESTRUCTA
*cs
, BOOL bUnicode
)
98 WINDOW
*window
, *rootWindow
;
99 INT cellWidth
=8, cellHeight
=8; /* FIXME: Hardcoded */
101 TRACE("(%p, %p, %p, %d)\n", wndPtr
, classPtr
, cs
, bUnicode
);
103 /* Only create top-level windows */
104 if(cs
->style
& WS_CHILD
)
107 if(!(rootWindow
= TTYDRV_WND_GetCursesRootWindow(wndPtr
)))
110 window
= subwin(rootWindow
, cs
->cy
/cellHeight
, cs
->cx
/cellWidth
,
111 cs
->y
/cellHeight
, cs
->x
/cellWidth
);
116 #else /* defined(HAVE_LIBCURSES) */
117 FIXME("(%p, %p, %p, %d): stub\n", wndPtr
, classPtr
, cs
, bUnicode
);
120 #endif /* defined(HAVE_LIBCURSES) */
123 /***********************************************************************
124 * TTYDRV_WND_DestroyWindow
126 BOOL
TTYDRV_WND_DestroyWindow(WND
*wndPtr
)
128 #ifdef HAVE_LIBCURSES
131 TRACE("(%p)\n", wndPtr
);
133 window
= TTYDRV_WND_GetCursesWindow(wndPtr
);
134 if(window
&& window
!= TTYDRV_WND_GetCursesRootWindow(wndPtr
)) {
139 #else /* defined(HAVE_LIBCURSES) */
140 FIXME("(%p): stub\n", wndPtr
);
143 #endif /* defined(HAVE_LIBCURSES) */
146 /*****************************************************************
147 * TTYDRV_WND_SetParent
149 WND
*TTYDRV_WND_SetParent(WND
*wndPtr
, WND
*pWndParent
)
151 FIXME("(%p, %p): stub\n", wndPtr
, pWndParent
);
156 /***********************************************************************
157 * TTYDRV_WND_ForceWindowRaise
159 void TTYDRV_WND_ForceWindowRaise(WND
*wndPtr
)
161 FIXME("(%p): stub\n", wndPtr
);
164 /***********************************************************************
165 * TTYDRV_WINPOS_SetWindowPos
167 void TTYDRV_WND_SetWindowPos(WND
*wndPtr
, const WINDOWPOS
*winpos
, BOOL bSMC_SETXPOS
)
169 FIXME("(%p, %p, %d): stub\n", wndPtr
, winpos
, bSMC_SETXPOS
);
172 /*****************************************************************
175 void TTYDRV_WND_SetText(WND
*wndPtr
, LPCSTR text
)
177 FIXME("(%p, %s): stub\n", wndPtr
, debugstr_a(text
));
180 /*****************************************************************
181 * TTYDRV_WND_SetFocus
183 void TTYDRV_WND_SetFocus(WND
*wndPtr
)
185 FIXME("(%p): stub\n", wndPtr
);
188 /*****************************************************************
189 * TTYDRV_WND_PreSizeMove
191 void TTYDRV_WND_PreSizeMove(WND
*wndPtr
)
193 FIXME("(%p): stub\n", wndPtr
);
196 /*****************************************************************
197 * TTYDRV_WND_PostSizeMove
199 void TTYDRV_WND_PostSizeMove(WND
*wndPtr
)
201 FIXME("(%p): stub\n", wndPtr
);
204 /*****************************************************************
205 * TTYDRV_WND_ScrollWindow
207 void TTYDRV_WND_ScrollWindow(
208 WND
*wndPtr
, DC
*dcPtr
, INT dx
, INT dy
,
209 const RECT
*clipRect
, BOOL bUpdate
)
211 FIXME("(%p, %p, %d, %d, %p, %d): stub\n",
212 wndPtr
, dcPtr
, dx
, dy
, clipRect
, bUpdate
);
215 /***********************************************************************
216 * TTYDRV_WND_SetDrawable
218 void TTYDRV_WND_SetDrawable(WND
*wndPtr
, DC
*dc
, WORD flags
, BOOL bSetClipOrigin
)
220 TRACE("(%p, %p, %d, %d)\n", wndPtr
, dc
, flags
, bSetClipOrigin
);
222 /* FIXME: Should be done in the common code instead */
227 if(flags
& DCX_WINDOW
) {
228 dc
->w
.DCOrgX
= wndPtr
->rectWindow
.left
;
229 dc
->w
.DCOrgY
= wndPtr
->rectWindow
.top
;
231 dc
->w
.DCOrgX
= wndPtr
->rectClient
.left
;
232 dc
->w
.DCOrgY
= wndPtr
->rectClient
.top
;
237 /***********************************************************************
238 * TTYDRV_WND_SetHostAttr
240 BOOL
TTYDRV_WND_SetHostAttr(WND
*wndPtr
, INT attr
, INT value
)
242 FIXME("(%p): stub\n", wndPtr
);
247 /***********************************************************************
248 * TTYDRV_WND_IsSelfClipping
250 BOOL
TTYDRV_WND_IsSelfClipping(WND
*wndPtr
)
252 FIXME("(%p): semistub\n", wndPtr
);