File: msgbox.h

package info (click to toggle)
gps 1.1.0-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,024 kB
  • ctags: 1,006
  • sloc: cpp: 11,581; sh: 381; makefile: 316; ansic: 227; perl: 17
file content (102 lines) | stat: -rw-r--r-- 2,510 bytes parent folder | download | duplicates (4)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* $Id: msgbox.h,v 1.4 2000/02/20 21:45:35 bergo Exp $ */

/* GPL'd (C) 1999-2000 Felipe Bergo -- bergo@seul.org */

/* 

   This module is built up of the following files:
   
   msgbox.h
   msgbox.cc _OR_ msgbox.c
   question.xpm
   bong.xpm
   exclamation.xpm
   info.xpm

*/

/* return values */

#ifndef FB_MSGBOX_H
#define FB_MSGBOX_H

#include <gtk/gtk.h>

/* ENUMS */

typedef enum
{
  MSGBOX_ICON_NONE,
  MSGBOX_ICON_ERROR,
  MSGBOX_ICON_INFO,
  MSGBOX_ICON_EXCLAMATION,
  MSGBOX_ICON_QUESTION
} MsgBoxIcon;

typedef enum
{
  MSGBOX_OK,
  MSGBOX_OKCANCEL,
  MSGBOX_YESNO,
  MSGBOX_YESNOCANCEL
} MsgBoxType;

typedef enum
{
  MSGBOX_R_OK,
  MSGBOX_R_YES,
  MSGBOX_R_NO,
  MSGBOX_R_CANCEL
} MsgBoxResult;

/* prototype */

/* 
   obs 1: this call blocks until the user picks a choice.
   obs 2: parent can be NULL.
   obs 3: you must have a gtk_main loop running before calling it.
*/

MsgBoxResult message_box(GtkWindow *parent,
			 char *txt,
			 char *title,
			 MsgBoxType mbt,
			 MsgBoxIcon mbi);

/* 
   excerpt from my 900-page book

   "The Ultimate Guide to Message Box Icons
    Felipe Bergo - 0th edition
    Prentice Room publishers,    
    ISBN 6666-6666-6666"

   MSGBOX_ICON_NONE          No icon.

   MSGBOX_ICON_ERROR         Should be used on errors, i.e.,
                             something wrong really happened.
                             Currently included icon is a white
                             cross in a red circle. "bong.xpm"

   MSGBOX_ICON_QUESTION      Should be used on any questions, like
                             confirmations. Currently included
                             icon is a white question mark in a 
                             green circle. "question.xpm"

   MSGBOX_ICON_EXCLAMATION   Should be used on warnings, like when
                             your code tries to allocate a resource
                             and it is busy (and being busy is "normal").
                             Currently included icon is a black exclamation
                             mark in an yellow triangle.

   MSGBOX_ICON_INFO          Should be used on general informative
                             messages, like "Operation Finished",
                             "Scan finished: 999999 blocks,
                              999998 bad, 1 good.", and the like.
                             Currently included icon is a white "i"
                             in a blue square.

   The return value is an enum of MsgBoxResult type.
*/

#endif