File: dialogs.h

package info (click to toggle)
bezerk 0.3.2-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 920 kB
  • ctags: 1,027
  • sloc: ansic: 12,291; sh: 1,822; makefile: 92; tcl: 56
file content (155 lines) | stat: -rw-r--r-- 4,408 bytes parent folder | download | duplicates (2)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/* Bezerk
 * Copyright (C) 1998 Tony Gale.
 *
 * 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 2 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */
 
#ifndef __DIALOGS_H__
#define __DIALOGS_H__

#include "servers.h"

#define DIALOG_CALLBACK(c) \
        void c(void *data)    

/* ------------------------------CHOICE_DIALOG---------------------------- */
typedef struct _ChoiceData {
  GtkWidget *dialog;
  void *user_data;
  void (*positive_func)(void *data);
  void (*negative_func)(void *data);
} ChoiceData;

void choice_dialog(void *user_data,
		   char *title,
		   char *question,
		   char *positive,
		   char *negative,
		   void (*positive_func)(void *data),
		   void (*negative_func)(void *data));
/* ----------------------------------------------------------------------- */

/* -----------------------FILE_SELECTION_DIALOG--------------------------- */
typedef struct _FileSelData {
  GtkWidget *window;
  void *user_data;
  int (*ok_func)(char *filename, void *data);
  void (*cancel_func)(void *data);
} FileSelData;

#define FILESEL_OK_CALLBACK(c) \
        int c(char *filename, void *data)    

#define FILESEL_CANCEL_CALLBACK(c) \
        void c(void *data)

void file_selection_dialog(void *user_data, int (*ok_func)(char *filename, void *data), 
			   void (*cancel_func)(void *data));
/* ----------------------------------------------------------------------- */

/* --------------------------PROGRESS_DIALOG------------------------------ */
typedef struct _ProgressData {
  GtkWidget *dialog;
  GtkWidget *progress_bar;
  void *user_data;
  void (*cancel_func)(void *data);
} ProgressData;

void progress_cancel(GtkWidget *widget, ProgressData *progress_data);
void progress_done(ProgressData *progress_data);
void progress_update(float value, ProgressData *progress_data);
ProgressData *progress_dialog(void *user_data, char *title, char *text, void (*cancel_func)(void *data));
/* ----------------------------------------------------------------------- */

/* ------------------------PREFERENCES_DIALOG----------------------------- */
typedef struct _PreferencesData {
  GtkWidget *dialog;
  GtkWidget *notebook;
  GdkPixmap *book_open;
  GdkPixmap *book_closed;
  GdkBitmap *book_open_mask;
  GdkBitmap *book_closed_mask;
} PreferencesData;

typedef struct _NotebookPage {
  char *name;
  void *data;
  GtkWidget*  (*create)(void **pref_data);
  gint  (*save)(void *pref_data);
  void  (*reset)(void *pref_data);
} NotebookPage;

typedef struct _UserPrefsData {
  GtkWidget *nick;
  GtkWidget *name;
  GtkWidget *server;
  GtkWidget *port;
} UserPrefsData;

typedef enum {
  FONT_NORMAL,
  FONT_BOLD,
  FONT_ITALIC,
  FONT_BOLD_ITALIC
} Font_Type;

typedef struct _FontPrefsData {
  GtkWidget *std_frame;
  GtkWidget *adv_frame;
  GtkWidget *std_type_omenu;
  GtkWidget *std_size_omenu;
  GtkWidget *adv_button;
  GtkWidget *adv_normal_label;
  GtkWidget *adv_bold_label;
  GtkWidget *adv_italic_label;
  GtkWidget *adv_bold_italic_label;
  
  char *adv;
  char *type;
  char *size;

  GtkWidget *font_sel;
  Font_Type changing_font;
  char *normal_font;
  char *bold_font;
  char *italic_font;
  char *bold_italic_font;
} FontPrefsData;

/* This has to agree with 'NotebookPage pages[]' struct in dialogs.c */
typedef enum {
  PREFS_DEFAULT = -1,
  PREFS_PERSONA_PAGE=0,
  PREFS_FONTS_PAGE,
  PREFS_SERVERS_PAGE,
} Prefs_Page;

void preferences_dialog(Prefs_Page start_page);
/* ----------------------------------------------------------------------- */

/* ------------------------NICK_DIALOG----------------------------- */

typedef struct _NickData {
  GtkWidget *dialog;
  GtkWidget *entry;

  Connection *connection;
} Nick_Data;

void nick_dialog(Connection *connection, char *message);
void about_dialog();
int script_dialog();

#endif /* __DIALOGS_H__ */