annotate src/audacious/ui_skinned_playlist_slider.c @ 4079:acb28b9494b2

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