ekg2  GIT master
windows.h
Idź do dokumentacji tego pliku.
1 /* $Id$ */
2 
3 /*
4  * (C) Copyright 2003 Wojtek Kaniewski <wojtekka@irc.pl>
5  * 2004 Piotr Kupisiewicz <deli@rzepaknet.us>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License Version 2 as
9  * published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 #ifndef __EKG_WINDOWS_H
22 #define __EKG_WINDOWS_H
23 
24 #include "ekg2-config.h"
25 
26 #include <glib.h>
27 
28 #include "commands.h"
29 #include "dynstuff.h"
30 #include "sessions.h"
31 #include "themes.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Reserved window id: 1000-1999
39  * windows reverved for special use.
40  * 1000 - __contacts,
41  * 1001 - __lastlog
42  */
43 typedef enum {
50 
51 typedef struct {
52  void *w; /* window, if NULL it means current */
53  int casense : 2; /* 0 - ignore case; 1 - don't ignore case, -1 - use global variable */
54  unsigned int lock : 1; /* if 0, don't update */
55  unsigned int isregex : 1; /* 1 - in target regexp */
56  GRegex *reg; /* regexp compilated expression */
57  char *expression; /* expression */
59 
60 typedef enum {
61  EKG_WINACT_NONE = 0, /* No activity in window */
62  EKG_WINACT_JUNK, /* Junks: status change, irc join/part, etc. */
63  EKG_WINACT_MSG, /* Message, but not to us */
64  EKG_WINACT_IMPORTANT /* important message */
65 } winact_t;
66 
67 typedef struct window {
68  struct window *next;
69 
70  unsigned short id; /* numer okna */
71  char *target; /* nick query albo inna nazwa albo NULL */
72  char *alias; /* name for display */
73  session_t *session; /* której sesji dotyczy okno */
74 
75  unsigned short left, top; /* pozycja (x, y) względem początku ekranu */
76  unsigned short width, height; /* wymiary okna */
77 
78  unsigned int act : 2; /* activity: 1 - status/junk; 2 - msg ; 3 - msg to us */
79  unsigned int in_typing : 1; /* user is composing a message to us */
80  unsigned int more : 1; /* pojawiło się coś poza ekranem */
81  unsigned int floating : 1; /* czy pływające? */
82  unsigned int doodle : 1; /* czy do gryzmolenia? [we don't set it anywhere] */
83 
84  unsigned int frames : 4; /* informacje o ramkach */
85  unsigned int edge : 4; /* okienko brzegowe */
86 
87  unsigned int nowrap : 1; /* nie zawijamy linii */
88  unsigned int hide : 1; /* ukrywamy, bo jest zbyt duże */
89 
90  unsigned int last_chatstate; /* last chat state */
91  time_t last_update; /* czas ostatniego uaktualnienia */
92  unsigned short lock; /* blokowanie zmian w obrębie komendy */
93 
94  struct userlist *userlist; /* sometimes window may require separate userlist */
95 
96  window_lastlog_t *lastlog; /* prywatne informacje lastloga */
97  void *priv_data; /* prywatne informacje ui */
98 } window_t;
99 
100 #ifndef EKG2_WIN32_NOFUNCTION
101 
102 extern window_t *windows;
103 extern window_t *window_debug;
104 extern window_t *window_status;
105 extern window_t *window_current;
106 
107 window_t *window_find(const char *target);
108 window_t *window_find_sa(session_t *session, const char *target, int session_null_means_no_session);
109 
110 #define window_find_s(s, target) window_find_sa(s, target, 1) /* XXX, need checking */
112 window_t *window_new(const char *target, session_t *session, int new_id);
113 void window_kill(window_t *w);
114 void window_switch(int id);
115 window_t *window_exist(int id);
117 void print_window_w(window_t *w, int activity, const char *theme, ...); /* themes.c */
119 
120 void window_session_set(window_t *w, session_t *newsession);
122 
123 int window_lock_inc(window_t *w);
124 int window_lock_dec(window_t *w);
125 
126 void windows_destroy(void);
127 #endif
128 
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* __EKG_WINDOW_H */
136 
137 /*
138  * Local Variables:
139  * mode: c
140  * c-file-style: "k&r"
141  * c-basic-offset: 8
142  * indent-tabs-mode: t
143  * End:
144  */
unsigned int doodle
Definition: windows.h:82
int window_lock_inc(window_t *w)
Definition: windows.c:891
unsigned int act
Definition: windows.h:78
unsigned int last_chatstate
Definition: windows.h:90
window_t * window_find(const char *target)
Definition: windows.c:164
Definition: sessions.h:127
Definition: themes.h:36
window_reserved_id_t
Definition: windows.h:43
void * priv_data
Definition: windows.h:97
unsigned short top
Definition: windows.h:75
Definition: windows.h:64
Definition: windows.h:62
window_t * window_new(const char *target, session_t *session, int new_id)
Definition: windows.c:243
int window_session_cycle(window_t *w)
Definition: windows.c:808
int window_lock_dec(window_t *w)
Definition: windows.c:900
void window_print(window_t *w, fstring_t *line)
Definition: windows.c:327
unsigned int nowrap
Definition: windows.h:87
unsigned int floating
Definition: windows.h:81
time_t last_update
Definition: windows.h:91
void window_switch(int id)
Definition: windows.c:175
char * target
Definition: windows.h:71
winact_t
Definition: windows.h:60
unsigned int frames
Definition: windows.h:84
window_lastlog_t * lastlog
Definition: windows.h:96
void * w
Definition: windows.h:52
struct userlist * userlist
Definition: windows.h:94
Definition: windows.h:61
window_t * window_find_ptr(window_t *w)
Definition: windows.c:66
#define COMMAND(x)
Definition: commands.h:35
Definition: windows.h:63
unsigned int in_typing
Definition: windows.h:79
void window_session_set(window_t *w, session_t *newsession)
Definition: windows.c:756
window_t * window_current
Definition: windows.c:45
struct window * next
Definition: windows.h:68
int cmd_window(const char *name, const char **params, session_t *session, const char *target, int quiet)
Definition: windows.c:569
unsigned short width
Definition: windows.h:76
void windows_destroy(void)
Definition: windows.c:41
int casense
Definition: windows.h:53
unsigned short lock
Definition: windows.h:92
#define line
Definition: bindings.c:50
window_t * windows
Definition: windows.c:33
window_t * window_debug
Definition: windows.c:47
session_t * session
Definition: windows.h:73
unsigned short left
Definition: windows.h:75
char * window_target(window_t *window)
Definition: windows.c:556
window_t * window_status
Definition: windows.c:46
Definition: userlist.h:54
unsigned int isregex
Definition: windows.h:55
void print_window_w(window_t *w, int activity, const char *theme,...)
Definition: themes.c:1092
Definition: windows.h:51
unsigned int edge
Definition: windows.h:85
Definition: windows.h:67
unsigned short height
Definition: windows.h:76
unsigned int hide
Definition: windows.h:88
unsigned int lock
Definition: windows.h:54
window_t * window_find_sa(session_t *session, const char *target, int session_null_means_no_session)
Definition: windows.c:94
window_t * window_exist(int id)
Definition: windows.c:471
char * expression
Definition: windows.h:57
GRegex * reg
Definition: windows.h:56
Definition: windows.h:45
char * alias
Definition: windows.h:72
Definition: windows.h:44
unsigned short id
Definition: windows.h:70
struct window window_t
unsigned int more
Definition: windows.h:80
Definition: windows.h:48
Definition: windows.h:46
void window_kill(window_t *w)
Definition: windows.c:410
Definition: windows.h:47