Added cvdump tool to dump CodeView symbol information.
[wine/gsoc-2012-control.git] / windows / ttydrv / wnd.c
blobe8a21008fdc0fe927954db515f7790cd4466ea28
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_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;
43 #ifdef HAVE_LIBCURSES
44 pWndDriverData->window = NULL;
45 #endif /* defined(HAVE_LIBCURSES) */
48 /**********************************************************************
49 * TTYDRV_WND_Finalize
51 void TTYDRV_WND_Finalize(WND *wndPtr)
53 TTYDRV_WND_DATA *pWndDriverData =
54 (TTYDRV_WND_DATA *) wndPtr->pDriverData;
56 TRACE("(%p)\n", wndPtr);
58 if(!pWndDriverData) {
59 ERR("WND already destroyed\n");
60 return;
63 #ifdef HAVE_LIBCURSES
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; }
85 #ifdef HAVE_LIBCURSES
86 pWndDriverData->window = TTYDRV_WND_GetCursesRootWindow(wndPtr);
87 #endif /* defined(HAVE_LIBCURSES) */
89 return TRUE;
92 /**********************************************************************
93 * TTYDRV_WND_CreateWindow
95 BOOL TTYDRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BOOL bUnicode)
97 #ifdef HAVE_LIBCURSES
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)
105 return TRUE;
107 if(!(rootWindow = TTYDRV_WND_GetCursesRootWindow(wndPtr)))
108 return FALSE;
110 window = subwin(rootWindow, cs->cy/cellHeight, cs->cx/cellWidth,
111 cs->y/cellHeight, cs->x/cellWidth);
112 werase(window);
113 wrefresh(window);
115 return TRUE;
116 #else /* defined(HAVE_LIBCURSES) */
117 FIXME("(%p, %p, %p, %d): stub\n", wndPtr, classPtr, cs, bUnicode);
119 return TRUE;
120 #endif /* defined(HAVE_LIBCURSES) */
123 /***********************************************************************
124 * TTYDRV_WND_DestroyWindow
126 BOOL TTYDRV_WND_DestroyWindow(WND *wndPtr)
128 #ifdef HAVE_LIBCURSES
129 WINDOW *window;
131 TRACE("(%p)\n", wndPtr);
133 window = TTYDRV_WND_GetCursesWindow(wndPtr);
134 if(window && window != TTYDRV_WND_GetCursesRootWindow(wndPtr)) {
135 delwin(window);
138 return TRUE;
139 #else /* defined(HAVE_LIBCURSES) */
140 FIXME("(%p): stub\n", wndPtr);
142 return TRUE;
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);
153 return NULL;
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 /*****************************************************************
173 * TTYDRV_WND_SetText
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 */
223 if(!wndPtr) {
224 dc->w.DCOrgX = 0;
225 dc->w.DCOrgY = 0;
226 } else {
227 if(flags & DCX_WINDOW) {
228 dc->w.DCOrgX = wndPtr->rectWindow.left;
229 dc->w.DCOrgY = wndPtr->rectWindow.top;
230 } else {
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);
244 return TRUE;
247 /***********************************************************************
248 * TTYDRV_WND_IsSelfClipping
250 BOOL TTYDRV_WND_IsSelfClipping(WND *wndPtr)
252 FIXME("(%p): semistub\n", wndPtr);
254 return FALSE;