File: errorwindow.c

package info (click to toggle)
gramofile 1.6-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 820 kB
  • ctags: 536
  • sloc: ansic: 10,238; makefile: 55
file content (57 lines) | stat: -rw-r--r-- 1,174 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Error window

 * Copyright (C) 1998 J.A. Bezemer
 *
 * Licensed under the terms of the GNU General Public License.
 * ABSOLUTELY NO WARRANTY.
 * See the file `COPYING' in this directory.
 */

#include "errorwindow.h"
#include "buttons.h"
#include "boxes.h"
#include "textwindow.h"
#ifndef OLD_CURSES
#include <ncurses.h>
#else
#include <curses.h>
#endif


void
error_window_display (char *text, char *buttontext)
{
  button_t ok_button;

  ok_button.text = buttontext;
  ok_button.y = ERROR_WINDOW_Y + ERROR_WINDOW_H - 1;
  ok_button.x = ERROR_WINDOW_X + ERROR_WINDOW_W
    - 1 - strlen (ok_button.text);
  ok_button.selected = TRUE;

  mybox (ERROR_WINDOW_Y - 1, ERROR_WINDOW_X - 1,
	 ERROR_WINDOW_H + 2, ERROR_WINDOW_W + 2);
  display_textwin ("", ERROR_WINDOW_Y, ERROR_WINDOW_X,
		   ERROR_WINDOW_H, ERROR_WINDOW_W);
  display_textwin (text, ERROR_WINDOW_Y, ERROR_WINDOW_X + 1,
		   ERROR_WINDOW_H, ERROR_WINDOW_W - 2);
  button_display (&ok_button);
  move (0, 79);
  refresh ();
}


void
error_window (char *text)
{
  int i;

  error_window_display (text, " OK ");

  do
    i = getch ();
  while (i != 13 && i != KEY_ENTER && i != 27);

  clear ();
  refresh ();
}