annotate src/audacious/ui_skinned_playlist_slider.c @ 3251:f02623377013

goodbye widgets directory
author Tomasz Mon <desowin@gmail.com>
date Sun, 05 Aug 2007 16:43:53 +0200
parents 2127f7108033
children 46591501603e
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
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 Audacious development team.
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 GtkWidget *fixed;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 SkinPixmapId skin_index;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 gint width, height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 gint resize_height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 gint move_x;
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
48 gint prev_y;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
49 gint drag_y;
3136
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
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static void ui_skinned_playlist_slider_class_init (UiSkinnedPlaylistSliderClass *klass);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void ui_skinned_playlist_slider_init (UiSkinnedPlaylistSlider *playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 static void ui_skinned_playlist_slider_destroy (GtkObject *object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 static void ui_skinned_playlist_slider_realize (GtkWidget *widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 static void ui_skinned_playlist_slider_size_request (GtkWidget *widget, GtkRequisition *requisition);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 static void ui_skinned_playlist_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 static gboolean ui_skinned_playlist_slider_expose (GtkWidget *widget, GdkEventExpose *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static void ui_skinned_playlist_slider_set_position (GtkWidget *widget, gint y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 static gboolean ui_skinned_playlist_slider_button_press (GtkWidget *widget, GdkEventButton *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 static gboolean ui_skinned_playlist_slider_button_release (GtkWidget *widget, GdkEventButton *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 static gboolean ui_skinned_playlist_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 static void ui_skinned_playlist_slider_redraw (UiSkinnedPlaylistSlider *playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 static GtkWidgetClass *parent_class = NULL;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 static guint playlist_slider_signals[LAST_SIGNAL] = { 0 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 GType ui_skinned_playlist_slider_get_type() {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 static GType playlist_slider_type = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 if (!playlist_slider_type) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 static const GTypeInfo playlist_slider_info = {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 sizeof (UiSkinnedPlaylistSliderClass),
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 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 (GClassInitFunc) ui_skinned_playlist_slider_class_init,
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 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 sizeof (UiSkinnedPlaylistSlider),
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 0,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 (GInstanceInitFunc) ui_skinned_playlist_slider_init,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 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
83 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 return playlist_slider_type;
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
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 static void ui_skinned_playlist_slider_class_init(UiSkinnedPlaylistSliderClass *klass) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 GObjectClass *gobject_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 GtkObjectClass *object_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 GtkWidgetClass *widget_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 gobject_class = G_OBJECT_CLASS(klass);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 object_class = (GtkObjectClass*) klass;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 widget_class = (GtkWidgetClass*) klass;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 parent_class = gtk_type_class (gtk_widget_get_type ());
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 object_class->destroy = ui_skinned_playlist_slider_destroy;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 widget_class->realize = ui_skinned_playlist_slider_realize;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 widget_class->expose_event = ui_skinned_playlist_slider_expose;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 widget_class->size_request = ui_skinned_playlist_slider_size_request;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 widget_class->size_allocate = ui_skinned_playlist_slider_size_allocate;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 widget_class->button_press_event = ui_skinned_playlist_slider_button_press;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 widget_class->button_release_event = ui_skinned_playlist_slider_button_release;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 widget_class->motion_notify_event = ui_skinned_playlist_slider_motion_notify;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 klass->redraw = ui_skinned_playlist_slider_redraw;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 playlist_slider_signals[REDRAW] =
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 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
112 G_STRUCT_OFFSET (UiSkinnedPlaylistSliderClass, redraw), NULL, NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 g_type_class_add_private (gobject_class, sizeof (UiSkinnedPlaylistSliderPrivate));
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
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 static void ui_skinned_playlist_slider_init(UiSkinnedPlaylistSlider *playlist_slider) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 playlist_slider->pressed = FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 priv->resize_height = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 priv->move_x = 0;
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
123 priv->drag_y = 0;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
124 priv->prev_y = 0;
3136
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
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 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
128
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 UiSkinnedPlaylistSlider *hs = g_object_new (ui_skinned_playlist_slider_get_type (), NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(hs);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 hs->x = x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 hs->y = y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 priv->width = 8;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 priv->height = h;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 priv->fixed = fixed;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137 priv->skin_index = SKIN_PLEDIT;
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 gtk_fixed_put(GTK_FIXED(priv->fixed), GTK_WIDGET(hs), hs->x, hs->y);
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 return GTK_WIDGET(hs);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 static void ui_skinned_playlist_slider_destroy(GtkObject *object) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 UiSkinnedPlaylistSlider *playlist_slider;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 g_return_if_fail (object != NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 g_return_if_fail (UI_SKINNED_IS_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 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 if (GTK_OBJECT_CLASS (parent_class)->destroy)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 static void ui_skinned_playlist_slider_realize(GtkWidget *widget) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 UiSkinnedPlaylistSlider *playlist_slider;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 GdkWindowAttr attributes;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 gint attributes_mask;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 g_return_if_fail (widget != NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 g_return_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER(widget));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 attributes.x = widget->allocation.x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 attributes.y = widget->allocation.y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 attributes.width = widget->allocation.width;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 attributes.height = widget->allocation.height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 attributes.wclass = GDK_INPUT_OUTPUT;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 attributes.window_type = GDK_WINDOW_CHILD;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 attributes.event_mask = gtk_widget_get_events(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 attributes.visual = gtk_widget_get_visual(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 attributes.colormap = gtk_widget_get_colormap(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 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
180 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 widget->style = gtk_style_attach(widget->style, widget->window);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 gdk_window_set_user_data(widget->window, widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 static void ui_skinned_playlist_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 requisition->width = priv->width;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 requisition->height = priv->height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 static void ui_skinned_playlist_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 UiSkinnedPlaylistSlider *playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197 widget->allocation = *allocation;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 if (GTK_WIDGET_REALIZED (widget))
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 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
200
3137
19908efce4e5 one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents: 3136
diff changeset
201 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
202 priv->move_x = 0;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 playlist_slider->x = widget->allocation.x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 playlist_slider->y = widget->allocation.y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 if (priv->height != widget->allocation.height) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 priv->height = priv->height + priv->resize_height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 priv->resize_height = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209 gtk_widget_queue_draw(widget);
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 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 static gboolean ui_skinned_playlist_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 g_return_val_if_fail (widget != NULL, FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 g_return_val_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER (widget), FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 g_return_val_if_fail (event != NULL, FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(ps);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221 GdkPixmap *obj = NULL;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 GdkGC *gc;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224 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
225 gc = gdk_gc_new(obj);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227 gint num_visible;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 num_visible = playlistwin_list_get_visible_count();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229
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 Playlist *playlist = playlist_get_active();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 gint y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 if (playlist_get_length(playlist) > num_visible)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 y = (playlistwin_list_get_first() * (priv->height - 19)) /
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 (playlist_get_length(playlist) - num_visible);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 else
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 y = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 if (y < 0) y=0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 if (y > priv->height - 19) y = priv->height - 19;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
243 priv->prev_y = y;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
244
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 /* FIXME: uses bmp_active_skin->pixmaps directly and may need calibration */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 /* drawing background */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 gint c;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 for (c = 0; c <= priv->height / 29; c++) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 gdk_draw_drawable(obj, gc, bmp_active_skin->pixmaps[SKIN_PLEDIT].pixmap,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 36, 42, 0, c*29, priv->width, 29);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 /* drawing knob */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 skin_draw_pixmap(bmp_active_skin, obj, gc, priv->skin_index, ps->pressed ? 61 : 52, 53, 0, y, priv->width, 18);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 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
257 g_object_unref(obj);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 g_object_unref(gc);
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 return FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 static void ui_skinned_playlist_slider_set_position(GtkWidget *widget, gint y) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 gint pos;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 Playlist *playlist = playlist_get_active();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
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 y = CLAMP(y, 0, priv->height - 19);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270 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
271 playlistwin_set_toprow(pos);
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 gtk_widget_queue_draw(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 static gboolean ui_skinned_playlist_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
278 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
280 if (event->button != 1 && event->button != 2)
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
281 return TRUE;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
282
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
283 gint y = event->y;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 if (event->type == GDK_BUTTON_PRESS) {
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
285 ps->pressed = TRUE;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
286 if ((y >= priv->prev_y && y < priv->prev_y + 18)) {
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
287 priv->drag_y = y - priv->prev_y;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
288 } else if (event->button == 2) {
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289 ui_skinned_playlist_slider_set_position(widget, y);
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
290 priv->drag_y = 0;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
291 } else {
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
292 gint n = playlistwin_list_get_visible_count() / 2;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
293 if (y < priv->prev_y)
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
294 n *= -1;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
295 playlistwin_scroll(n);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 }
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
297 gtk_widget_queue_draw(widget);
3136
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 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302 static gboolean ui_skinned_playlist_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
305 if (event->button == 1 || event->button == 2) {
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 ps->pressed = FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 gtk_widget_queue_draw(widget);
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 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 static gboolean ui_skinned_playlist_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
314 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316 if (ps->pressed) {
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
317 gint y = event->y - priv->drag_y;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 ui_skinned_playlist_slider_set_position(widget, y);
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 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 static void ui_skinned_playlist_slider_redraw(UiSkinnedPlaylistSlider *playlist_slider) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 if (priv->resize_height)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 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
328 if (priv->move_x)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329 gtk_fixed_move(GTK_FIXED(priv->fixed), GTK_WIDGET(playlist_slider), playlist_slider->x+priv->move_x, playlist_slider->y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 gtk_widget_queue_draw(GTK_WIDGET(playlist_slider));
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
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334 void ui_skinned_playlist_slider_move_relative(GtkWidget *widget, gint x) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336 priv->move_x += x;
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
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339 void ui_skinned_playlist_slider_resize_relative(GtkWidget *widget, gint h) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341 priv->resize_height += h;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
342 }