Improved the stubs.
[wine.git] / windows / ttydrv / wnd.c
blob4d662bf6b0ec7159203e9c05fe4b6709f246295b
1 /*
2 * TTY window driver
4 * Copyright 1998,1999 Patrik Stridvall
5 */
7 #include "config.h"
9 #include "class.h"
10 #include "dc.h"
11 #include "heap.h"
12 #include "ttydrv.h"
13 #include "win.h"
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(ttydrv)
18 /***********************************************************************
19 * TTYDRV_WND_GetCursesWindow
21 * Return the Curses window associated to a window.
23 #ifdef HAVE_LIBCURSES
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
35 * to a window.
37 #ifdef HAVE_LIBCURSES
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;
57 #ifdef HAVE_LIBCURSES
58 pWndDriverData->window = NULL;
59 #endif /* defined(HAVE_LIBCURSES) */
62 /**********************************************************************
63 * TTYDRV_WND_Finalize
65 void TTYDRV_WND_Finalize(WND *wndPtr)
67 TTYDRV_WND_DATA *pWndDriverData =
68 (TTYDRV_WND_DATA *) wndPtr->pDriverData;
70 TRACE("(%p)\n", wndPtr);
72 if(!pWndDriverData) {
73 ERR("WND already destroyed\n");
74 return;
77 #ifdef HAVE_LIBCURSES
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; }
99 #ifdef HAVE_LIBCURSES
100 pWndDriverData->window = TTYDRV_WND_GetCursesRootWindow(wndPtr);
101 #endif /* defined(HAVE_LIBCURSES) */
103 return TRUE;
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)
119 return TRUE;
121 rootWindow = TTYDRV_WND_GetCursesRootWindow(wndPtr);
123 window = subwin(rootWindow, cs->cy/cellHeight, cs->cx/cellWidth,
124 cs->y/cellHeight, cs->x/cellWidth);
125 werase(window);
126 wrefresh(window);
128 return TRUE;
129 #else /* defined(HAVE_LIBCURSES) */
130 FIXME("(%p, %p, %p, %d): stub\n", wndPtr, classPtr, cs, bUnicode);
132 return TRUE;
133 #endif /* defined(HAVE_LIBCURSES) */
136 /***********************************************************************
137 * TTYDRV_WND_DestroyWindow
139 BOOL TTYDRV_WND_DestroyWindow(WND *wndPtr)
141 #ifdef HAVE_LIBCURSES
142 WINDOW *window;
144 TRACE("(%p)\n", wndPtr);
146 window = TTYDRV_WND_GetCursesWindow(wndPtr);
147 if(window && window != TTYDRV_WND_GetCursesRootWindow(wndPtr)) {
148 delwin(window);
151 return TRUE;
152 #else /* defined(HAVE_LIBCURSES) */
153 FIXME("(%p): stub\n", wndPtr);
155 return TRUE;
156 #endif /* defined(HAVE_LIBCURSES) */
159 /*****************************************************************
160 * TTYDRV_WND_SetParent
162 WND *TTYDRV_WND_SetParent(WND *wndPtr, WND *pWndParent)
164 FIXME("(%p, %p): stub\n", wndPtr, pWndParent);
166 return NULL;
169 /***********************************************************************
170 * TTYDRV_WND_ForceWindowRaise
172 void TTYDRV_WND_ForceWindowRaise(WND *wndPtr)
174 FIXME("(%p): stub\n", wndPtr);
177 /***********************************************************************
178 * TTYDRV_WINPOS_SetWindowPos
180 void TTYDRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bSMC_SETXPOS)
182 FIXME("(%p, %p, %d): stub\n", wndPtr, winpos, bSMC_SETXPOS);
185 /*****************************************************************
186 * TTYDRV_WND_SetText
188 void TTYDRV_WND_SetText(WND *wndPtr, LPCSTR text)
190 FIXME("(%p, %s): stub\n", wndPtr, debugstr_a(text));
193 /*****************************************************************
194 * TTYDRV_WND_SetFocus
196 void TTYDRV_WND_SetFocus(WND *wndPtr)
198 FIXME("(%p): stub\n", wndPtr);
201 /*****************************************************************
202 * TTYDRV_WND_PreSizeMove
204 void TTYDRV_WND_PreSizeMove(WND *wndPtr)
206 FIXME("(%p): stub\n", wndPtr);
209 /*****************************************************************
210 * TTYDRV_WND_PostSizeMove
212 void TTYDRV_WND_PostSizeMove(WND *wndPtr)
214 FIXME("(%p): stub\n", wndPtr);
217 /*****************************************************************
218 * TTYDRV_WND_ScrollWindow
220 void TTYDRV_WND_ScrollWindow(
221 WND *wndPtr, DC *dcPtr, INT dx, INT dy,
222 const RECT *clipRect, BOOL bUpdate)
224 FIXME("(%p, %p, %d, %d, %p, %d): stub\n",
225 wndPtr, dcPtr, dx, dy, clipRect, bUpdate);
228 /***********************************************************************
229 * TTYDRV_WND_SetDrawable
231 void TTYDRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin)
233 FIXME("(%p, %p, %d, %d): semistub\n", wndPtr, dc, flags, bSetClipOrigin);
235 if (!wndPtr) {
236 /* Get a DC for the whole screen */
237 dc->w.DCOrgX = 0;
238 dc->w.DCOrgY = 0;
239 } else {
240 if (flags & DCX_WINDOW) {
241 dc->w.DCOrgX = wndPtr->rectWindow.left;
242 dc->w.DCOrgY = wndPtr->rectWindow.top;
243 } else {
244 dc->w.DCOrgX = wndPtr->rectClient.left;
245 dc->w.DCOrgY = wndPtr->rectClient.top;
250 /***********************************************************************
251 * TTYDRV_WND_SetHostAttr
253 BOOL TTYDRV_WND_SetHostAttr(WND *wndPtr, INT attr, INT value)
255 FIXME("(%p): stub\n", wndPtr);
257 return TRUE;
260 /***********************************************************************
261 * TTYDRV_WND_IsSelfClipping
263 BOOL TTYDRV_WND_IsSelfClipping(WND *wndPtr)
265 FIXME("(%p): semistub\n", wndPtr);
267 return FALSE;