annotate src/skins/ui_skinned_horizontal_slider.c @ 2975:4d778b7a19c6

now sndfile can display Japanese file name.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 12 Feb 2009 01:50:09 +0900
parents 7c7471554d88
children 963796db51ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 Tomasz Moń
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 * along with this program. If not, see <http://www.gnu.org/licenses>.
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 *
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * The Audacious team does not consider modular code linking to
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 * Audacious or using our public API to be a derived work.
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 */
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include "ui_skinned_horizontal_slider.h"
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include "skins_cfg.h"
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include <math.h>
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #define UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_horizontal_slider_get_type(), UiSkinnedHorizontalSliderPrivate))
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 typedef struct _UiSkinnedHorizontalSliderPrivate UiSkinnedHorizontalSliderPrivate;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 enum {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 MOTION,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 RELEASE,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 DOUBLED,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 LAST_SIGNAL
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 };
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 struct _UiSkinnedHorizontalSliderPrivate {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 SkinPixmapId skin_index;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 gboolean scaled;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 gint frame, frame_offset, frame_height, min, max;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 gint knob_width, knob_height;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 gint position;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 gint width, height;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 gint (*frame_cb) (gint);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 };
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 static void ui_skinned_horizontal_slider_class_init (UiSkinnedHorizontalSliderClass *klass);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static void ui_skinned_horizontal_slider_init (UiSkinnedHorizontalSlider *horizontal_slider);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void ui_skinned_horizontal_slider_destroy (GtkObject *object);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 static void ui_skinned_horizontal_slider_realize (GtkWidget *widget);
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
55 static void ui_skinned_horizontal_slider_unrealize (GtkWidget *widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
56 static void ui_skinned_horizontal_slider_map (GtkWidget *widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
57 static void ui_skinned_horizontal_slider_unmap (GtkWidget *widget);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 static void ui_skinned_horizontal_slider_size_request (GtkWidget *widget, GtkRequisition *requisition);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static void ui_skinned_horizontal_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 static gboolean ui_skinned_horizontal_slider_expose (GtkWidget *widget, GdkEventExpose *event);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 static gboolean ui_skinned_horizontal_slider_button_press (GtkWidget *widget, GdkEventButton *event);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 static gboolean ui_skinned_horizontal_slider_button_release (GtkWidget *widget, GdkEventButton *event);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 static gboolean ui_skinned_horizontal_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 static void ui_skinned_horizontal_slider_toggle_scaled (UiSkinnedHorizontalSlider *horizontal_slider);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 static GtkWidgetClass *parent_class = NULL;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 static guint horizontal_slider_signals[LAST_SIGNAL] = { 0 };
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 GType ui_skinned_horizontal_slider_get_type() {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 static GType horizontal_slider_type = 0;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 if (!horizontal_slider_type) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 static const GTypeInfo horizontal_slider_info = {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 sizeof (UiSkinnedHorizontalSliderClass),
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 NULL,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 NULL,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 (GClassInitFunc) ui_skinned_horizontal_slider_class_init,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 NULL,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 NULL,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 sizeof (UiSkinnedHorizontalSlider),
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 0,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 (GInstanceInitFunc) ui_skinned_horizontal_slider_init,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 };
2590
Tomasz Mon <desowin@gmail.com>
parents: 2589
diff changeset
83 horizontal_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedHorizontalSlider", &horizontal_slider_info, 0);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 return horizontal_slider_type;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 static void ui_skinned_horizontal_slider_class_init(UiSkinnedHorizontalSliderClass *klass) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 GObjectClass *gobject_class;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 GtkObjectClass *object_class;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 GtkWidgetClass *widget_class;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 gobject_class = G_OBJECT_CLASS(klass);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 object_class = (GtkObjectClass*) klass;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 widget_class = (GtkWidgetClass*) klass;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97 parent_class = gtk_type_class (gtk_widget_get_type ());
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99 object_class->destroy = ui_skinned_horizontal_slider_destroy;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 widget_class->realize = ui_skinned_horizontal_slider_realize;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
102 widget_class->unrealize = ui_skinned_horizontal_slider_unrealize;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
103 widget_class->map = ui_skinned_horizontal_slider_map;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
104 widget_class->unmap = ui_skinned_horizontal_slider_unmap;
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 widget_class->expose_event = ui_skinned_horizontal_slider_expose;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 widget_class->size_request = ui_skinned_horizontal_slider_size_request;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107 widget_class->size_allocate = ui_skinned_horizontal_slider_size_allocate;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 widget_class->button_press_event = ui_skinned_horizontal_slider_button_press;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109 widget_class->button_release_event = ui_skinned_horizontal_slider_button_release;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 widget_class->motion_notify_event = ui_skinned_horizontal_slider_motion_notify;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 klass->motion = NULL;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 klass->release = NULL;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 klass->scaled = ui_skinned_horizontal_slider_toggle_scaled;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 horizontal_slider_signals[MOTION] =
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 g_signal_new ("motion", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 G_STRUCT_OFFSET (UiSkinnedHorizontalSliderClass, motion), NULL, NULL,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 horizontal_slider_signals[RELEASE] =
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 g_signal_new ("release", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 G_STRUCT_OFFSET (UiSkinnedHorizontalSliderClass, release), NULL, NULL,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 horizontal_slider_signals[DOUBLED] =
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 G_STRUCT_OFFSET (UiSkinnedHorizontalSliderClass, scaled), NULL, NULL,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 g_type_class_add_private (gobject_class, sizeof (UiSkinnedHorizontalSliderPrivate));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 static void ui_skinned_horizontal_slider_init(UiSkinnedHorizontalSlider *horizontal_slider) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 horizontal_slider->pressed = FALSE;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
136
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
137 horizontal_slider->event_window = NULL;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
138 GTK_WIDGET_SET_FLAGS(horizontal_slider, GTK_NO_WINDOW);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 GtkWidget* ui_skinned_horizontal_slider_new(GtkWidget *fixed, gint x, gint y, gint w, gint h, gint knx, gint kny,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 gint kpx, gint kpy, gint kw, gint kh, gint fh,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143 gint fo, gint min, gint max, gint(*fcb) (gint), SkinPixmapId si) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 UiSkinnedHorizontalSlider *hs = g_object_new (ui_skinned_horizontal_slider_get_type (), NULL);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(hs);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 hs->x = x;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 hs->y = y;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 priv->width = w;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 priv->height = h;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 hs->knob_nx = knx;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 hs->knob_ny = kny;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 hs->knob_px = kpx;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 hs->knob_py = kpy;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 priv->knob_width = kw;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 priv->knob_height = kh;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 priv->frame_height = fh;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 priv->frame_offset = fo;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 priv->min = min;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 priv->position = min;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 priv->max = max;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 priv->frame_cb = fcb;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 if (priv->frame_cb)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 priv->frame = priv->frame_cb(0);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 priv->skin_index = si;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(hs), hs->x, hs->y);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 return GTK_WIDGET(hs);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 static void ui_skinned_horizontal_slider_destroy(GtkObject *object) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 UiSkinnedHorizontalSlider *horizontal_slider;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 g_return_if_fail (object != NULL);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 g_return_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (object));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER (object);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 if (GTK_OBJECT_CLASS (parent_class)->destroy)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 static void ui_skinned_horizontal_slider_realize(GtkWidget *widget) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 UiSkinnedHorizontalSlider *horizontal_slider;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187 GdkWindowAttr attributes;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 gint attributes_mask;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 g_return_if_fail (widget != NULL);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 g_return_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER(widget));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
193 if (GTK_WIDGET_CLASS (parent_class)->realize)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
194 (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197 attributes.x = widget->allocation.x;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 attributes.y = widget->allocation.y;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 attributes.width = widget->allocation.width;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 attributes.height = widget->allocation.height;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
201 attributes.wclass = GDK_INPUT_ONLY;
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 attributes.window_type = GDK_WINDOW_CHILD;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 attributes.event_mask = gtk_widget_get_events(widget);
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
204 attributes.event_mask |= GDK_BUTTON_PRESS_MASK |
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
206
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
207 attributes_mask = GDK_WA_X | GDK_WA_Y;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
208 horizontal_slider->event_window = gdk_window_new(widget->window, &attributes, attributes_mask);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
209
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
210 gdk_window_set_user_data(horizontal_slider->event_window, widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
211 }
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
212
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
213 static void ui_skinned_horizontal_slider_unrealize(GtkWidget *widget) {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
214 UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
215
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
216 if ( horizontal_slider->event_window != NULL )
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
217 {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
218 gdk_window_set_user_data( horizontal_slider->event_window , NULL );
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
219 gdk_window_destroy( horizontal_slider->event_window );
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
220 horizontal_slider->event_window = NULL;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
221 }
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
223 if (GTK_WIDGET_CLASS (parent_class)->unrealize)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
224 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
225 }
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
226
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
227 static void ui_skinned_horizontal_slider_map (GtkWidget *widget)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
228 {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
229 UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
230
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
231 if (horizontal_slider->event_window != NULL)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
232 gdk_window_show (horizontal_slider->event_window);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
234 if (GTK_WIDGET_CLASS (parent_class)->map)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
235 (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
236 }
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
237
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
238 static void ui_skinned_horizontal_slider_unmap (GtkWidget *widget)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
239 {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
240 UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER(widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
241
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
242 if (horizontal_slider->event_window != NULL)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
243 gdk_window_hide (horizontal_slider->event_window);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
244
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
245 if (GTK_WIDGET_CLASS (parent_class)->unmap)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
246 (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 static void ui_skinned_horizontal_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 requisition->width = priv->width*(priv->scaled ? config.scale_factor : 1);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 requisition->height = priv->height*(priv->scaled ? config.scale_factor : 1);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 static void ui_skinned_horizontal_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 UiSkinnedHorizontalSlider *horizontal_slider = UI_SKINNED_HORIZONTAL_SLIDER (widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(horizontal_slider);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 widget->allocation = *allocation;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 widget->allocation.x = ceil(widget->allocation.x*(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262 widget->allocation.y = ceil(widget->allocation.y*(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 if (priv->knob_height == priv->height)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 priv->knob_height = ceil(allocation->height/(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 priv->width = ceil(allocation->width/(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 priv->height = ceil(allocation->height/(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 if (GTK_WIDGET_REALIZED (widget))
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
270 if (horizontal_slider->event_window)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
271 gdk_window_move_resize(horizontal_slider->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273 horizontal_slider->x = ceil(widget->allocation.x/(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274 horizontal_slider->y = ceil(widget->allocation.y/(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 static gboolean ui_skinned_horizontal_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 g_return_val_if_fail (widget != NULL, FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 g_return_val_if_fail (event != NULL, FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER (widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(hs);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286 GdkPixbuf *obj = NULL;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288 if (priv->position > priv->max) priv->position = priv->max;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289 else if (priv->position < priv->min) priv->position = priv->min;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293 skin_draw_pixbuf(widget, aud_active_skin, obj,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 priv->skin_index, priv->frame_offset,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295 priv->frame * priv->frame_height,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 0, 0, priv->width, priv->height);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 if (hs->pressed)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 skin_draw_pixbuf(widget, aud_active_skin, obj,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 priv->skin_index, hs->knob_px,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 hs->knob_py, priv->position,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 ((priv->height - priv->knob_height) / 2),
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302 priv->knob_width, priv->knob_height);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 else
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 skin_draw_pixbuf(widget, aud_active_skin, obj,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 priv->skin_index, hs->knob_nx,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 hs->knob_ny, priv->position,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 ((priv->height - priv->knob_height) / 2),
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308 priv->knob_width, priv->knob_height);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
310 ui_skinned_widget_draw_with_coordinates(widget, obj, priv->width, priv->height,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
311 widget->allocation.x,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
312 widget->allocation.y,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2590
diff changeset
313 priv->scaled);
2589
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 g_object_unref(obj);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317 return FALSE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320 static gboolean ui_skinned_horizontal_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 g_return_val_if_fail (widget != NULL, FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 g_return_val_if_fail (event != NULL, FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER (widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(hs);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328 if (event->type == GDK_BUTTON_PRESS) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329 if (event->button == 1) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330 gint x;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 x = event->x - (priv->knob_width / (priv->scaled ? 1 : config.scale_factor));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333 hs->pressed = TRUE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335 priv->position = x/(priv->scaled ? config.scale_factor : 1);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336 if (priv->position < priv->min)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 priv->position = priv->min;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338 if (priv->position > priv->max)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339 priv->position = priv->max;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340 if (priv->frame_cb)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341 priv->frame = priv->frame_cb(priv->position);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
342
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
343 g_signal_emit_by_name(widget, "motion", priv->position);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
344 gtk_widget_queue_draw(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 } else if (event->button == 3) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
346 if (hs->pressed) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
347 hs->pressed = FALSE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
348 g_signal_emit_by_name(widget, "release", priv->position);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 gtk_widget_queue_draw(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
350 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
351 event->x = event->x + hs->x;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
352 event->y = event->y + hs->y;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353 return FALSE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
354 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
355 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
356 return TRUE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359 static gboolean ui_skinned_horizontal_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363 if (hs->pressed) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364 hs->pressed = FALSE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365 g_signal_emit_by_name(widget, "release", priv->position);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366 gtk_widget_queue_draw(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
368 return TRUE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
369 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
370
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
371 static gboolean ui_skinned_horizontal_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
372 g_return_val_if_fail (widget != NULL, FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
373 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
374 g_return_val_if_fail (event != NULL, FALSE);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
375 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
377
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378 if (hs->pressed) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379 gint x;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
380
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381 x = event->x - (priv->knob_width / (priv->scaled ? 1 : config.scale_factor));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 priv->position = x/(priv->scaled ? config.scale_factor : 1);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
383
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384 if (priv->position < priv->min)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385 priv->position = priv->min;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387 if (priv->position > priv->max)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
388 priv->position = priv->max;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390 if (priv->frame_cb)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391 priv->frame = priv->frame_cb(priv->position);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
393 g_signal_emit_by_name(widget, "motion", priv->position);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
394 gtk_widget_queue_draw(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
395 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
396
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
397 return TRUE;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
398 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
399
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
400 static void ui_skinned_horizontal_slider_toggle_scaled(UiSkinnedHorizontalSlider *horizontal_slider) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
401 GtkWidget *widget = GTK_WIDGET (horizontal_slider);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
402 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(horizontal_slider);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
403
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
404 priv->scaled = !priv->scaled;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
405
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
406 gtk_widget_set_size_request(widget,
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
407 priv->width*(priv->scaled ? config.scale_factor : 1),
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
408 priv->height*(priv->scaled ? config.scale_factor : 1));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
409
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
410 gtk_widget_queue_draw(GTK_WIDGET(horizontal_slider));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
411 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
412
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
413 void ui_skinned_horizontal_slider_set_position(GtkWidget *widget, gint pos) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
414 g_return_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget));
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
415 UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
416 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
417
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
418 if (pos == priv->position || hs->pressed)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
419 return;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
420
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
421 priv->position = pos;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
422
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
423 if (priv->frame_cb)
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
424 priv->frame = priv->frame_cb(priv->position);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
425
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
426 gtk_widget_queue_draw(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
427 }
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
428
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
429 gint ui_skinned_horizontal_slider_get_position(GtkWidget *widget) {
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
430 g_return_val_if_fail (UI_SKINNED_IS_HORIZONTAL_SLIDER (widget), -1);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
431 UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget);
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
432 return priv->position;
edf99201700e add ui_skinned_horizontal_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
433 }