1 /* General window behavior.
3 Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
6 Contributed by Hewlett-Packard Company.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
28 #include "tuiGeneralWin.h"
39 /***********************
41 ***********************/
47 tuiRefreshWin (TuiGenWinInfoPtr winInfo
)
49 if (winInfo
->type
== DATA_WIN
&& winInfo
->contentSize
> 0)
53 for (i
= 0; (i
< winInfo
->contentSize
); i
++)
55 TuiGenWinInfoPtr dataItemWinPtr
;
57 dataItemWinPtr
= &((TuiWinContent
)
58 winInfo
->content
)[i
]->whichElement
.dataWindow
;
59 if (m_genWinPtrNotNull (dataItemWinPtr
) &&
60 dataItemWinPtr
->handle
!= (WINDOW
*) NULL
)
61 wrefresh (dataItemWinPtr
->handle
);
64 else if (winInfo
->type
== CMD_WIN
)
70 if (winInfo
->handle
!= (WINDOW
*) NULL
)
71 wrefresh (winInfo
->handle
);
80 ** Function to delete the curses window, checking for null
83 tuiDelwin (WINDOW
* window
)
85 if (window
!= (WINDOW
*) NULL
)
92 /* Draw a border arround the window. */
94 boxWin (TuiGenWinInfoPtr winInfo
, int highlightFlag
)
96 if (winInfo
&& winInfo
->handle
)
101 win
= winInfo
->handle
;
102 if (highlightFlag
== HILITE
)
103 attrs
= tui_active_border_attrs
;
105 attrs
= tui_border_attrs
;
107 wattron (win
, attrs
);
108 wborder (win
, tui_border_vline
, tui_border_vline
,
109 tui_border_hline
, tui_border_hline
,
110 tui_border_ulcorner
, tui_border_urcorner
,
111 tui_border_llcorner
, tui_border_lrcorner
);
113 mvwaddstr (win
, 0, 3, winInfo
->title
);
114 wattroff (win
, attrs
);
123 unhighlightWin (TuiWinInfoPtr winInfo
)
125 if (m_winPtrNotNull (winInfo
) && winInfo
->generic
.handle
!= (WINDOW
*) NULL
)
127 boxWin ((TuiGenWinInfoPtr
) winInfo
, NO_HILITE
);
128 wrefresh (winInfo
->generic
.handle
);
129 m_setWinHighlightOff (winInfo
);
131 } /* unhighlightWin */
138 highlightWin (TuiWinInfoPtr winInfo
)
140 if (m_winPtrNotNull (winInfo
) &&
141 winInfo
->canHighlight
&& winInfo
->generic
.handle
!= (WINDOW
*) NULL
)
143 boxWin ((TuiGenWinInfoPtr
) winInfo
, HILITE
);
144 wrefresh (winInfo
->generic
.handle
);
145 m_setWinHighlightOn (winInfo
);
151 ** checkAndDisplayHighlightIfNecessay
154 checkAndDisplayHighlightIfNeeded (TuiWinInfoPtr winInfo
)
156 if (m_winPtrNotNull (winInfo
) && winInfo
->generic
.type
!= CMD_WIN
)
158 if (winInfo
->isHighlighted
)
159 highlightWin (winInfo
);
161 unhighlightWin (winInfo
);
165 } /* checkAndDisplayHighlightIfNeeded */
172 makeWindow (TuiGenWinInfoPtr winInfo
, int boxIt
)
176 handle
= newwin (winInfo
->height
,
180 winInfo
->handle
= handle
;
181 if (handle
!= (WINDOW
*) NULL
)
183 if (boxIt
== BOX_WINDOW
)
184 boxWin (winInfo
, NO_HILITE
);
185 winInfo
->isVisible
= TRUE
;
186 scrollok (handle
, TRUE
);
193 ** We can't really make windows visible, or invisible. So we
194 ** have to delete the entire window when making it visible,
195 ** and create it again when making it visible.
198 makeVisible (TuiGenWinInfoPtr winInfo
, int visible
)
200 /* Don't tear down/recreate command window */
201 if (winInfo
->type
== CMD_WIN
)
206 if (!winInfo
->isVisible
)
210 (winInfo
->type
!= CMD_WIN
&& !m_winIsAuxillary (winInfo
->type
)));
211 winInfo
->isVisible
= TRUE
;
215 winInfo
->isVisible
&& winInfo
->handle
!= (WINDOW
*) NULL
)
217 winInfo
->isVisible
= FALSE
;
218 tuiDelwin (winInfo
->handle
);
219 winInfo
->handle
= (WINDOW
*) NULL
;
228 ** Makes all windows invisible (except the command and locator windows)
231 makeAllVisible (int visible
)
235 for (i
= 0; i
< MAX_MAJOR_WINDOWS
; i
++)
237 if (m_winPtrNotNull (winList
[i
]) &&
238 ((winList
[i
])->generic
.type
) != CMD_WIN
)
240 if (m_winIsSourceType ((winList
[i
])->generic
.type
))
241 makeVisible ((winList
[i
])->detail
.sourceInfo
.executionInfo
,
243 makeVisible ((TuiGenWinInfoPtr
) winList
[i
], visible
);
248 } /* makeAllVisible */
252 ** Function to refresh all the windows currently displayed
255 refreshAll (TuiWinInfoPtr
* list
)
258 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
260 for (type
= SRC_WIN
; (type
< MAX_MAJOR_WINDOWS
); type
++)
262 if (list
[type
] && list
[type
]->generic
.isVisible
)
264 if (type
== SRC_WIN
|| type
== DISASSEM_WIN
)
266 touchwin (list
[type
]->detail
.sourceInfo
.executionInfo
->handle
);
267 tuiRefreshWin (list
[type
]->detail
.sourceInfo
.executionInfo
);
269 touchwin (list
[type
]->generic
.handle
);
270 tuiRefreshWin (&list
[type
]->generic
);
273 if (locator
->isVisible
)
275 touchwin (locator
->handle
);
276 tuiRefreshWin (locator
);
283 /*********************************
284 ** Local Static Functions
285 *********************************/