annotate src/skins/ui_skinned_playlist_slider.c @ 2793:14a58e80ecfe

merge
author mf0102 <0102@gmx.at>
date Wed, 09 Jul 2008 22:25:31 +0200
parents 32e99af83a3e
children 6baa6eaf8290
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 Tomasz Moń
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 * along with this program. If not, see <http://www.gnu.org/licenses>.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 *
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * The Audacious team does not consider modular code linking to
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 * Audacious or using our public API to be a derived work.
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include "ui_skin.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include "ui_skinned_playlist_slider.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include "ui_playlist.h"
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #define UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_playlist_slider_get_type(), UiSkinnedPlaylistSliderPrivate))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 typedef struct _UiSkinnedPlaylistSliderPrivate UiSkinnedPlaylistSliderPrivate;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 struct _UiSkinnedPlaylistSliderPrivate {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 SkinPixmapId skin_index;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 gint width, height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 gint resize_height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 gint move_x;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 gint prev_y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 gint drag_y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 };
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 static void ui_skinned_playlist_slider_class_init (UiSkinnedPlaylistSliderClass *klass);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 static void ui_skinned_playlist_slider_init (UiSkinnedPlaylistSlider *playlist_slider);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 static void ui_skinned_playlist_slider_destroy (GtkObject *object);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 static void ui_skinned_playlist_slider_realize (GtkWidget *widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 static void ui_skinned_playlist_slider_size_request (GtkWidget *widget, GtkRequisition *requisition);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 static void ui_skinned_playlist_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 static gboolean ui_skinned_playlist_slider_expose (GtkWidget *widget, GdkEventExpose *event);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 static void ui_skinned_playlist_slider_set_position (GtkWidget *widget, gint y);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static gboolean ui_skinned_playlist_slider_button_press (GtkWidget *widget, GdkEventButton *event);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static gboolean ui_skinned_playlist_slider_button_release (GtkWidget *widget, GdkEventButton *event);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 static gboolean ui_skinned_playlist_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 static GtkWidgetClass *parent_class = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 GType ui_skinned_playlist_slider_get_type() {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static GType playlist_slider_type = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 if (!playlist_slider_type) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 static const GTypeInfo playlist_slider_info = {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 sizeof (UiSkinnedPlaylistSliderClass),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 NULL,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 NULL,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 (GClassInitFunc) ui_skinned_playlist_slider_class_init,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 NULL,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 NULL,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 sizeof (UiSkinnedPlaylistSlider),
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 0,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 (GInstanceInitFunc) ui_skinned_playlist_slider_init,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 };
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 playlist_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedPlaylistSlider", &playlist_slider_info, 0);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 return playlist_slider_type;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 static void ui_skinned_playlist_slider_class_init(UiSkinnedPlaylistSliderClass *klass) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 GObjectClass *gobject_class;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 GtkObjectClass *object_class;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 GtkWidgetClass *widget_class;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 gobject_class = G_OBJECT_CLASS(klass);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 object_class = (GtkObjectClass*) klass;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 widget_class = (GtkWidgetClass*) klass;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 parent_class = gtk_type_class (gtk_widget_get_type ());
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 object_class->destroy = ui_skinned_playlist_slider_destroy;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 widget_class->realize = ui_skinned_playlist_slider_realize;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 widget_class->expose_event = ui_skinned_playlist_slider_expose;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 widget_class->size_request = ui_skinned_playlist_slider_size_request;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 widget_class->size_allocate = ui_skinned_playlist_slider_size_allocate;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 widget_class->button_press_event = ui_skinned_playlist_slider_button_press;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 widget_class->button_release_event = ui_skinned_playlist_slider_button_release;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 widget_class->motion_notify_event = ui_skinned_playlist_slider_motion_notify;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 g_type_class_add_private (gobject_class, sizeof (UiSkinnedPlaylistSliderPrivate));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 static void ui_skinned_playlist_slider_init(UiSkinnedPlaylistSlider *playlist_slider) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 playlist_slider->pressed = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 priv->resize_height = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 priv->move_x = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 priv->drag_y = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107 priv->prev_y = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 GtkWidget* ui_skinned_playlist_slider_new(GtkWidget *fixed, gint x, gint y, gint h) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 UiSkinnedPlaylistSlider *hs = g_object_new (ui_skinned_playlist_slider_get_type (), NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(hs);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 hs->x = x;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 hs->y = y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 priv->width = 8;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 priv->height = h;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 priv->skin_index = SKIN_PLEDIT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(hs), hs->x, hs->y);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 return GTK_WIDGET(hs);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 static void ui_skinned_playlist_slider_destroy(GtkObject *object) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 UiSkinnedPlaylistSlider *playlist_slider;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 g_return_if_fail (object != NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 g_return_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER (object));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (object);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 if (GTK_OBJECT_CLASS (parent_class)->destroy)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 static void ui_skinned_playlist_slider_realize(GtkWidget *widget) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 UiSkinnedPlaylistSlider *playlist_slider;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 GdkWindowAttr attributes;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 gint attributes_mask;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143 g_return_if_fail (widget != NULL);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 g_return_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER(widget));
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 attributes.x = widget->allocation.x;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 attributes.y = widget->allocation.y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 attributes.width = widget->allocation.width;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 attributes.height = widget->allocation.height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 attributes.wclass = GDK_INPUT_OUTPUT;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 attributes.window_type = GDK_WINDOW_CHILD;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 attributes.event_mask = gtk_widget_get_events(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 attributes.visual = gtk_widget_get_visual(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 attributes.colormap = gtk_widget_get_colormap(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 widget->style = gtk_style_attach(widget->style, widget->window);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 gdk_window_set_user_data(widget->window, widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 static void ui_skinned_playlist_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 requisition->width = priv->width;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 requisition->height = priv->height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 static void ui_skinned_playlist_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 UiSkinnedPlaylistSlider *playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 widget->allocation = *allocation;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180 if (GTK_WIDGET_REALIZED (widget))
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 if (playlist_slider->x + priv->move_x == widget->allocation.x)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184 priv->move_x = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 playlist_slider->x = widget->allocation.x;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 playlist_slider->y = widget->allocation.y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 if (priv->height != widget->allocation.height) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 priv->height = priv->height + priv->resize_height;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 priv->resize_height = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 gtk_widget_queue_draw(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 static gboolean ui_skinned_playlist_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196 g_return_val_if_fail (widget != NULL, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197 g_return_val_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER (widget), FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 g_return_val_if_fail (event != NULL, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(ps);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 GdkPixbuf *obj = NULL;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 gint num_visible;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 num_visible = playlistwin_list_get_visible_count();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 gint y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 if (aud_playlist_get_length(playlist) > num_visible)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 y = (playlistwin_list_get_first() * (priv->height - 19)) /
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 (aud_playlist_get_length(playlist) - num_visible);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 else
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218 y = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 if (y < 0) y=0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221 if (y > priv->height - 19) y = priv->height - 19;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 priv->prev_y = y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 /* FIXME: uses aud_active_skin->pixmaps directly and may need calibration */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 /* drawing background */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227 gint c;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 for (c = 0; c < priv->height / 29; c++) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 gdk_pixbuf_copy_area(aud_active_skin->pixmaps[SKIN_PLEDIT].pixbuf,
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 36, 42, priv->width, 29, obj, 0, c*29);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 /* drawing knob */
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 skin_draw_pixbuf(widget, aud_active_skin, obj, priv->skin_index, ps->pressed ? 61 : 52, 53, 0, y, priv->width, 18);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 ui_skinned_widget_draw(widget, obj, priv->width, priv->height, FALSE);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 g_object_unref(obj);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 return FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 static void ui_skinned_playlist_slider_set_position(GtkWidget *widget, gint y) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 gint pos;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 Playlist *playlist = aud_playlist_get_active();
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 y = CLAMP(y, 0, priv->height - 19);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 pos = (y * (aud_playlist_get_length(playlist) - playlistwin_list_get_visible_count())) / (priv->height - 19);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 playlistwin_set_toprow(pos);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 gtk_widget_queue_draw(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 static gboolean ui_skinned_playlist_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 if (event->button != 1 && event->button != 2)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 gint y = event->y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 if (event->type == GDK_BUTTON_PRESS) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 ps->pressed = TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 if ((y >= priv->prev_y && y < priv->prev_y + 18)) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 priv->drag_y = y - priv->prev_y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268 } else if (event->button == 2) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 ui_skinned_playlist_slider_set_position(widget, y);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270 priv->drag_y = 0;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271 } else {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 gint n = playlistwin_list_get_visible_count() / 2;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273 if (y < priv->prev_y)
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274 n *= -1;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 playlistwin_scroll(n);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 gtk_widget_queue_draw(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282 static gboolean ui_skinned_playlist_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285 if (event->button == 1 || event->button == 2) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286 ps->pressed = FALSE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 gtk_widget_queue_draw(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292 static gboolean ui_skinned_playlist_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 if (ps->pressed) {
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 gint y = event->y - priv->drag_y;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 ui_skinned_playlist_slider_set_position(widget, y);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 return TRUE;
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 void ui_skinned_playlist_slider_move_relative(GtkWidget *widget, gint x) {
2698
32e99af83a3e I don't think redraw signal is needed anymore
Tomasz Mon <desowin@gmail.com>
parents: 2620
diff changeset
304 UiSkinnedPlaylistSlider *playlist_slider = UI_SKINNED_PLAYLIST_SLIDER(widget);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 priv->move_x += x;
2698
32e99af83a3e I don't think redraw signal is needed anymore
Tomasz Mon <desowin@gmail.com>
parents: 2620
diff changeset
307 gtk_fixed_move(GTK_FIXED(gtk_widget_get_parent(widget)), widget,
32e99af83a3e I don't think redraw signal is needed anymore
Tomasz Mon <desowin@gmail.com>
parents: 2620
diff changeset
308 playlist_slider->x+priv->move_x, playlist_slider->y);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 }
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 void ui_skinned_playlist_slider_resize_relative(GtkWidget *widget, gint h) {
2698
32e99af83a3e I don't think redraw signal is needed anymore
Tomasz Mon <desowin@gmail.com>
parents: 2620
diff changeset
312 UiSkinnedPlaylistSlider *playlist_slider = UI_SKINNED_PLAYLIST_SLIDER(widget);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 priv->resize_height += h;
2698
32e99af83a3e I don't think redraw signal is needed anymore
Tomasz Mon <desowin@gmail.com>
parents: 2620
diff changeset
315 gtk_widget_set_size_request(GTK_WIDGET(playlist_slider), priv->width, priv->height+priv->resize_height);
2620
2d6e08c81c09 add playlistwindow
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316 }