File: bezerk.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 (126 lines) | stat: -rw-r--r-- 3,179 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
/* 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 __BEZERK_H__
#define __BEZERK_H__

#include <gtk/gtk.h>
#include "reply.h"
#include "config.h"

#define BEZ_CHECK_CAST(obj, cast)      ((cast *) (obj))

#define BUFFLEN 520

typedef enum
{
  BEZ_CHANNEL,
  BEZ_MESSAGE
} BezWindowType;

typedef struct _BezBaseWindow
{
  BezWindowType type;
  GtkWidget *window;
  GtkWidget *text;
  guint numlines;
  GtkWidget *entry;
  struct _Connection *connection;
  struct _MenuBar *menu_bar;
  GList *recall_commands;
  GList *recall_current;
  char *incomplete_command;
} BezBaseWindow;

typedef struct _Toolbar
{
  GtkWidget *toolbar;
  GtkWidget *combo;
} Toolbar;
  
typedef struct _BezChannelWindow
{
  BezWindowType type;
  GtkWidget *window;
  GtkWidget *text;
  guint numlines;
  GtkWidget *entry;
  struct _Connection *connection;
  struct _MenuBar *menu_bar;
  GList *recall_commands;
  GList *recall_current;
  char *incomplete_command;

  struct _Toolbar *toolbar;
  GtkWidget *ch_clist;
  GtkWidget *nick_clist;
  int selected_row;
  GtkWidget *notify_clist;
  GtkWidget *user_status;
  GtkWidget *channel_status;
  struct _ChannelInfo *current_channel;
} BezChannelWindow;

typedef enum {
  DCC_CHAT,
  IRC_MSG
} BezMessageType;

typedef struct _BezMessageWindow
{
  BezWindowType type;
  GtkWidget *window;
  GtkWidget *text;
  guint numlines;
  GtkWidget *entry;
  struct _Connection *connection;
  struct _MenuBar *menu_bar;
  GList *recall_commands;
  GList *recall_current;
  char *incomplete_command;

  char *nick;
  GtkWidget *status;
  BezMessageType message_type;
} BezMessageWindow;

typedef union _BezWindow
{
  BezWindowType type;
  BezBaseWindow base;
  BezChannelWindow channel;
  BezMessageWindow message;
} BezWindow;

#define BEZ_WINDOW(obj)             BEZ_CHECK_CAST(obj, BezWindow)
#define BEZ_BASE_WINDOW(obj)        BEZ_CHECK_CAST(obj, BezBaseWindow)
#define BEZ_CHANNEL_WINDOW(obj)     BEZ_CHECK_CAST(obj, BezChannelWindow)
#define BEZ_MESSAGE_WINDOW(obj)     BEZ_CHECK_CAST(obj, BezMessageWindow)

#define IS_BEZ_CHANNEL_WINDOW(obj)  (obj->type == BEZ_CHANNEL)
#define IS_BEZ_MESSAGE_WINDOW(obj)  (obj->type == BEZ_MESSAGE)
#define IS_BEZ_WINDOW(obj)          (IS_BEZ_CHANNEL_WINDOW(obj) || IS_BEZ_MESSAGE_WINDOW(obj))

#define OKAY   0
#define NOTREG 1
#define AWAY   2

BezWindow *create_channel_window(char *title, gint top_level);
BezWindow *create_message_window(BezMessageType type, char *nick);

#endif /* __BEZERK_H__ */