comparison audacious/widget.h @ 0:cb178e5ad177 trunk

[svn] Import audacious source.
author nenolod
date Mon, 24 Oct 2005 03:06:47 -0700
parents
children 02c17a5c99e3
comparison
equal deleted inserted replaced
-1:000000000000 0:cb178e5ad177
1 /* BMP - Cross-platform multimedia player
2 * Copyright (C) 2003-2004 BMP development team.
3 *
4 * Based on XMMS:
5 * Copyright (C) 1998-2003 XMMS development team.
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21 #ifndef WIDGET_H
22 #define WIDGET_H
23
24
25 #include <glib.h>
26 #include <gdk/gdk.h>
27 #include <gtk/gtk.h>
28
29
30 typedef struct _Widget Widget;
31
32
33 typedef void (*WidgetButtonPressFunc) (GtkWidget *, GdkEventButton *,
34 gpointer);
35 typedef void (*WidgetButtonReleaseFunc) (GtkWidget *, GdkEventButton *,
36 gpointer);
37 typedef void (*WidgetMotionFunc) (GtkWidget *, GdkEventMotion *, gpointer);
38 typedef void (*WidgetDrawFunc) (Widget *);
39 typedef void (*WidgetScrollFunc) (GtkWidget *, GdkEventScroll *, gpointer);
40
41
42 #define WIDGET(x) ((Widget *)(x))
43 struct _Widget {
44 GdkPixmap *parent;
45 GdkGC *gc;
46
47 gint x, y;
48 gint width, height;
49
50 gint visible;
51 gboolean redraw;
52
53 GMutex *mutex;
54
55 WidgetButtonPressFunc button_press_cb;
56 WidgetButtonReleaseFunc button_release_cb;
57 WidgetMotionFunc motion_cb;
58 WidgetDrawFunc draw;
59 WidgetScrollFunc mouse_scroll_cb;
60 };
61
62
63 void widget_init(Widget * widget, GdkPixmap * parent, GdkGC * gc,
64 gint x, gint y, gint width, gint height, gint visible);
65
66 void widget_set_position(Widget * widget, gint x, gint y);
67 void widget_set_size(Widget * widget, gint width, gint height);
68 void widget_queue_redraw(Widget * widget);
69
70 void widget_lock(Widget * widget);
71 void widget_unlock(Widget * widget);
72
73 gboolean widget_contains(Widget * widget, gint x, gint y);
74
75 void widget_show(Widget * widget);
76 void widget_hide(Widget * widget);
77 gboolean widget_is_visible(Widget * widget);
78
79 void widget_resize(Widget * widget, gint width, gint height);
80 void widget_move(Widget * widget, gint x, gint y);
81 void widget_draw(Widget * widget);
82
83 void handle_press_cb(GList * wlist, GtkWidget * widget,
84 GdkEventButton * event);
85 void handle_release_cb(GList * wlist, GtkWidget * widget,
86 GdkEventButton * event);
87 void handle_motion_cb(GList * wlist, GtkWidget * widget,
88 GdkEventMotion * event);
89 void handle_scroll_cb(GList * wlist, GtkWidget * widget,
90 GdkEventScroll * event);
91
92 void widget_list_add(GList ** list, Widget * widget);
93 void widget_list_draw(GList * list, gboolean * redraw, gboolean force);
94 void widget_list_change_pixmap(GList * list, GdkPixmap * pixmap);
95 void widget_list_clear_redraw(GList * list);
96 void widget_list_lock(GList * list);
97 void widget_list_unlock(GList * list);
98
99
100
101 #endif