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_GetCursesRootWindow
34 * Return the Curses root window of the Curses window associated
38 WINDOW *TTYDRV_WND_GetCursesRootWindow(WND *wndPtr)
40 while(wndPtr->parent) wndPtr = wndPtr->parent;
41 return TTYDRV_DESKTOP_GetCursesRootWindow((struct tagDESKTOP *) wndPtr->wExtra);
43 #endif /* defined(HAVE_LIBCURSES) */
45 /**********************************************************************
46 * TTYDRV_WND_Initialize
48 void TTYDRV_WND_Initialize(WND *wndPtr)
50 TTYDRV_WND_DATA *pWndDriverData =
51 (TTYDRV_WND_DATA *) HeapAlloc(SystemHeap, 0, sizeof(TTYDRV_WND_DATA));
53 TRACE("(%p)\n", wndPtr);
55 wndPtr->pDriverData = (void *) pWndDriverData;
58 pWndDriverData->window = NULL;
59 #endif /* defined(HAVE_LIBCURSES) */
62 /**********************************************************************
65 void TTYDRV_WND_Finalize(WND *wndPtr)
67 TTYDRV_WND_DATA *pWndDriverData =
68 (TTYDRV_WND_DATA *) wndPtr->pDriverData;
70 TRACE("(%p)\n", wndPtr);
73 ERR("WND already destroyed\n");
78 if(pWndDriverData->window) {
79 ERR("WND destroyed without destroying the associated Curses Windows");
81 #endif /* defined(HAVE_LIBCURSES) */
83 HeapFree(SystemHeap, 0, pWndDriverData);
84 wndPtr->pDriverData = NULL;
87 /**********************************************************************
88 * TTYDRV_WND_CreateDesktopWindow
90 BOOL TTYDRV_WND_CreateDesktopWindow(WND *wndPtr, CLASS *classPtr, BOOL bUnicode)
92 TTYDRV_WND_DATA *pWndDriverData =
93 (TTYDRV_WND_DATA *) wndPtr->pDriverData;
95 TRACE("(%p, %p, %d)\n", wndPtr, classPtr, bUnicode);
97 if(!pWndDriverData) { ERR("WND never initialized\n"); return FALSE; }
100 pWndDriverData->window = TTYDRV_WND_GetCursesRootWindow(wndPtr);
101 #endif /* defined(HAVE_LIBCURSES) */
106 /**********************************************************************
107 * TTYDRV_WND_CreateWindow
109 BOOL TTYDRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BOOL bUnicode)
111 #ifdef HAVE_LIBCURSES
112 WINDOW *window, *rootWindow;
113 INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
115 TRACE("(%p, %p, %p, %d)\n", wndPtr, classPtr, cs, bUnicode);
117 /* Only create top-level windows */
118 if(cs->style & WS_CHILD)
121 if(!(rootWindow = TTYDRV_WND_GetCursesRootWindow(wndPtr)))
124 window = subwin(rootWindow, cs->cy/cellHeight, cs->cx/cellWidth,
125 cs->y/cellHeight, cs->x/cellWidth);
130 #else /* defined(HAVE_LIBCURSES) */
131 FIXME("(%p, %p, %p, %d): stub\n", wndPtr, classPtr, cs, bUnicode);
134 #endif /* defined(HAVE_LIBCURSES) */
137 /***********************************************************************
138 * TTYDRV_WND_DestroyWindow
140 BOOL TTYDRV_WND_DestroyWindow(WND *wndPtr)
142 #ifdef HAVE_LIBCURSES
145 TRACE("(%p)\n", wndPtr);
147 window = TTYDRV_WND_GetCursesWindow(wndPtr);
148 if(window && window != TTYDRV_WND_GetCursesRootWindow(wndPtr)) {
153 #else /* defined(HAVE_LIBCURSES) */
154 FIXME("(%p): stub\n", wndPtr);
157 #endif /* defined(HAVE_LIBCURSES) */
160 /*****************************************************************
161 * TTYDRV_WND_SetParent
163 WND *TTYDRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
165 FIXME("(%p, %p): stub\n", wndPtr, pWndParent);
170 /***********************************************************************
171 * TTYDRV_WND_ForceWindowRaise
173 void TTYDRV_WND_ForceWindowRaise(WND *wndPtr)
175 FIXME("(%p): stub\n", wndPtr);
178 /***********************************************************************
179 * TTYDRV_WINPOS_SetWindowPos
181 void TTYDRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bSMC_SETXPOS)
183 FIXME("(%p, %p, %d): stub\n", wndPtr, winpos, bSMC_SETXPOS);
186 /*****************************************************************
189 void TTYDRV_WND_SetText(WND *wndPtr, LPCSTR text)
191 FIXME("(%p, %s): stub\n", wndPtr, debugstr_a(text));
194 /*****************************************************************
195 * TTYDRV_WND_SetFocus
197 void TTYDRV_WND_SetFocus(WND *wndPtr)
199 FIXME("(%p): stub\n", wndPtr);
202 /*****************************************************************
203 * TTYDRV_WND_PreSizeMove
205 void TTYDRV_WND_PreSizeMove(WND *wndPtr)
207 FIXME("(%p): stub\n", wndPtr);
210 /*****************************************************************
211 * TTYDRV_WND_PostSizeMove
213 void TTYDRV_WND_PostSizeMove(WND *wndPtr)
215 FIXME("(%p): stub\n", wndPtr);
218 /*****************************************************************
219 * TTYDRV_WND_ScrollWindow
221 void TTYDRV_WND_ScrollWindow(
222 WND *wndPtr, DC *dcPtr, INT dx, INT dy,
223 const RECT *clipRect, BOOL bUpdate)
225 FIXME("(%p, %p, %d, %d, %p, %d): stub\n",
226 wndPtr, dcPtr, dx, dy, clipRect, bUpdate);
229 /***********************************************************************
230 * TTYDRV_WND_SetDrawable
232 void TTYDRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin)
234 TRACE("(%p, %p, %d, %d)\n", wndPtr, dc, flags, bSetClipOrigin);
236 /* FIXME: Should be done in the common code instead */
241 if(flags & DCX_WINDOW) {
242 dc->w.DCOrgX = wndPtr->rectWindow.left;
243 dc->w.DCOrgY = wndPtr->rectWindow.top;
245 dc->w.DCOrgX = wndPtr->rectClient.left;
246 dc->w.DCOrgY = wndPtr->rectClient.top;
251 /***********************************************************************
252 * TTYDRV_WND_SetHostAttr
254 BOOL TTYDRV_WND_SetHostAttr(WND *wndPtr, INT attr, INT value)
256 FIXME("(%p): stub\n", wndPtr);
261 /***********************************************************************
262 * TTYDRV_WND_IsSelfClipping
264 BOOL TTYDRV_WND_IsSelfClipping(WND *wndPtr)
266 FIXME("(%p): semistub\n", wndPtr);