annotate src/audacious/ui_skinned_button.c @ 4561:cc6255f8b568

Suffix all type names in core with _
author Tomasz Mon <desowin@gmail.com>
date Mon, 19 May 2008 18:11:41 +0200
parents 246244ead30e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
1 /*
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
3840
46591501603e Add my name in few places
Tomasz Mon <desowin@gmail.com>
parents: 3600
diff changeset
3 * Copyright (c) 2007 Tomasz Moń
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
4 *
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
6 * 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
7 * the Free Software Foundation; under version 3 of the License.
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
8 *
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
12 * GNU General Public License for more details.
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
13 *
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
14 * 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
15 * 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
16 *
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
17 * 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
18 * Audacious or using our public API to be a derived work.
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
19 */
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
20
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
21 #include "ui_skinned_button.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
22 #include <math.h>
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
23
3105
1912eba1004b cleaning
Tomasz Mon <desowin@gmail.com>
parents: 3103
diff changeset
24 #define UI_SKINNED_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_button_get_type(), UiSkinnedButtonPrivate))
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
25 typedef struct _UiSkinnedButtonPrivate UiSkinnedButtonPrivate;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
26
2964
7926d46872c8 right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents: 2963
diff changeset
27 enum {
3105
1912eba1004b cleaning
Tomasz Mon <desowin@gmail.com>
parents: 3103
diff changeset
28 PRESSED,
1912eba1004b cleaning
Tomasz Mon <desowin@gmail.com>
parents: 3103
diff changeset
29 RELEASED,
1912eba1004b cleaning
Tomasz Mon <desowin@gmail.com>
parents: 3103
diff changeset
30 CLICKED,
1912eba1004b cleaning
Tomasz Mon <desowin@gmail.com>
parents: 3103
diff changeset
31 DOUBLED,
1912eba1004b cleaning
Tomasz Mon <desowin@gmail.com>
parents: 3103
diff changeset
32 REDRAW,
1912eba1004b cleaning
Tomasz Mon <desowin@gmail.com>
parents: 3103
diff changeset
33 LAST_SIGNAL
2964
7926d46872c8 right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents: 2963
diff changeset
34 };
7926d46872c8 right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents: 2963
diff changeset
35
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
36 struct _UiSkinnedButtonPrivate {
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
37 //Skinned part
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
38 GdkGC *gc;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
39 gint w;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
40 gint h;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
41 SkinPixmapId skin_index1;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
42 SkinPixmapId skin_index2;
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
43 gboolean scaled;
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
44 gint move_x, move_y;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
45
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
46 gint nx, ny, px, py;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
47 //Toogle button needs also those
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
48 gint pnx, pny, ppx, ppy;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
49 };
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
50
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
51
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
52 static GtkWidgetClass *parent_class = NULL;
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
53 static void ui_skinned_button_class_init(UiSkinnedButtonClass *klass);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
54 static void ui_skinned_button_init(UiSkinnedButton *button);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
55 static void ui_skinned_button_destroy(GtkObject *object);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
56 static void ui_skinned_button_realize(GtkWidget *widget);
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
57 static void ui_skinned_button_unrealize(GtkWidget *widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
58 static void ui_skinned_button_map(GtkWidget *widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
59 static void ui_skinned_button_unmap(GtkWidget *widget);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
60 static void ui_skinned_button_size_request(GtkWidget *widget, GtkRequisition *requisition);
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
61 static gint ui_skinned_button_expose(GtkWidget *widget,GdkEventExpose *event);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
62
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
63 static void ui_skinned_button_size_allocate(GtkWidget *widget, GtkAllocation *allocation);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
64 static void ui_skinned_button_update_state(UiSkinnedButton *button);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
65
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
66 static guint button_signals[LAST_SIGNAL] = { 0 };
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
67 static gint ui_skinned_button_button_press(GtkWidget *widget, GdkEventButton *event);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
68 static gint ui_skinned_button_button_release(GtkWidget *widget, GdkEventButton *event);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
69 static void button_pressed(UiSkinnedButton *button);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
70 static void button_released(UiSkinnedButton *button);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
71 static void ui_skinned_button_pressed(UiSkinnedButton *button);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
72 static void ui_skinned_button_released(UiSkinnedButton *button);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
73 static void ui_skinned_button_clicked(UiSkinnedButton *button);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
74 static void ui_skinned_button_set_pressed (UiSkinnedButton *button, gboolean pressed);
2834
0598469fe2a9 [svn] - cleaned up header
desowin
parents: 2833
diff changeset
75
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
76 static void ui_skinned_button_toggle_scaled(UiSkinnedButton *button);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
77
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
78 static gint ui_skinned_button_enter_notify(GtkWidget *widget, GdkEventCrossing *event);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
79 static gint ui_skinned_button_leave_notify(GtkWidget *widget, GdkEventCrossing *event);
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
80 static void ui_skinned_button_redraw(UiSkinnedButton *button);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
81
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
82 GType ui_skinned_button_get_type() {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
83 static GType button_type = 0;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
84 if (!button_type) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
85 static const GTypeInfo button_info = {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
86 sizeof (UiSkinnedButtonClass),
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
87 NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
88 NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
89 (GClassInitFunc) ui_skinned_button_class_init,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
90 NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
91 NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
92 sizeof (UiSkinnedButton),
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
93 0,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
94 (GInstanceInitFunc) ui_skinned_button_init,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
95 };
4561
cc6255f8b568 Suffix all type names in core with _
Tomasz Mon <desowin@gmail.com>
parents: 4508
diff changeset
96 button_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedButton_", &button_info, 0);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
97 }
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
98
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
99 return button_type;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
100 }
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
101
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
102 static void ui_skinned_button_class_init (UiSkinnedButtonClass *klass) {
2996
a2eb970ca669 bring back UiSkinnedTextboxPrivate
Tomasz Mon <desowin@gmail.com>
parents: 2995
diff changeset
103 GObjectClass *gobject_class;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
104 GtkObjectClass *object_class;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
105 GtkWidgetClass *widget_class;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
106
2996
a2eb970ca669 bring back UiSkinnedTextboxPrivate
Tomasz Mon <desowin@gmail.com>
parents: 2995
diff changeset
107 gobject_class = G_OBJECT_CLASS(klass);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
108 object_class = (GtkObjectClass*) klass;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
109 widget_class = (GtkWidgetClass*) klass;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
110 parent_class = gtk_type_class (gtk_widget_get_type ());
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
111
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
112 object_class->destroy = ui_skinned_button_destroy;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
113
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
114 widget_class->realize = ui_skinned_button_realize;
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
115 widget_class->unrealize = ui_skinned_button_unrealize;
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
116 widget_class->map = ui_skinned_button_map;
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
117 widget_class->unmap = ui_skinned_button_unmap;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
118 widget_class->expose_event = ui_skinned_button_expose;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
119 widget_class->size_request = ui_skinned_button_size_request;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
120 widget_class->size_allocate = ui_skinned_button_size_allocate;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
121 widget_class->button_press_event = ui_skinned_button_button_press;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
122 widget_class->button_release_event = ui_skinned_button_button_release;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
123 widget_class->enter_notify_event = ui_skinned_button_enter_notify;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
124 widget_class->leave_notify_event = ui_skinned_button_leave_notify;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
125
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
126 klass->pressed = button_pressed;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
127 klass->released = button_released;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
128 klass->clicked = 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
129 klass->scaled = ui_skinned_button_toggle_scaled;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
130 klass->redraw = ui_skinned_button_redraw;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
131
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
132 button_signals[PRESSED] =
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
133 g_signal_new ("pressed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
134 G_STRUCT_OFFSET (UiSkinnedButtonClass, pressed), NULL, NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
135 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
136
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
137 button_signals[RELEASED] =
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
138 g_signal_new ("released", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
139 G_STRUCT_OFFSET (UiSkinnedButtonClass, released), NULL, NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
140 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
141
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
142 button_signals[CLICKED] =
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
143 g_signal_new ("clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
144 G_STRUCT_OFFSET (UiSkinnedButtonClass, clicked), NULL, NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
145 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
146
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
147 button_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
148 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
149 G_STRUCT_OFFSET (UiSkinnedButtonClass, scaled), NULL, NULL,
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
150 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
151
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
152 button_signals[REDRAW] =
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
153 g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
154 G_STRUCT_OFFSET (UiSkinnedButtonClass, redraw), NULL, NULL,
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
155 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
2829
4eda78b785ed [svn] - draw_main_window redraws custom gtk widgets
desowin
parents: 2828
diff changeset
156
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
157 g_type_class_add_private (gobject_class, sizeof (UiSkinnedButtonPrivate));
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
158 }
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
159
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
160 static void ui_skinned_button_init (UiSkinnedButton *button) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
161 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
162 button->inside = FALSE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
163 button->type = TYPE_NOT_SET;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
164 priv->move_x = 0;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
165 priv->move_y = 0;
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
166 button->event_window = NULL;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
167 }
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
168
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
169 static void ui_skinned_button_destroy (GtkObject *object) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
170 UiSkinnedButton *button;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
171
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
172 g_return_if_fail (object != NULL);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
173 g_return_if_fail (UI_SKINNED_IS_BUTTON (object));
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
174
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
175 button = UI_SKINNED_BUTTON(object);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
176
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
177 if (GTK_OBJECT_CLASS (parent_class)->destroy)
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
178 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
179 }
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
180
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
181 static void ui_skinned_button_realize (GtkWidget *widget) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
182 g_return_if_fail (widget != NULL);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
183 g_return_if_fail (UI_SKINNED_IS_BUTTON(widget));
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
184 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
185 GdkWindowAttr attributes;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
186 gint attributes_mask;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
187
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
188 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
189
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
190 attributes.x = widget->allocation.x;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
191 attributes.y = widget->allocation.y;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
192 attributes.width = widget->allocation.width;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
193 attributes.height = widget->allocation.height;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
194 attributes.window_type = GDK_WINDOW_CHILD;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
195 attributes.event_mask = gtk_widget_get_events(widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
196 attributes.event_mask |= GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK;
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
197
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
198 if (button->type == TYPE_SMALL || button->type == TYPE_NOT_SET) {
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
199 widget->window = gtk_widget_get_parent_window (widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
200 g_object_ref (widget->window);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
201 attributes.wclass = GDK_INPUT_ONLY;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
202 attributes_mask = GDK_WA_X | GDK_WA_Y;
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
203 button->event_window = gdk_window_new (widget->window, &attributes, attributes_mask);
3052
b1b48ea20c16 Hooray, fix BadMatches
Tomasz Mon <desowin@gmail.com>
parents: 3036
diff changeset
204 GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
205 gdk_window_set_user_data(button->event_window, widget);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
206 } else {
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
207 attributes.visual = gtk_widget_get_visual(widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
208 attributes.colormap = gtk_widget_get_colormap(widget);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
209 attributes.wclass = GDK_INPUT_OUTPUT;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
210 attributes.event_mask |= GDK_EXPOSURE_MASK;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
211 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
212 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
213 GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
214 gdk_window_set_user_data(widget->window, widget);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
215 }
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
216
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
217 widget->style = gtk_style_attach(widget->style, widget->window);
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
218 }
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
219
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
220 static void ui_skinned_button_unrealize (GtkWidget *widget) {
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
221 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
222
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
223 if ( button->event_window != NULL )
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
224 {
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
225 gdk_window_set_user_data( button->event_window , NULL );
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
226 gdk_window_destroy( button->event_window );
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
227 button->event_window = NULL;
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
228 }
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
229
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
230 if (GTK_WIDGET_CLASS (parent_class)->unrealize)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
231 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
232 }
3052
b1b48ea20c16 Hooray, fix BadMatches
Tomasz Mon <desowin@gmail.com>
parents: 3036
diff changeset
233
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
234 static void ui_skinned_button_map (GtkWidget *widget)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
235 {
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
236 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
237
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
238 if (button->event_window != NULL)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
239 gdk_window_show (button->event_window);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
240
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
241 if (GTK_WIDGET_CLASS (parent_class)->map)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
242 (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
243 }
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
244
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
245 static void ui_skinned_button_unmap (GtkWidget *widget)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
246 {
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
247 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
248
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
249 if (button->event_window != NULL)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
250 gdk_window_hide (button->event_window);
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
251
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
252 if (GTK_WIDGET_CLASS (parent_class)->unmap)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
253 (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
254 }
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
255
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
256 static void ui_skinned_button_size_request(GtkWidget *widget, GtkRequisition *requisition) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
257 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(widget);
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
258 requisition->width = priv->w*(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
259 requisition->height = priv->h*(priv->scaled ? cfg.scale_factor : 1);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
260 }
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
261
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
262 static void ui_skinned_button_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
263 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
264 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
265 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
266 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
267 widget->allocation.y = ceil(widget->allocation.y*(priv->scaled ? cfg.scale_factor : 1));
3011
99865f696f13 don't use gtk_widget_set_uposition()
Tomasz Mon <desowin@gmail.com>
parents: 3007
diff changeset
268
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
269 if (GTK_WIDGET_REALIZED (widget))
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
270 {
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
271 if ( button->event_window != NULL )
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
272 gdk_window_move_resize(button->event_window, ceil(allocation->x*(priv->scaled ? cfg.scale_factor : 1)), ceil(allocation->y*(priv->scaled ? cfg.scale_factor : 1)), allocation->width, allocation->height);
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
273 else
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
274 gdk_window_move_resize(widget->window, ceil(allocation->x*(priv->scaled ? cfg.scale_factor : 1)), ceil(allocation->y*(priv->scaled ? cfg.scale_factor : 1)), allocation->width, allocation->height);
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
275 }
3011
99865f696f13 don't use gtk_widget_set_uposition()
Tomasz Mon <desowin@gmail.com>
parents: 3007
diff changeset
276
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
277 if (button->x + priv->move_x == ceil(widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1)))
3137
19908efce4e5 one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents: 3123
diff changeset
278 priv->move_x = 0;
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
279 if (button->y + priv->move_y == ceil(widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1)))
3137
19908efce4e5 one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents: 3123
diff changeset
280 priv->move_y = 0;
19908efce4e5 one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents: 3123
diff changeset
281
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
282 button->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
283 button->y = ceil(widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1));
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
284 }
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
285
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
286 static gboolean ui_skinned_button_expose(GtkWidget *widget, GdkEventExpose *event) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
287 g_return_val_if_fail (widget != NULL, FALSE);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
288 g_return_val_if_fail (UI_SKINNED_IS_BUTTON (widget), FALSE);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
289 g_return_val_if_fail (event != NULL, FALSE);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
290
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
291 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
292 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
4119
9d4b5cdae3ba oops, fix previous commit
Tomasz Mon <desowin@gmail.com>
parents: 4118
diff changeset
293 g_return_val_if_fail (priv->w > 0 && priv->h > 0, FALSE);
2843
91ef09fe7936 UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents: 2842
diff changeset
294
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
295 //TYPE_SMALL doesn't have its own face
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
296 if (button->type == TYPE_SMALL || button->type == TYPE_NOT_SET)
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
297 return FALSE;
2844
22da7cd0eca0 UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents: 2843
diff changeset
298
3058
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
299 /* paranoia */
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
300 if (button->event_window != NULL)
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
301 return FALSE;
766a0fd12f7d do not place GDK_INPUT_ONLY windows in widget->window, use a event_window field for them
Giacomo Lozito <james@develia.org>
parents: 3052
diff changeset
302
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
303 GdkPixbuf *obj;
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
304 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->w, priv->h);
3005
3db40ad79fd9 request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents: 2998
diff changeset
305
2998
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
306 switch (button->type) {
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
307 case TYPE_PUSH:
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4225
diff changeset
308 skin_draw_pixbuf(widget, aud_active_skin, obj,
2998
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
309 button->pressed ? priv->skin_index2 : priv->skin_index1,
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
310 button->pressed ? priv->px : priv->nx,
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
311 button->pressed ? priv->py : priv->ny,
2998
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
312 0, 0, priv->w, priv->h);
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
313 break;
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
314 case TYPE_TOGGLE:
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
315 if (button->inside)
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4225
diff changeset
316 skin_draw_pixbuf(widget, aud_active_skin, obj,
2998
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
317 button->pressed ? priv->skin_index2 : priv->skin_index1,
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
318 button->pressed ? priv->ppx : priv->pnx,
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
319 button->pressed ? priv->ppy : priv->pny,
2998
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
320 0, 0, priv->w, priv->h);
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
321 else
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4225
diff changeset
322 skin_draw_pixbuf(widget, aud_active_skin, obj,
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
323 button->pressed ? priv->skin_index2 : priv->skin_index1,
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
324 button->pressed ? priv->px : priv->nx,
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
325 button->pressed ? priv->py : priv->ny,
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
326 0, 0, priv->w, priv->h);
2998
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
327 break;
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
328 default:
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
329 break;
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
330 }
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
331
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
332 ui_skinned_widget_draw(widget, obj, priv->w, priv->h, priv->scaled);
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
333 g_object_unref(obj);
3031
229db6d72934 don't keep img
Tomasz Mon <desowin@gmail.com>
parents: 3011
diff changeset
334
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
335 return FALSE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
336 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
337
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
338 GtkWidget* ui_skinned_button_new () {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
339 UiSkinnedButton *button = g_object_new (ui_skinned_button_get_type (), NULL);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
340
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
341 return GTK_WIDGET(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
342 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
343
3005
3db40ad79fd9 request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents: 2998
diff changeset
344 void ui_skinned_push_button_setup(GtkWidget *button, GtkWidget *fixed, gint x, gint y, gint w, gint h, gint nx, gint ny, gint px, gint py, SkinPixmapId si) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
345
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
346 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
347 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
348 priv->w = w;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
349 priv->h = h;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
350 sbutton->x = x;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
351 sbutton->y = y;
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
352 priv->nx = nx;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
353 priv->ny = ny;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
354 priv->px = px;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
355 priv->py = py;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
356 sbutton->type = TYPE_PUSH;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
357 priv->skin_index1 = si;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
358 priv->skin_index2 = si;
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
359 priv->scaled = FALSE;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
360
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
361 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(button), sbutton->x, sbutton->y);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
362 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
363
3005
3db40ad79fd9 request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents: 2998
diff changeset
364 void ui_skinned_toggle_button_setup(GtkWidget *button, GtkWidget *fixed, gint x, gint y, gint w, gint h, gint nx, gint ny, gint px, gint py, gint pnx, gint pny, gint ppx, gint ppy, SkinPixmapId si) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
365
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
366 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
367 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
368 priv->w = w;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
369 priv->h = h;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
370 sbutton->x = x;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
371 sbutton->y = y;
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
372 priv->nx = nx;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
373 priv->ny = ny;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
374 priv->px = px;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
375 priv->py = py;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
376 priv->pnx = pnx;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
377 priv->pny = pny;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
378 priv->ppx = ppx;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
379 priv->ppy = ppy;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
380 sbutton->type = TYPE_TOGGLE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
381 priv->skin_index1 = si;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
382 priv->skin_index2 = si;
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
383 priv->scaled = FALSE;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
384
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
385 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(button), sbutton->x, sbutton->y);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
386 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
387
3005
3db40ad79fd9 request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents: 2998
diff changeset
388 void ui_skinned_small_button_setup(GtkWidget *button, GtkWidget *fixed, gint x, gint y, gint w, gint h) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
389
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
390 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
391 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
392 priv->w = w;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
393 priv->h = h;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
394 sbutton->x = x;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
395 sbutton->y = y;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
396 sbutton->type = TYPE_SMALL;
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
397 priv->scaled = FALSE;
2843
91ef09fe7936 UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents: 2842
diff changeset
398
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
399 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(button), sbutton->x, sbutton->y);
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
400 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
401
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
402 static void button_pressed(UiSkinnedButton *button) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
403 button->button_down = TRUE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
404 ui_skinned_button_update_state(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
405 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
406
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
407 static void button_released(UiSkinnedButton *button) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
408 button->button_down = FALSE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
409 if(button->hover) ui_skinned_button_clicked(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
410 ui_skinned_button_update_state(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
411 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
412
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
413 static void ui_skinned_button_update_state(UiSkinnedButton *button) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
414 ui_skinned_button_set_pressed(button, button->button_down);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
415 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
416
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
417 static void ui_skinned_button_set_pressed (UiSkinnedButton *button, gboolean pressed) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
418 if (pressed != button->pressed) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
419 button->pressed = pressed;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
420 gtk_widget_queue_draw(GTK_WIDGET(button));
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
421 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
422 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
423
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
424 static gboolean ui_skinned_button_button_press(GtkWidget *widget, GdkEventButton *event) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
425 UiSkinnedButton *button;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
426
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
427 if (event->type == GDK_BUTTON_PRESS) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
428 button = UI_SKINNED_BUTTON(widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
429
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
430 if (event->button == 1)
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
431 ui_skinned_button_pressed (button);
3600
aba660a4a15d Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents: 3368
diff changeset
432 else if (event->button == 3) {
aba660a4a15d Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents: 3368
diff changeset
433 event->x = event->x + button->x;
aba660a4a15d Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents: 3368
diff changeset
434 event->y = event->y + button->y;
aba660a4a15d Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents: 3368
diff changeset
435 return FALSE;
aba660a4a15d Pop up playback menu if right clicked over playback-control widgets
Tomasz Mon <desowin@gmail.com>
parents: 3368
diff changeset
436 }
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
437 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
438
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
439 return TRUE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
440 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
441
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
442 static gboolean ui_skinned_button_button_release(GtkWidget *widget, GdkEventButton *event) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
443 UiSkinnedButton *button;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
444 if (event->button == 1) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
445 button = UI_SKINNED_BUTTON(widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
446 ui_skinned_button_released(button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
447 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
448 return TRUE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
449 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
450
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
451 static void ui_skinned_button_pressed(UiSkinnedButton *button) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
452 g_return_if_fail(UI_SKINNED_IS_BUTTON(button));
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
453 g_signal_emit(button, button_signals[PRESSED], 0);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
454 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
455
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
456 static void ui_skinned_button_released(UiSkinnedButton *button) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
457 g_return_if_fail(UI_SKINNED_IS_BUTTON(button));
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
458 g_signal_emit(button, button_signals[RELEASED], 0);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
459 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
460
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
461 static void ui_skinned_button_clicked(UiSkinnedButton *button) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
462 g_return_if_fail(UI_SKINNED_IS_BUTTON(button));
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
463 button->inside = !button->inside;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
464 g_signal_emit(button, button_signals[CLICKED], 0);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
465 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
466
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
467 static gboolean ui_skinned_button_enter_notify(GtkWidget *widget, GdkEventCrossing *event) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
468 UiSkinnedButton *button;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
469
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
470 button = UI_SKINNED_BUTTON(widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
471 button->hover = TRUE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
472 if(button->button_down) ui_skinned_button_set_pressed(button, TRUE);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
473
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
474 return FALSE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
475 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
476
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
477 static gboolean ui_skinned_button_leave_notify(GtkWidget *widget, GdkEventCrossing *event) {
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
478 UiSkinnedButton *button;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
479
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
480 button = UI_SKINNED_BUTTON (widget);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
481 button->hover = FALSE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
482 if(button->button_down) ui_skinned_button_set_pressed(button, FALSE);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
483
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
484 return FALSE;
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
485 }
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
486
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
487 static void ui_skinned_button_toggle_scaled(UiSkinnedButton *button) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
488 GtkWidget *widget = GTK_WIDGET (button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
489 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
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
490 priv->scaled = !priv->scaled;
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
491
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
492 gtk_widget_set_size_request(widget, priv->w*(priv->scaled ? cfg.scale_factor : 1), priv->h*(priv->scaled ? cfg.scale_factor : 1));
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
493
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
494 gtk_widget_queue_draw(widget);
2822
9cfdff8a8b37 [svn] and of course I forgot new files
desowin
parents:
diff changeset
495 }
2833
1e97a0a228b7 [svn] - reduce number of redraws
desowin
parents: 2831
diff changeset
496
2842
c2622a939e9e rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents: 2834
diff changeset
497 static void ui_skinned_button_redraw(UiSkinnedButton *button) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
498 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
499 if (priv->move_x || priv->move_y)
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
500 gtk_fixed_move(GTK_FIXED(gtk_widget_get_parent(GTK_WIDGET(button))), GTK_WIDGET(button),
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
501 button->x+priv->move_x, button->y+priv->move_y);
2998
c200d6764e91 fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents: 2996
diff changeset
502
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
503 gtk_widget_queue_draw(GTK_WIDGET(button));
2833
1e97a0a228b7 [svn] - reduce number of redraws
desowin
parents: 2831
diff changeset
504 }
2853
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
505
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
506
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
507 void ui_skinned_set_push_button_data(GtkWidget *button, gint nx, gint ny, gint px, gint py) {
3006
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
508 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(button);
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
509 if (nx > -1) priv->nx = nx;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
510 if (ny > -1) priv->ny = ny;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
511 if (px > -1) priv->px = px;
3c4ed53a685f use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents: 3005
diff changeset
512 if (py > -1) priv->py = py;
3368
1521e3a16e40 queue widget draw after setting new data
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
513 gtk_widget_queue_draw(button);
2853
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
514 }
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
515
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
516 void ui_skinned_button_set_skin_index(GtkWidget *button, SkinPixmapId si) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
517 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
518 priv->skin_index1 = priv->skin_index2 = si;
2853
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
519 }
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
520
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
521 void ui_skinned_button_set_skin_index1(GtkWidget *button, SkinPixmapId si) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
522 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
523 priv->skin_index1 = si;
2853
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
524 }
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
525
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
526 void ui_skinned_button_set_skin_index2(GtkWidget *button, SkinPixmapId si) {
2995
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
527 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
934c1a79904f draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents: 2965
diff changeset
528 priv->skin_index2 = si;
2853
bec320cfcc12 use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents: 2844
diff changeset
529 }
2901
5ed0674fabd6 replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents: 2854
diff changeset
530
5ed0674fabd6 replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents: 2854
diff changeset
531 void ui_skinned_button_move_relative(GtkWidget *button, gint x, gint y) {
2965
f84d09bada0f correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents: 2964
diff changeset
532 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button);
f84d09bada0f correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents: 2964
diff changeset
533 priv->move_x += x;
f84d09bada0f correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents: 2964
diff changeset
534 priv->move_y += y;
2901
5ed0674fabd6 replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents: 2854
diff changeset
535 }