Mercurial > audlegacy-plugins
annotate src/skins/ui_skinned_playstatus.c @ 3047:4434b4c4a715
ported EsounD plugin
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Fri, 17 Apr 2009 16:17:10 +0300 |
parents | 6baa6eaf8290 |
children |
rev | line source |
---|---|
2587
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
1 /* |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
2 * Audacious - a cross-platform multimedia player |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
3 * Copyright (c) 2007 Tomasz Moń |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
4 * |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
5 * Based on: |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
6 * BMP - Cross-platform multimedia player |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
7 * Copyright (C) 2003-2004 BMP development team. |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
8 * XMMS: |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
9 * Copyright (C) 1998-2003 XMMS development team. |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
10 * |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
13 * the Free Software Foundation; under version 3 of the License. |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
14 * |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
19 * |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
21 * along with this program. If not, see <http://www.gnu.org/licenses>. |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
22 * |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
23 * The Audacious team does not consider modular code linking to |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
24 * Audacious or using our public API to be a derived work. |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
25 */ |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
26 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
27 #include "ui_skin.h" |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
28 #include "ui_skinned_playstatus.h" |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
29 #include "skins_cfg.h" |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
30 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
31 #define UI_TYPE_SKINNED_PLAYSTATUS (ui_skinned_playstatus_get_type()) |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
32 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
33 enum { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
34 DOUBLED, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
35 LAST_SIGNAL |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
36 }; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
37 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
38 static void ui_skinned_playstatus_class_init (UiSkinnedPlaystatusClass *klass); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
39 static void ui_skinned_playstatus_init (UiSkinnedPlaystatus *playstatus); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
40 static void ui_skinned_playstatus_destroy (GtkObject *object); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
41 static void ui_skinned_playstatus_realize (GtkWidget *widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
42 static void ui_skinned_playstatus_size_request (GtkWidget *widget, GtkRequisition *requisition); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
43 static void ui_skinned_playstatus_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
44 static gboolean ui_skinned_playstatus_expose (GtkWidget *widget, GdkEventExpose *event); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
45 static void ui_skinned_playstatus_toggle_scaled (UiSkinnedPlaystatus *playstatus); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
46 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
47 static GtkWidgetClass *parent_class = NULL; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
48 static guint playstatus_signals[LAST_SIGNAL] = { 0 }; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
49 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
50 GType ui_skinned_playstatus_get_type() { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
51 static GType playstatus_type = 0; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
52 if (!playstatus_type) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
53 static const GTypeInfo playstatus_info = { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
54 sizeof (UiSkinnedPlaystatusClass), |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
55 NULL, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
56 NULL, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
57 (GClassInitFunc) ui_skinned_playstatus_class_init, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
58 NULL, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
59 NULL, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
60 sizeof (UiSkinnedPlaystatus), |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
61 0, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
62 (GInstanceInitFunc) ui_skinned_playstatus_init, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
63 }; |
2590 | 64 playstatus_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedPlaystatus", &playstatus_info, 0); |
2587
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
65 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
66 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
67 return playstatus_type; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
68 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
69 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
70 static void ui_skinned_playstatus_class_init(UiSkinnedPlaystatusClass *klass) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
71 GObjectClass *gobject_class; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
72 GtkObjectClass *object_class; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
73 GtkWidgetClass *widget_class; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
74 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
75 gobject_class = G_OBJECT_CLASS(klass); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
76 object_class = (GtkObjectClass*) klass; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
77 widget_class = (GtkWidgetClass*) klass; |
3032
6baa6eaf8290
Don't use deprecated gtk_type_class()
Tomasz Mon <desowin@gmail.com>
parents:
3017
diff
changeset
|
78 parent_class = g_type_class_peek_parent(klass); |
2587
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
79 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
80 object_class->destroy = ui_skinned_playstatus_destroy; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
81 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
82 widget_class->realize = ui_skinned_playstatus_realize; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
83 widget_class->expose_event = ui_skinned_playstatus_expose; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
84 widget_class->size_request = ui_skinned_playstatus_size_request; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
85 widget_class->size_allocate = ui_skinned_playstatus_size_allocate; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
86 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
87 klass->scaled = ui_skinned_playstatus_toggle_scaled; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
88 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
89 playstatus_signals[DOUBLED] = |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
90 g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
91 G_STRUCT_OFFSET (UiSkinnedPlaystatusClass, scaled), NULL, NULL, |
3017
963796db51ea
Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents:
2888
diff
changeset
|
92 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); |
2587
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
93 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
94 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
95 static void ui_skinned_playstatus_init(UiSkinnedPlaystatus *playstatus) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
96 playstatus->width = 11; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
97 playstatus->height = 9; |
2888
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
98 |
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
99 GTK_WIDGET_SET_FLAGS(playstatus, GTK_NO_WINDOW); |
2587
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
100 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
101 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
102 GtkWidget* ui_skinned_playstatus_new(GtkWidget *fixed, gint x, gint y) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
103 UiSkinnedPlaystatus *playstatus = g_object_new (ui_skinned_playstatus_get_type (), NULL); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
104 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
105 playstatus->x = x; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
106 playstatus->y = y; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
107 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
108 playstatus->scaled = FALSE; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
109 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
110 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(playstatus), playstatus->x, playstatus->y); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
111 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
112 return GTK_WIDGET(playstatus); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
113 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
114 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
115 static void ui_skinned_playstatus_destroy(GtkObject *object) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
116 UiSkinnedPlaystatus *playstatus; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
117 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
118 g_return_if_fail (object != NULL); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
119 g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS (object)); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
120 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
121 playstatus = UI_SKINNED_PLAYSTATUS (object); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
122 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
123 if (GTK_OBJECT_CLASS (parent_class)->destroy) |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
124 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
125 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
126 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
127 static void ui_skinned_playstatus_realize(GtkWidget *widget) { |
2888
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
128 if (GTK_WIDGET_CLASS (parent_class)->realize) |
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
129 (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); |
2587
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
130 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
131 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
132 static void ui_skinned_playstatus_size_request(GtkWidget *widget, GtkRequisition *requisition) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
133 UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS(widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
134 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
135 requisition->width = playstatus->width*(playstatus->scaled ? config.scale_factor : 1); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
136 requisition->height = playstatus->height*(playstatus->scaled ? config.scale_factor : 1); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
137 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
138 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
139 static void ui_skinned_playstatus_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
140 UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
141 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
142 widget->allocation = *allocation; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
143 widget->allocation.x *= (playstatus->scaled ? config.scale_factor : 1); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
144 widget->allocation.y *= (playstatus->scaled ? config.scale_factor : 1); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
145 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
146 playstatus->x = widget->allocation.x/(playstatus->scaled ? config.scale_factor : 1); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
147 playstatus->y = widget->allocation.y/(playstatus->scaled ? config.scale_factor : 1); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
148 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
149 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
150 static gboolean ui_skinned_playstatus_expose(GtkWidget *widget, GdkEventExpose *event) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
151 g_return_val_if_fail (widget != NULL, FALSE); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
152 g_return_val_if_fail (UI_SKINNED_IS_PLAYSTATUS (widget), FALSE); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
153 g_return_val_if_fail (event != NULL, FALSE); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
154 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
155 UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
156 g_return_val_if_fail (playstatus->width > 0 && playstatus->height > 0, FALSE); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
157 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
158 GdkPixbuf *obj = NULL; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
159 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, playstatus->width, playstatus->height); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
160 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
161 if (playstatus->status == STATUS_STOP && playstatus->buffering == TRUE) |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
162 playstatus->buffering = FALSE; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
163 if (playstatus->status == STATUS_PLAY && playstatus->buffering == TRUE) |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
164 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_PLAYPAUSE, 39, 0, 0, 0, 3, playstatus->height); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
165 else if (playstatus->status == STATUS_PLAY) |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
166 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_PLAYPAUSE, 36, 0, 0, 0, 3, playstatus->height); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
167 else |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
168 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_PLAYPAUSE, 27, 0, 0, 0, 2, playstatus->height); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
169 switch (playstatus->status) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
170 case STATUS_STOP: |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
171 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_PLAYPAUSE, 18, 0, 2, 0, 9, playstatus->height); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
172 break; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
173 case STATUS_PAUSE: |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
174 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_PLAYPAUSE, 9, 0, 2, 0, 9, playstatus->height); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
175 break; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
176 case STATUS_PLAY: |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
177 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_PLAYPAUSE, 1, 0, 3, 0, 8, playstatus->height); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
178 break; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
179 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
180 |
2888
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
181 ui_skinned_widget_draw_with_coordinates(widget, obj, playstatus->width, playstatus->height, |
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
182 widget->allocation.x, |
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
183 widget->allocation.y, |
7c7471554d88
convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents:
2590
diff
changeset
|
184 playstatus->scaled); |
2587
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
185 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
186 g_object_unref(obj); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
187 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
188 return FALSE; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
189 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
190 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
191 static void ui_skinned_playstatus_toggle_scaled(UiSkinnedPlaystatus *playstatus) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
192 GtkWidget *widget = GTK_WIDGET (playstatus); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
193 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
194 playstatus->scaled = !playstatus->scaled; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
195 gtk_widget_set_size_request(widget, playstatus->width*(playstatus->scaled ? config.scale_factor : 1), playstatus->height*(playstatus->scaled ? config.scale_factor : 1)); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
196 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
197 gtk_widget_queue_draw(GTK_WIDGET(playstatus)); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
198 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
199 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
200 void ui_skinned_playstatus_set_status(GtkWidget *widget, PStatus status) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
201 g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS (widget)); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
202 UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
203 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
204 playstatus->status = status; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
205 gtk_widget_queue_draw(widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
206 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
207 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
208 void ui_skinned_playstatus_set_buffering(GtkWidget *widget, gboolean status) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
209 g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS (widget)); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
210 UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
211 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
212 playstatus->buffering = status; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
213 gtk_widget_queue_draw(widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
214 } |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
215 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
216 void ui_skinned_playstatus_set_size(GtkWidget *widget, gint width, gint height) { |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
217 g_return_if_fail (UI_SKINNED_IS_PLAYSTATUS (widget)); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
218 UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
219 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
220 playstatus->width = width; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
221 playstatus->height = height; |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
222 |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
223 gtk_widget_set_size_request(widget, width*(playstatus->scaled ? config.scale_factor : 1), height*(playstatus->scaled ? config.scale_factor : 1)); |
792db8ee6d0a
add ui_skinned_monostereo and ui_skinned_playstatus
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
224 } |