Mercurial > audlegacy
annotate src/audacious/ui_skinned_horizontal_slider.c @ 4234:b293ce14a01a
partially works...
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Thu, 31 Jan 2008 12:04:13 +0300 |
parents | f6625617716b |
children | de33c83aa06f |
rev | line source |
---|---|
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
1 /* |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
2 * Audacious - a cross-platform multimedia player |
3840 | 3 * Copyright (c) 2007 Tomasz Moń |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
4 * |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
5 * Based on: |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
6 * BMP - Cross-platform multimedia player |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
7 * Copyright (C) 2003-2004 BMP development team. |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
8 * XMMS: |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
9 * Copyright (C) 1998-2003 XMMS development team. |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
10 * |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3105
diff
changeset
|
13 * the Free Software Foundation; under version 3 of the License. |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
14 * |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
19 * |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3105
diff
changeset
|
21 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
24 * Audacious or using our public API to be a derived work. |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
25 */ |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
26 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
27 #include "ui_skinned_horizontal_slider.h" |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
28 #include "main.h" |
3059
f58cbfe8df1b
use create_dblsize_image for doueblesizing
Tomasz Mon <desowin@gmail.com>
parents:
3053
diff
changeset
|
29 #include "util.h" |
4225
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
30 #include <math.h> |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
31 |
3105 | 32 #define UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_horizontal_slider_get_type(), UiSkinnedHorizontalSliderPrivate)) |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
33 typedef struct _UiSkinnedHorizontalSliderPrivate UiSkinnedHorizontalSliderPrivate; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
34 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
35 enum { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
36 MOTION, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
37 RELEASE, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
38 DOUBLED, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
39 LAST_SIGNAL |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
40 }; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
41 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
42 struct _UiSkinnedHorizontalSliderPrivate { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
43 SkinPixmapId skin_index; |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
44 gboolean scaled; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
45 gint frame, frame_offset, frame_height, min, max; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
46 gint knob_width, knob_height; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
47 gint position; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
48 gint width, height; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
49 gint (*frame_cb) (gint); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
50 }; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
51 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
52 static void ui_skinned_horizontal_slider_class_init (UiSkinnedHorizontalSliderClass *klass); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
53 static void ui_skinned_horizontal_slider_init (UiSkinnedHorizontalSlider *horizontal_slider); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
54 static void ui_skinned_horizontal_slider_destroy (GtkObject *object); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
55 static void ui_skinned_horizontal_slider_realize (GtkWidget *widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
56 static void ui_skinned_horizontal_slider_size_request (GtkWidget *widget, GtkRequisition *requisition); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
57 static void ui_skinned_horizontal_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
58 static gboolean ui_skinned_horizontal_slider_expose (GtkWidget *widget, GdkEventExpose *event); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
59 static gboolean ui_skinned_horizontal_slider_button_press (GtkWidget *widget, GdkEventButton *event); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
60 static gboolean ui_skinned_horizontal_slider_button_release (GtkWidget *widget, GdkEventButton *event); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
61 static gboolean ui_skinned_horizontal_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event); |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
62 static void ui_skinned_horizontal_slider_toggle_scaled (UiSkinnedHorizontalSlider *horizontal_slider); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
63 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
64 static GtkWidgetClass *parent_class = NULL; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
65 static guint horizontal_slider_signals[LAST_SIGNAL] = { 0 }; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
66 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
67 GType ui_skinned_horizontal_slider_get_type() { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
68 static GType horizontal_slider_type = 0; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
69 if (!horizontal_slider_type) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
70 static const GTypeInfo horizontal_slider_info = { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
71 sizeof (UiSkinnedHorizontalSliderClass), |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
72 NULL, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
73 NULL, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
74 (GClassInitFunc) ui_skinned_horizontal_slider_class_init, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
75 NULL, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
76 NULL, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
77 sizeof (UiSkinnedHorizontalSlider), |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
78 0, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
79 (GInstanceInitFunc) ui_skinned_horizontal_slider_init, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
80 }; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
81 horizontal_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedHorizontalSlider", &horizontal_slider_info, 0); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
82 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
83 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
84 return horizontal_slider_type; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
85 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
86 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
87 static void ui_skinned_horizontal_slider_class_init(UiSkinnedHorizontalSliderClass *klass) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
88 GObjectClass *gobject_class; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
89 GtkObjectClass *object_class; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
90 GtkWidgetClass *widget_class; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
91 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
92 gobject_class = G_OBJECT_CLASS(klass); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
93 object_class = (GtkObjectClass*) klass; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
94 widget_class = (GtkWidgetClass*) klass; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
95 parent_class = gtk_type_class (gtk_widget_get_type ()); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
96 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
97 object_class->destroy = ui_skinned_horizontal_slider_destroy; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
98 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
99 widget_class->realize = ui_skinned_horizontal_slider_realize; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
100 widget_class->expose_event = ui_skinned_horizontal_slider_expose; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
101 widget_class->size_request = ui_skinned_horizontal_slider_size_request; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
102 widget_class->size_allocate = ui_skinned_horizontal_slider_size_allocate; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
103 widget_class->button_press_event = ui_skinned_horizontal_slider_button_press; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
104 widget_class->button_release_event = ui_skinned_horizontal_slider_button_release; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
105 widget_class->motion_notify_event = ui_skinned_horizontal_slider_motion_notify; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
106 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
107 klass->motion = NULL; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
108 klass->release = NULL; |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
109 klass->scaled = ui_skinned_horizontal_slider_toggle_scaled; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
110 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
111 horizontal_slider_signals[MOTION] = |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
112 g_signal_new ("motion", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
113 G_STRUCT_OFFSET (UiSkinnedHorizontalSliderClass, motion), NULL, NULL, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
114 gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
115 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
116 horizontal_slider_signals[RELEASE] = |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
117 g_signal_new ("release", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
118 G_STRUCT_OFFSET (UiSkinnedHorizontalSliderClass, release), NULL, NULL, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
119 gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
120 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
121 horizontal_slider_signals[DOUBLED] = |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
122 g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
123 G_STRUCT_OFFSET (UiSkinnedHorizontalSliderClass, scaled), NULL, NULL, |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
124 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
125 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
126 g_type_class_add_private (gobject_class, sizeof (UiSkinnedHorizontalSliderPrivate)); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
127 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
128 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
129 static void ui_skinned_horizontal_slider_init(UiSkinnedHorizontalSlider *horizontal_slider) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
130 horizontal_slider->pressed = FALSE; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
131 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
132 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
133 GtkWidget* ui_skinned_horizontal_slider_new(GtkWidget *fixed, gint x, gint y, gint w, gint h, gint knx, gint kny, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
134 gint kpx, gint kpy, gint kw, gint kh, gint fh, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
135 gint fo, gint min, gint max, gint(*fcb) (gint), SkinPixmapId si) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
136 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
137 UiSkinnedHorizontalSlider *hs = g_object_new (ui_skinned_horizontal_slider_get_type (), NULL); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
138 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(hs); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
139 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
140 hs->x = x; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
141 hs->y = y; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
142 priv->width = w; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
143 priv->height = h; |
3042
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
144 hs->knob_nx = knx; |
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
145 hs->knob_ny = kny; |
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
146 hs->knob_px = kpx; |
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
147 hs->knob_py = kpy; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
148 priv->knob_width = kw; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
149 priv->knob_height = kh; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
150 priv->frame_height = fh; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
151 priv->frame_offset = fo; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
152 priv->min = min; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
153 priv->position = min; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
154 priv->max = max; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
155 priv->frame_cb = fcb; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
156 if (priv->frame_cb) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
157 priv->frame = priv->frame_cb(0); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
158 priv->skin_index = si; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
159 |
3939
d46d60247826
we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents:
3933
diff
changeset
|
160 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(hs), hs->x, hs->y); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
161 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
162 return GTK_WIDGET(hs); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
163 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
164 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
165 static void ui_skinned_horizontal_slider_destroy(GtkObject *object) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
166 UiSkinnedHorizontalSlider *horizontal_slider; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
167 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
168 g_return_if_fail (object != NULL); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
169 g_return_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (object)); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
170 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
171 horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER (object); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
172 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
173 if (GTK_OBJECT_CLASS (parent_class)->destroy) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
174 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
175 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
176 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
177 static void ui_skinned_horizontal_slider_realize(GtkWidget *widget) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
178 UiSkinnedHorizontalSlider *horizontal_slider; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
179 GdkWindowAttr attributes; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
180 gint attributes_mask; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
181 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
182 g_return_if_fail (widget != NULL); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
183 g_return_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER(widget)); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
184 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
185 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
186 horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
187 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
188 attributes.x = widget->allocation.x; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
189 attributes.y = widget->allocation.y; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
190 attributes.width = widget->allocation.width; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
191 attributes.height = widget->allocation.height; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
192 attributes.wclass = GDK_INPUT_OUTPUT; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
193 attributes.window_type = GDK_WINDOW_CHILD; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
194 attributes.event_mask = gtk_widget_get_events(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
195 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | |
3051 | 196 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
197 attributes.visual = gtk_widget_get_visual(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
198 attributes.colormap = gtk_widget_get_colormap(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
199 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
200 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
201 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
202 |
3052 | 203 widget->style = gtk_style_attach(widget->style, widget->window); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
204 gdk_window_set_user_data(widget->window, widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
205 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
206 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
207 static void ui_skinned_horizontal_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
208 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
209 |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
210 requisition->width = priv->width*(priv->scaled ? cfg.scale_factor : 1); |
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
211 requisition->height = priv->height*(priv->scaled ? cfg.scale_factor : 1); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
212 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
213 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
214 static void ui_skinned_horizontal_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
215 UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER (widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
216 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(horizontal_slider); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
217 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
218 widget->allocation = *allocation; |
4225
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
219 widget->allocation.x = ceil(widget->allocation.x*(priv->scaled ? cfg.scale_factor : 1)); |
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
220 widget->allocation.y = ceil(widget->allocation.y*(priv->scaled ? cfg.scale_factor : 1)); |
3332 | 221 |
3305
6cadc2ddf4cd
revise 19ad8ea66a03: fix skins with non-standard size posbar
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
222 if (priv->knob_height == priv->height) |
4225
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
223 priv->knob_height = ceil(allocation->height/(priv->scaled ? cfg.scale_factor : 1)); |
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
224 priv->width = ceil(allocation->width/(priv->scaled ? cfg.scale_factor : 1)); |
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
225 priv->height = ceil(allocation->height/(priv->scaled ? cfg.scale_factor : 1)); |
3305
6cadc2ddf4cd
revise 19ad8ea66a03: fix skins with non-standard size posbar
Tomasz Mon <desowin@gmail.com>
parents:
3251
diff
changeset
|
226 |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
227 if (GTK_WIDGET_REALIZED (widget)) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
228 gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
229 |
4225
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
230 horizontal_slider->x = ceil(widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1)); |
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
231 horizontal_slider->y = ceil(widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1)); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
232 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
233 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
234 static gboolean ui_skinned_horizontal_slider_expose(GtkWidget *widget, GdkEventExpose *event) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
235 g_return_val_if_fail (widget != NULL, FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
236 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
237 g_return_val_if_fail (event != NULL, FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
238 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
239 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER (widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
240 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(hs); |
4119 | 241 g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
242 |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4119
diff
changeset
|
243 GdkPixbuf *obj = NULL; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
244 |
3053
712b3d476e06
Correct slider behaviour in doublesize
Tomasz Mon <desowin@gmail.com>
parents:
3052
diff
changeset
|
245 if (priv->position > priv->max) priv->position = priv->max; |
712b3d476e06
Correct slider behaviour in doublesize
Tomasz Mon <desowin@gmail.com>
parents:
3052
diff
changeset
|
246 else if (priv->position < priv->min) priv->position = priv->min; |
712b3d476e06
Correct slider behaviour in doublesize
Tomasz Mon <desowin@gmail.com>
parents:
3052
diff
changeset
|
247 |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4119
diff
changeset
|
248 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
249 |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4119
diff
changeset
|
250 skin_draw_pixbuf(widget, bmp_active_skin, obj, |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
251 priv->skin_index, priv->frame_offset, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
252 priv->frame * priv->frame_height, |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
253 0, 0, priv->width, priv->height); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
254 if (hs->pressed) |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4119
diff
changeset
|
255 skin_draw_pixbuf(widget, bmp_active_skin, obj, |
3042
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
256 priv->skin_index, hs->knob_px, |
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
257 hs->knob_py, priv->position, |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
258 ((priv->height - priv->knob_height) / 2), |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
259 priv->knob_width, priv->knob_height); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
260 else |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4119
diff
changeset
|
261 skin_draw_pixbuf(widget, bmp_active_skin, obj, |
3042
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
262 priv->skin_index, hs->knob_nx, |
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3040
diff
changeset
|
263 hs->knob_ny, priv->position, |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
264 ((priv->height - priv->knob_height) / 2), |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
265 priv->knob_width, priv->knob_height); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
266 |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
267 ui_skinned_widget_draw(widget, obj, priv->width, priv->height, priv->scaled); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
268 |
4195
2281da647da9
beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents:
4119
diff
changeset
|
269 g_object_unref(obj); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
270 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
271 return FALSE; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
272 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
273 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
274 static gboolean ui_skinned_horizontal_slider_button_press(GtkWidget *widget, GdkEventButton *event) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
275 g_return_val_if_fail (widget != NULL, FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
276 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
277 g_return_val_if_fail (event != NULL, FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
278 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
279 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER (widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
280 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(hs); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
281 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
282 if (event->type == GDK_BUTTON_PRESS) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
283 if (event->button == 1) { |
3600
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
284 gint x; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
285 |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
286 x = event->x - (priv->knob_width / (priv->scaled ? 1 : cfg.scale_factor)); |
3600
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
287 hs->pressed = TRUE; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
288 |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
289 priv->position = x/(priv->scaled ? cfg.scale_factor : 1); |
3600
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
290 if (priv->position < priv->min) |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
291 priv->position = priv->min; |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
292 if (priv->position > priv->max) |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
293 priv->position = priv->max; |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
294 if (priv->frame_cb) |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
295 priv->frame = priv->frame_cb(priv->position); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
296 |
3600
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
297 g_signal_emit_by_name(widget, "motion", priv->position); |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
298 gtk_widget_queue_draw(widget); |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
299 } else if (event->button == 3) { |
3724
9a8e54ffdd76
prevent info text being stuck after changing volume
Tomasz Mon <desowin@gmail.com>
parents:
3600
diff
changeset
|
300 if (hs->pressed) { |
9a8e54ffdd76
prevent info text being stuck after changing volume
Tomasz Mon <desowin@gmail.com>
parents:
3600
diff
changeset
|
301 hs->pressed = FALSE; |
9a8e54ffdd76
prevent info text being stuck after changing volume
Tomasz Mon <desowin@gmail.com>
parents:
3600
diff
changeset
|
302 g_signal_emit_by_name(widget, "release", priv->position); |
9a8e54ffdd76
prevent info text being stuck after changing volume
Tomasz Mon <desowin@gmail.com>
parents:
3600
diff
changeset
|
303 gtk_widget_queue_draw(widget); |
9a8e54ffdd76
prevent info text being stuck after changing volume
Tomasz Mon <desowin@gmail.com>
parents:
3600
diff
changeset
|
304 } |
3600
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
305 event->x = event->x + hs->x; |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
306 event->y = event->y + hs->y; |
aba660a4a15d
Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents:
3332
diff
changeset
|
307 return FALSE; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
308 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
309 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
310 return TRUE; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
311 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
312 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
313 static gboolean ui_skinned_horizontal_slider_button_release(GtkWidget *widget, GdkEventButton *event) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
314 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
315 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
316 |
3724
9a8e54ffdd76
prevent info text being stuck after changing volume
Tomasz Mon <desowin@gmail.com>
parents:
3600
diff
changeset
|
317 if (hs->pressed) { |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
318 hs->pressed = FALSE; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
319 g_signal_emit_by_name(widget, "release", priv->position); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
320 gtk_widget_queue_draw(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
321 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
322 return TRUE; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
323 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
324 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
325 static gboolean ui_skinned_horizontal_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
326 g_return_val_if_fail (widget != NULL, FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
327 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
328 g_return_val_if_fail (event != NULL, FALSE); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
329 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
330 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
331 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
332 if (hs->pressed) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
333 gint x; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
334 |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
335 x = event->x - (priv->knob_width / (priv->scaled ? 1 : cfg.scale_factor)); |
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
336 priv->position = x/(priv->scaled ? cfg.scale_factor : 1); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
337 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
338 if (priv->position < priv->min) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
339 priv->position = priv->min; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
340 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
341 if (priv->position > priv->max) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
342 priv->position = priv->max; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
343 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
344 if (priv->frame_cb) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
345 priv->frame = priv->frame_cb(priv->position); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
346 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
347 g_signal_emit_by_name(widget, "motion", priv->position); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
348 gtk_widget_queue_draw(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
349 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
350 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
351 return TRUE; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
352 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
353 |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
354 static void ui_skinned_horizontal_slider_toggle_scaled(UiSkinnedHorizontalSlider *horizontal_slider) { |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
355 GtkWidget *widget = GTK_WIDGET (horizontal_slider); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
356 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(horizontal_slider); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
357 |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4212
diff
changeset
|
358 priv->scaled = !priv->scaled; |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
359 |
4225
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
360 gtk_widget_set_size_request(widget, |
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
361 priv->width*(priv->scaled ? cfg.scale_factor : 1), |
f6625617716b
- use ceil() to round non-integer pixel lengths up to the next integer value; this is needed to deal with non-integer scale factors, and should be probably applied to other scalable ui-widgets
Giacomo Lozito <james@develia.org>
parents:
4218
diff
changeset
|
362 priv->height*(priv->scaled ? cfg.scale_factor : 1)); |
3040
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
363 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
364 gtk_widget_queue_draw(GTK_WIDGET(horizontal_slider)); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
365 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
366 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
367 void ui_skinned_horizontal_slider_set_position(GtkWidget *widget, gint pos) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
368 g_return_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget)); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
369 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
370 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
371 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
372 if (pos == priv->position || hs->pressed) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
373 return; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
374 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
375 priv->position = pos; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
376 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
377 if (priv->frame_cb) |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
378 priv->frame = priv->frame_cb(priv->position); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
379 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
380 gtk_widget_queue_draw(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
381 } |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
382 |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
383 gint ui_skinned_horizontal_slider_get_position(GtkWidget *widget) { |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
384 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), -1); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
385 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget); |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
386 return priv->position; |
067e0186623a
import UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
387 } |