summaryrefslogtreecommitdiff
path: root/gtkwindows.h
blob: 46f1a055a9a351e0a09bb42b046fa00aabfc4743 (plain)
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
/*
 * Copyright (C) 2006-2019 Jon Kinsey <[email protected]>
 * Copyright (C) 2006-2018 the AUTHORS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * $Id: gtkwindows.h,v 1.26 2019/11/14 20:39:10 plm Exp $
 */

#ifndef GTKWINDOWS_H
#define GTKWINDOWS_H

#include <gtk/gtk.h>

#define GTK_STOCK_DIALOG_GNU "gtk-dialog-gnu"   /* stock gnu head icon */
#define GTK_STOCK_DIALOG_GNU_QUESTION "gtk-dialog-gnuquestion"  /* stock gnu head icon with question mark */
#define GTK_STOCK_DIALOG_GNU_BIG "gtk-dialog-gnubig"    /* large gnu icon */

enum {                          /* Dialog flags */
    DIALOG_FLAG_NONE = 0,
    DIALOG_FLAG_MODAL = 1,
    DIALOG_FLAG_NOOK = 2,
    DIALOG_FLAG_CLOSEBUTTON = 4,
    DIALOG_FLAG_NOTIDY = 8,
    DIALOG_FLAG_MINMAXBUTTONS = 16,
    DIALOG_FLAG_NORESPONSE = 32
};

typedef enum {
    DA_MAIN,
    DA_BUTTONS,
    DA_OK
} dialogarea;

typedef enum {
    DT_INFO,
    DT_QUESTION,
    DT_AREYOUSURE,
    DT_WARNING,
    DT_ERROR,
    DT_CUSTOM,
    NUM_DIALOG_TYPES
} dialogtype;

extern GtkWidget *GTKCreateDialog(const char *szTitle, const dialogtype dt,
                                  GtkWidget * parent, int flags, GCallback okFun, void *p);
extern GtkWidget *DialogArea(GtkWidget * pw, dialogarea da);
extern void GTKRunDialog(GtkWidget * dialog);

extern int GTKGetInputYN(char *szPrompt);
extern char *GTKGetInput(char *title, char *prompt, GtkWidget * parent);

extern int GTKMessage(const char *sz, dialogtype dt);
extern void GTKSetCurrentParent(GtkWidget * parent);
extern GtkWidget *GTKGetCurrentParent(void);

typedef enum {
    WARN_FULLSCREEN_EXIT = 0,
    WARN_SET_SHADOWS,
    WARN_UNACCELERATED,
    WARN_STOP,
    WARN_ENDGAME,
    WARN_RESIGN,
    WARN_ROLLOUT,
    WARN_NUM_WARNINGS
} warningType;

extern int GTKShowWarning(warningType warning, GtkWidget * pwParent);
extern warningType ParseWarning(char *str);
extern void SetWarningEnabled(warningType warning, int value);
extern int GetWarningEnabled(warningType warning);
extern void PrintWarning(warningType warning);
extern void WriteWarnings(FILE * pf);

#endif