2313
|
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
20 */
|
|
21
|
|
22 #ifndef _WIDGETCORE_H_
|
|
23 #error Please do not include me directly! Use widgetcore.h instead!
|
|
24 #endif
|
|
25
|
|
26 #ifndef WIDGET_H
|
|
27 #define WIDGET_H
|
|
28
|
|
29
|
|
30 #include <glib.h>
|
|
31 #include <gdk/gdk.h>
|
|
32 #include <gtk/gtk.h>
|
|
33
|
|
34
|
|
35 typedef struct _Widget Widget;
|
|
36
|
|
37
|
|
38 typedef void (*WidgetButtonPressFunc) (GtkWidget *, GdkEventButton *,
|
|
39 gpointer);
|
|
40 typedef void (*WidgetButtonReleaseFunc) (GtkWidget *, GdkEventButton *,
|
|
41 gpointer);
|
|
42 typedef void (*WidgetMotionFunc) (GtkWidget *, GdkEventMotion *, gpointer);
|
|
43 typedef void (*WidgetDrawFunc) (Widget *);
|
|
44 typedef void (*WidgetScrollFunc) (GtkWidget *, GdkEventScroll *, gpointer);
|
|
45
|
|
46
|
|
47 #define WIDGET(x) ((Widget *)(x))
|
|
48 struct _Widget {
|
|
49 GdkPixmap *parent;
|
|
50 GdkGC *gc;
|
|
51
|
|
52 gint x, y;
|
|
53 gint width, height;
|
|
54
|
|
55 gint visible;
|
|
56 gboolean redraw;
|
|
57
|
|
58 GMutex *mutex;
|
|
59
|
|
60 WidgetButtonPressFunc button_press_cb;
|
|
61 WidgetButtonReleaseFunc button_release_cb;
|
|
62 WidgetMotionFunc motion_cb;
|
|
63 WidgetDrawFunc draw;
|
|
64 WidgetScrollFunc mouse_scroll_cb;
|
|
65 };
|
|
66
|
|
67
|
|
68 void widget_init(Widget * widget, GdkPixmap * parent, GdkGC * gc,
|
|
69 gint x, gint y, gint width, gint height, gint visible);
|
|
70
|
|
71 void widget_set_position(Widget * widget, gint x, gint y);
|
|
72 void widget_set_size(Widget * widget, gint width, gint height);
|
|
73 void widget_queue_redraw(Widget * widget);
|
|
74
|
|
75 void widget_lock(Widget * widget);
|
|
76 void widget_unlock(Widget * widget);
|
|
77
|
|
78 gboolean widget_contains(Widget * widget, gint x, gint y);
|
|
79
|
|
80 void widget_show(Widget * widget);
|
|
81 void widget_hide(Widget * widget);
|
|
82 gboolean widget_is_visible(Widget * widget);
|
|
83
|
|
84 void widget_resize(Widget * widget, gint width, gint height);
|
|
85 void widget_move(Widget * widget, gint x, gint y);
|
|
86 void widget_draw(Widget * widget);
|
|
87 void widget_draw_quick(Widget * widget);
|
|
88
|
|
89 void handle_press_cb(GList * wlist, GtkWidget * widget,
|
|
90 GdkEventButton * event);
|
|
91 void handle_release_cb(GList * wlist, GtkWidget * widget,
|
|
92 GdkEventButton * event);
|
|
93 void handle_motion_cb(GList * wlist, GtkWidget * widget,
|
|
94 GdkEventMotion * event);
|
|
95 void handle_scroll_cb(GList * wlist, GtkWidget * widget,
|
|
96 GdkEventScroll * event);
|
|
97
|
|
98 void widget_list_add(GList ** list, Widget * widget);
|
|
99 void widget_list_draw(GList * list, gboolean * redraw, gboolean force);
|
|
100 void widget_list_change_pixmap(GList * list, GdkPixmap * pixmap);
|
|
101 void widget_list_clear_redraw(GList * list);
|
|
102 void widget_list_lock(GList * list);
|
|
103 void widget_list_unlock(GList * list);
|
|
104
|
|
105
|
|
106
|
|
107 #endif
|