annotate src/skins/ui_skinned_window.c @ 2572:d0daee216c8d

stub (really incomplete) for skin engine plugin
author Tomasz Mon <desowin@gmail.com>
date Sun, 18 May 2008 14:20:51 +0200
parents
children 8da9705862e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2572
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious: A cross-platform multimedia player
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation; under version 3 of the License.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * GNU General Public License for more details.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses>.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * The Audacious team does not consider modular code linking to
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * Audacious or using our public API to be a derived work.
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 #include "platform/smartinclude.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 #include "ui_skin.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 #include <gtk/gtkmain.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 #include <glib-object.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26 #include <glib/gmacros.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include <gtk/gtkmarshal.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include <gtk/gtkwindow.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include <string.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #include <audacious/plugin.h>
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 #include "ui_dock.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 #include "ui_skinned_window.h"
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 static void ui_skinned_window_class_init(SkinnedWindowClass *klass);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 static void ui_skinned_window_init(GtkWidget *widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 static GtkWindowClass *parent = NULL;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 GType
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 ui_skinned_window_get_type(void)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 static GType window_type = 0;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 if (!window_type)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 static const GTypeInfo window_info =
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 sizeof (SkinnedWindowClass),
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 NULL, /* base_init */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 NULL, /* base_finalize */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 (GClassInitFunc) ui_skinned_window_class_init,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 NULL, /* class_finalize */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 NULL, /* class_data */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 sizeof (SkinnedWindow),
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 0, /* n_preallocs */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 (GInstanceInitFunc) ui_skinned_window_init
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 };
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 window_type =
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 g_type_register_static (GTK_TYPE_WINDOW, "SkinnedWindow2",
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 &window_info, 0);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 return window_type;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 ui_skinned_window_map(GtkWidget *widget)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 (* GTK_WIDGET_CLASS (parent)->map) (widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 SkinnedWindow *window = SKINNED_WINDOW(widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 if (window->type == WINDOW_MAIN)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 gtk_widget_shape_combine_mask(widget, skin_get_mask(aud_active_skin, SKIN_MASK_MAIN + aud_cfg->player_shaded), 0, 0);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 else if (window->type == WINDOW_EQ)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 gtk_widget_shape_combine_mask(widget, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + aud_cfg->equalizer_shaded), 0, 0);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 gtk_window_set_keep_above(GTK_WINDOW(widget), aud_cfg->always_on_top);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 static gboolean
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 ui_skinned_window_motion_notify_event(GtkWidget *widget,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 GdkEventMotion *event)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 if (dock_is_moving(GTK_WINDOW(widget)))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 dock_move_motion(GTK_WINDOW(widget), event);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 return FALSE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 static gboolean ui_skinned_window_focus_in(GtkWidget *widget, GdkEventFocus *focus) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 gboolean val = GTK_WIDGET_CLASS (parent)->focus_in_event (widget, focus);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 gtk_widget_queue_draw(widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 return val;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97 static gboolean ui_skinned_window_focus_out(GtkWidget *widget, GdkEventFocus *focus) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 gboolean val = GTK_WIDGET_CLASS (parent)->focus_out_event (widget, focus);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99 gtk_widget_queue_draw(widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 return val;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 static gboolean ui_skinned_window_expose(GtkWidget *widget, GdkEventExpose *event) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 SkinnedWindow *window = SKINNED_WINDOW(widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 GdkPixbuf *obj = NULL;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 gint width = 0, height = 0;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109 switch (window->type) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 case WINDOW_MAIN:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 width = aud_active_skin->properties.mainwin_width;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 height = aud_active_skin->properties.mainwin_height;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 case WINDOW_EQ:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 width = 275 * (aud_cfg->scaled ? aud_cfg->scale_factor : 1);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 height = 116 * (aud_cfg->scaled ? aud_cfg->scale_factor : 1) ;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 case WINDOW_PLAYLIST:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 #if 0
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 width = playlistwin_get_width();
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 height = aud_cfg->playlist_height;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 #endif
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 default:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 return FALSE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 gboolean focus = gtk_window_has_toplevel_focus(GTK_WINDOW(widget));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 switch (window->type) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 case WINDOW_MAIN:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 skin_draw_pixbuf(widget, aud_active_skin, obj,SKIN_MAIN, 0, 0, 0, 0, width, height);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 skin_draw_mainwin_titlebar(aud_active_skin, obj, aud_cfg->player_shaded, focus || !aud_cfg->dim_titlebar);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 case WINDOW_EQ:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQMAIN, 0, 0, 0, 0, width, height);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 if (focus || !aud_cfg->dim_titlebar) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 if (!aud_cfg->equalizer_shaded)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQMAIN, 0, 134, 0, 0, width, 14);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 else
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQ_EX, 0, 0, 0, 0, width, 14);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143 } else {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 if (!aud_cfg->equalizer_shaded)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQMAIN, 0, 149, 0, 0, width, 14);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 else
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 skin_draw_pixbuf(widget, aud_active_skin, obj, SKIN_EQ_EX, 0, 15, 0, 0, width, 14);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 case WINDOW_PLAYLIST:
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 focus |= !aud_cfg->dim_titlebar;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 if (aud_cfg->playlist_shaded) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 skin_draw_playlistwin_shaded(aud_active_skin, obj, width, focus);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 } else {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 skin_draw_playlistwin_frame(aud_active_skin, obj, width, aud_cfg->playlist_height, focus);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 break;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 ui_skinned_widget_draw(GTK_WIDGET(window), obj, width, height,
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 window->type != WINDOW_PLAYLIST && aud_cfg->scaled);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 g_object_unref(obj);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 return FALSE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 ui_skinned_window_class_init(SkinnedWindowClass *klass)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 GtkWidgetClass *widget_class;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 widget_class = (GtkWidgetClass*) klass;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 parent = gtk_type_class(gtk_window_get_type());
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 widget_class->motion_notify_event = ui_skinned_window_motion_notify_event;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 widget_class->expose_event = ui_skinned_window_expose;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 widget_class->focus_in_event = ui_skinned_window_focus_in;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180 widget_class->focus_out_event = ui_skinned_window_focus_out;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 widget_class->map = ui_skinned_window_map;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184 void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 ui_skinned_window_hide(SkinnedWindow *window)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187 g_return_if_fail(SKINNED_CHECK_WINDOW(window));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 gtk_window_get_position(GTK_WINDOW(window), &window->x, &window->y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 gtk_widget_hide(GTK_WIDGET(window));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 ui_skinned_window_show(SkinnedWindow *window)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196 g_return_if_fail(SKINNED_CHECK_WINDOW(window));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 gtk_window_move(GTK_WINDOW(window), window->x, window->y);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 gtk_widget_show_all(GTK_WIDGET(window));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 static void
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 ui_skinned_window_init(GtkWidget *widget)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 SkinnedWindow *window;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 window = SKINNED_WINDOW(widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 window->x = -1;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 window->y = -1;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 GtkWidget *
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212 ui_skinned_window_new(const gchar *wmclass_name)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 GtkWidget *widget = g_object_new(ui_skinned_window_get_type(), NULL);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 GtkWindow *window = GTK_WINDOW(widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 window->type = SKINNED_WINDOW_TYPE;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 if (wmclass_name)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 gtk_window_set_wmclass(GTK_WINDOW(widget), wmclass_name, "Audacious");
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 gtk_widget_add_events(GTK_WIDGET(widget),
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK |
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 GDK_SCROLL_MASK | GDK_KEY_PRESS_MASK |
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227 gtk_widget_realize(GTK_WIDGET(widget));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 set_dock_window_list(dock_window_set_decorated(get_dock_window_list(),
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 GTK_WINDOW(widget),
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 aud_cfg->show_wm_decorations));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 gtk_widget_set_app_paintable(GTK_WIDGET(widget), TRUE);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 gdk_window_set_back_pixmap(widget->window, NULL, FALSE);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 gtk_widget_shape_combine_mask(widget, NULL, 0, 0);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 if (!strcmp(wmclass_name, "player"))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 SKINNED_WINDOW(widget)->type = WINDOW_MAIN;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 if (!strcmp(wmclass_name, "equalizer"))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 SKINNED_WINDOW(widget)->type = WINDOW_EQ;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 if (!strcmp(wmclass_name, "playlist"))
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 SKINNED_WINDOW(widget)->type = WINDOW_PLAYLIST;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 /* GtkFixed hasn't got its GdkWindow, this means that it can be used to
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 display widgets while the logo below will be displayed anyway;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 however fixed positions are not that great, cause the button sizes may (will)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 vary depending on the gtk style used, so it's not possible to center
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 them unless a fixed width and heigth is forced (and this may bring to cutted
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 text if someone, i.e., uses a big font for gtk widgets);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 other types of container most likely have their GdkWindow, this simply
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 means that the logo must be drawn on the container widget, instead of the
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 window; otherwise, it won't be displayed correctly */
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 SKINNED_WINDOW(widget)->fixed = gtk_fixed_new();
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 gtk_container_add(GTK_CONTAINER(widget), GTK_WIDGET(SKINNED_WINDOW(widget)->fixed));
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 return widget;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 void ui_skinned_window_draw_all(GtkWidget *widget) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 #if 0
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 if (SKINNED_WINDOW(widget)->type == WINDOW_MAIN)
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 mainwin_refresh_hints();
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 #endif
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262 gtk_widget_queue_draw(widget);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 GList *iter;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 for (iter = GTK_FIXED (SKINNED_WINDOW(widget)->fixed)->children; iter; iter = g_list_next (iter)) {
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 GtkFixedChild *child_data = (GtkFixedChild *) iter->data;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 GtkWidget *child = child_data->widget;
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 gtk_widget_queue_draw(child);
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268 }
d0daee216c8d stub (really incomplete) for skin engine plugin
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 }