pidgin  2.13.0
About: Pidgin is a chat program (multi-protocol instant messaging client) which lets you log in to accounts on multiple chat networks simultaneously (old name "gaim").
  Fossies Dox: pidgin-2.13.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

gntwidget.h
Go to the documentation of this file.
1 
5 /*
6  * GNT - The GLib Ncurses Toolkit
7  *
8  * GNT is the legal property of its developers, whose names are too numerous
9  * to list here. Please refer to the COPYRIGHT file distributed with this
10  * source distribution.
11  *
12  * This library is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25  */
26 
27 #ifndef GNT_WIDGET_H
28 #define GNT_WIDGET_H
29 
30 #include <stdio.h>
31 #include <glib.h>
32 #include <ncurses.h>
33 
34 #include "gntbindable.h"
35 
36 #define GNT_TYPE_WIDGET (gnt_widget_get_gtype())
37 #define GNT_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_WIDGET, GntWidget))
38 #define GNT_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_WIDGET, GntWidgetClass))
39 #define GNT_IS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_WIDGET))
40 #define GNT_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_WIDGET))
41 #define GNT_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_WIDGET, GntWidgetClass))
42 
43 #define GNT_WIDGET_FLAGS(obj) (GNT_WIDGET(obj)->priv.flags)
44 #define GNT_WIDGET_SET_FLAGS(obj, flags) (GNT_WIDGET_FLAGS(obj) |= flags)
45 #define GNT_WIDGET_UNSET_FLAGS(obj, flags) (GNT_WIDGET_FLAGS(obj) &= ~(flags))
46 #define GNT_WIDGET_IS_FLAG_SET(obj, flags) (GNT_WIDGET_FLAGS(obj) & (flags))
47 
48 typedef struct _GntWidget GntWidget;
51 
52 typedef enum _GntWidgetFlags
53 {
57  /* XXX: Need to set the following two as properties, and setup a callback whenever these
58  * get chnaged. */
70 
71 /* XXX: This will probably move elsewhere */
72 typedef enum _GntMouseEvent
73 {
81 
82 /* XXX: I'll have to ask grim what he's using this for in guifications. */
83 typedef enum _GntParamFlags
84 {
85  GNT_PARAM_SERIALIZABLE = 1 << G_PARAM_USER_SHIFT
87 
89 {
90  int x, y;
91  int width, height;
93  char *name;
94 
95  int minw, minh; /* Minimum size for the widget */
96 };
97 
98 struct _GntWidget
99 {
101 
103 
105  WINDOW *window;
106 
107  void (*gnt_reserved1)(void);
108  void (*gnt_reserved2)(void);
109  void (*gnt_reserved3)(void);
110  void (*gnt_reserved4)(void);
111 };
112 
114 {
116 
117  void (*map)(GntWidget *obj);
118  void (*show)(GntWidget *obj); /* This will call draw() and take focus (if it can take focus) */
119  void (*destroy)(GntWidget *obj);
120  void (*draw)(GntWidget *obj); /* This will draw the widget */
121  void (*hide)(GntWidget *obj);
122  void (*expose)(GntWidget *widget, int x, int y, int width, int height);
125 
127  gboolean (*confirm_size)(GntWidget *widget, int x, int y);
128  void (*size_changed)(GntWidget *widget, int w, int h);
129  void (*set_position)(GntWidget *widget, int x, int y);
130  gboolean (*key_pressed)(GntWidget *widget, const char *key);
132  gboolean (*clicked)(GntWidget *widget, GntMouseEvent event, int x, int y);
133 
134  void (*gnt_reserved1)(void);
135  void (*gnt_reserved2)(void);
136  void (*gnt_reserved3)(void);
137  void (*gnt_reserved4)(void);
138 };
139 
140 G_BEGIN_DECLS
141 
145 GType gnt_widget_get_gtype(void);
146 
152 
160 
166 
171 void gnt_widget_expose(GntWidget *widget, int x, int y, int width, int height);
172 
178 
186 void gnt_widget_get_position(GntWidget *widget, int *x, int *y);
187 
194 void gnt_widget_set_position(GntWidget *widget, int x, int y);
195 
201 
208 void gnt_widget_get_size(GntWidget *widget, int *width, int *height);
209 
219 gboolean gnt_widget_set_size(GntWidget *widget, int width, int height);
220 
230 gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height);
231 
240 gboolean gnt_widget_key_pressed(GntWidget *widget, const char *keys);
241 
252 gboolean gnt_widget_clicked(GntWidget *widget, GntMouseEvent event, int x, int y);
253 
262 gboolean gnt_widget_set_focus(GntWidget *widget, gboolean set);
263 
269 
275 void gnt_widget_set_name(GntWidget *widget, const char *name);
276 
282 const char *gnt_widget_get_name(GntWidget *widget);
283 
289 
297 
304 void gnt_widget_set_visible(GntWidget *widget, gboolean set);
305 
315 
316 G_END_DECLS
317 
318 #endif /* GNT_WIDGET_H */
GNT_WIDGET_NO_BORDER
Definition: gntwidget.h:59
name
char * name
Definition: gntbindable.c:47
_GntWidgetPriv::width
int width
Definition: gntwidget.h:91
gnt_widget_destroy
void gnt_widget_destroy(GntWidget *widget)
Definition: gntwidget.c:312
_GntWidgetFlags
_GntWidgetFlags
Definition: gntwidget.h:52
gnt_widget_set_size
gboolean gnt_widget_set_size(GntWidget *widget, int width, int height)
Definition: gntwidget.c:515
GNT_WIDGET_GROW_X
Definition: gntwidget.h:64
GNT_RIGHT_MOUSE_DOWN
Definition: gntwidget.h:75
gnt_widget_get_gtype
G_BEGIN_DECLS GType gnt_widget_get_gtype(void)
Definition: gntwidget.c:270
GntMouseEvent
enum _GntMouseEvent GntMouseEvent
_GntWidget::inherit
GntBindable inherit
Definition: gntwidget.h:100
GNT_WIDGET_DISABLE_ACTIONS
Definition: gntwidget.h:68
gnt_widget_queue_update
void gnt_widget_queue_update(GntWidget *widget)
Definition: gntwidget.c:618
GntParamFlags
enum _GntParamFlags GntParamFlags
_GntWidgetPriv::x
int x
Definition: gntwidget.h:90
set
static void set(PurpleDesktopItem *item, const char *key, const char *value)
Definition: desktopitem.c:206
widget
GtkWidget * widget
Definition: pidgintooltip.c:38
_GntWidget
Definition: gntwidget.h:98
_GntWidgetClass::gnt_reserved3
void(* gnt_reserved3)(void)
Definition: gntwidget.h:136
GNT_LEFT_MOUSE_DOWN
Definition: gntwidget.h:74
GNT_WIDGET_MAPPED
Definition: gntwidget.h:56
_GntWidgetClass::key_pressed
gboolean(* key_pressed)(GntWidget *widget, const char *key)
Definition: gntwidget.h:130
_GntWidgetPriv::name
char * name
Definition: gntwidget.h:93
_GntWidgetClass::parent
GntBindableClass parent
Definition: gntwidget.h:115
gnt_widget_get_name
const char * gnt_widget_get_name(GntWidget *widget)
Definition: gntwidget.c:595
_GntWidgetPriv::minw
int minw
Definition: gntwidget.h:95
gnt_widget_get_position
void gnt_widget_get_position(GntWidget *widget, int *x, int *y)
Definition: gntwidget.c:449
GNT_WIDGET_INVISIBLE
Definition: gntwidget.h:66
_GntWidget::gnt_reserved4
void(* gnt_reserved4)(void)
Definition: gntwidget.h:110
keys
char * keys
Definition: gntbindable.c:45
_GntWidgetClass::clicked
gboolean(* clicked)(GntWidget *widget, GntMouseEvent event, int x, int y)
Definition: gntwidget.h:132
_GntWidget::gnt_reserved3
void(* gnt_reserved3)(void)
Definition: gntwidget.h:109
gnt_widget_draw
void gnt_widget_draw(GntWidget *widget)
Definition: gntwidget.c:335
GntWidgetFlags
enum _GntWidgetFlags GntWidgetFlags
_GntWidgetClass::lost_focus
void(* lost_focus)(GntWidget *widget)
Definition: gntwidget.h:124
GNT_WIDGET_DESTROYING
Definition: gntwidget.h:54
gnt_widget_size_request
void gnt_widget_size_request(GntWidget *widget)
Definition: gntwidget.c:458
GNT_WIDGET_HAS_FOCUS
Definition: gntwidget.h:61
_GntWidgetPriv
Definition: gntwidget.h:88
gnt_widget_set_name
void gnt_widget_set_name(GntWidget *widget, const char *name)
Definition: gntwidget.c:589
_GntWidget::gnt_reserved1
void(* gnt_reserved1)(void)
Definition: gntwidget.h:107
GNT_MOUSE_SCROLL_DOWN
Definition: gntwidget.h:79
GNT_WIDGET_TRANSIENT
Definition: gntwidget.h:67
GNT_PARAM_SERIALIZABLE
Definition: gntwidget.h:85
gnt_widget_set_take_focus
void gnt_widget_set_take_focus(GntWidget *widget, gboolean set)
Definition: gntwidget.c:296
gnt_widget_set_focus
gboolean gnt_widget_set_focus(GntWidget *widget, gboolean set)
Definition: gntwidget.c:568
_GntWidgetClass::expose
void(* expose)(GntWidget *widget, int x, int y, int width, int height)
Definition: gntwidget.h:122
_GntWidgetClass::map
void(* map)(GntWidget *obj)
Definition: gntwidget.h:117
_GntWidgetClass::activate
void(* activate)(GntWidget *widget)
Definition: gntwidget.h:131
gnt_widget_get_size
void gnt_widget_get_size(GntWidget *widget, int *width, int *height)
Definition: gntwidget.c:464
GNT_WIDGET_GROW_Y
Definition: gntwidget.h:65
_GntWidgetClass::set_position
void(* set_position)(GntWidget *widget, int x, int y)
Definition: gntwidget.h:129
_GntWidgetClass::size_request
void(* size_request)(GntWidget *widget)
Definition: gntwidget.h:126
gnt_widget_set_visible
void gnt_widget_set_visible(GntWidget *widget, gboolean set)
Definition: gntwidget.c:640
GNT_MIDDLE_MOUSE_DOWN
Definition: gntwidget.h:76
_GntWidgetClass
Definition: gntwidget.h:113
_GntWidgetClass::gnt_reserved1
void(* gnt_reserved1)(void)
Definition: gntwidget.h:134
_GntBindableClass
Definition: gntbindable.h:52
GNT_WIDGET_URGENT
Definition: gntwidget.h:63
GNT_MOUSE_SCROLL_UP
Definition: gntwidget.h:78
gnt_widget_expose
void gnt_widget_expose(GntWidget *widget, int x, int y, int width, int height)
Definition: gntwidget.c:419
gntbindable.h
GNT_WIDGET_CAN_TAKE_FOCUS
Definition: gntwidget.h:55
gnt_widget_activate
void gnt_widget_activate(GntWidget *widget)
Definition: gntwidget.c:600
_GntWidgetPriv::y
int y
Definition: gntwidget.h:90
_GntWidgetClass::hide
void(* hide)(GntWidget *obj)
Definition: gntwidget.h:121
gnt_widget_confirm_size
gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height)
Definition: gntwidget.c:633
_GntWidgetClass::gnt_reserved2
void(* gnt_reserved2)(void)
Definition: gntwidget.h:135
pietray.obj
obj
Definition: pietray.py:29
_GntWidgetClass::size_changed
void(* size_changed)(GntWidget *widget, int w, int h)
Definition: gntwidget.h:128
GNT_MOUSE_UP
Definition: gntwidget.h:77
_GntWidget::parent
GntWidget * parent
Definition: gntwidget.h:102
_GntMouseEvent
_GntMouseEvent
Definition: gntwidget.h:72
_GntWidgetPriv::flags
GntWidgetFlags flags
Definition: gntwidget.h:92
GNT_WIDGET_NO_SHADOW
Definition: gntwidget.h:60
gnt_widget_set_position
void gnt_widget_set_position(GntWidget *widget, int x, int y)
Definition: gntwidget.c:440
_GntWidget::window
WINDOW * window
Definition: gntwidget.h:105
gnt_widget_key_pressed
gboolean gnt_widget_key_pressed(GntWidget *widget, const char *keys)
Definition: gntwidget.c:393
_GntBindable
Definition: gntbindable.h:47
gnt_widget_has_shadow
gboolean gnt_widget_has_shadow(GntWidget *widget)
Definition: gntwidget.c:648
gnt_widget_show
void gnt_widget_show(GntWidget *widget)
Definition: gntwidget.c:326
gnt_widget_hide
void gnt_widget_hide(GntWidget *widget)
Definition: gntwidget.c:425
gnt_widget_clicked
gboolean gnt_widget_clicked(GntWidget *widget, GntMouseEvent event, int x, int y)
Definition: gntwidget.c:409
_GntWidget::gnt_reserved2
void(* gnt_reserved2)(void)
Definition: gntwidget.h:108
_GntWidgetClass::show
void(* show)(GntWidget *obj)
Definition: gntwidget.h:118
_GntWidgetClass::destroy
void(* destroy)(GntWidget *obj)
Definition: gntwidget.h:119
_GntWidgetClass::gnt_reserved4
void(* gnt_reserved4)(void)
Definition: gntwidget.h:137
_GntWidgetClass::draw
void(* draw)(GntWidget *obj)
Definition: gntwidget.h:120
_GntWidgetPriv::height
int height
Definition: gntwidget.h:91
_GntWidget::priv
GntWidgetPriv priv
Definition: gntwidget.h:104
GNT_WIDGET_DRAWING
Definition: gntwidget.h:62
_GntWidgetClass::confirm_size
gboolean(* confirm_size)(GntWidget *widget, int x, int y)
Definition: gntwidget.h:127
_GntWidgetPriv::minh
int minh
Definition: gntwidget.h:95
_GntWidgetClass::gained_focus
void(* gained_focus)(GntWidget *widget)
Definition: gntwidget.h:123
_GntParamFlags
_GntParamFlags
Definition: gntwidget.h:83