Mercurial > audlegacy
annotate src/audacious/ui_skinned_button.c @ 2965:f84d09bada0f trunk
correct _move_relative() and _resize_relative()
| author | Tomasz Mon <desowin@gmail.com> |
|---|---|
| date | Mon, 02 Jul 2007 11:18:25 +0200 |
| parents | 7926d46872c8 |
| children | 934c1a79904f |
| rev | line source |
|---|---|
| 2822 | 1 /* |
| 2 * Audacious - a cross-platform multimedia player | |
| 3 * Copyright (c) 2007 Audacious development team. | |
| 4 * | |
| 5 * This program is free software; you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License as published by | |
|
2918
4e71092ab29b
remove evil GPL3 upgrade phrase
Tomasz Mon <desowin@gmail.com>
parents:
2910
diff
changeset
|
7 * the Free Software Foundation; under version 2 of the License. |
| 2822 | 8 * |
| 9 * This program is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with this program; if not, write to the Free Software | |
| 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 17 */ | |
| 18 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
19 #include "widgets/widgetcore.h" |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
20 #include "ui_skinned_button.h" |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
21 #include "util.h" |
| 2822 | 22 |
| 23 #include <gtk/gtkmain.h> | |
| 24 #include <gtk/gtkmarshal.h> | |
| 25 #include <gtk/gtkimage.h> | |
| 26 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
27 #define UI_SKINNED_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UI_TYPE_SKINNED_BUTTON, UiSkinnedButtonPrivate)) |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
28 typedef struct _UiSkinnedButtonPrivate UiSkinnedButtonPrivate; |
| 2822 | 29 |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
30 static GMutex *mutex = NULL; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
31 |
|
2964
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
32 enum { |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
33 PRESSED, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
34 RELEASED, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
35 CLICKED, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
36 RIGHT_CLICKED, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
37 DOUBLED, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
38 REDRAW, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
39 LAST_SIGNAL |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
40 }; |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
41 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
42 struct _UiSkinnedButtonPrivate { |
| 2822 | 43 //Skinned part |
| 44 GtkWidget *image; | |
| 45 GdkGC *gc; | |
| 46 gint w; | |
| 47 gint h; | |
| 48 SkinPixmapId skin_index1; | |
| 49 SkinPixmapId skin_index2; | |
| 50 GtkWidget *fixed; | |
| 2827 | 51 gboolean double_size; |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
52 gint move_x, move_y; |
| 2822 | 53 }; |
| 54 | |
| 55 | |
| 56 static GtkBinClass *parent_class = NULL; | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
57 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
|
58 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
|
59 static GObject* ui_skinned_button_constructor(GType type, guint n_construct_properties, GObjectConstructParam *construct_params); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
60 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
|
61 static void ui_skinned_button_realize(GtkWidget *widget); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
62 static void ui_skinned_button_unrealize(GtkWidget *widget); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
63 static void ui_skinned_button_map(GtkWidget *widget); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
64 static void ui_skinned_button_unmap(GtkWidget *widget); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
65 static gint ui_skinned_button_expose(GtkWidget *widget,GdkEventExpose *event); |
| 2822 | 66 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
67 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
|
68 static void ui_skinned_button_update_state(UiSkinnedButton *button); |
| 2822 | 69 |
| 70 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
|
71 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
|
72 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
|
73 static void button_pressed(UiSkinnedButton *button); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
74 static void button_released(UiSkinnedButton *button); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 static void ui_skinned_button_set_pressed (UiSkinnedButton *button, gboolean pressed); |
| 2834 | 79 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
80 static void ui_skinned_button_add(GtkContainer *container, GtkWidget *widget); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
81 static void ui_skinned_button_toggle_doublesize(UiSkinnedButton *button); |
| 2822 | 82 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
83 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
|
84 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
|
85 static void ui_skinned_button_paint(UiSkinnedButton *button); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
86 static void ui_skinned_button_redraw(UiSkinnedButton *button); |
| 2822 | 87 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
88 GType ui_skinned_button_get_type (void) { |
| 2822 | 89 static GType button_type = 0; |
| 90 | |
| 91 if (!button_type) { | |
| 92 static const GTypeInfo button_info = { | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
93 sizeof (UiSkinnedButtonClass), |
| 2822 | 94 NULL, /* base_init */ |
| 95 NULL, /* base_finalize */ | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
96 (GClassInitFunc) ui_skinned_button_class_init, |
| 2822 | 97 NULL, /* class_finalize */ |
| 98 NULL, /* class_data */ | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
99 sizeof (UiSkinnedButton), |
| 2822 | 100 16, /* n_preallocs */ |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
101 (GInstanceInitFunc) ui_skinned_button_init, |
| 2822 | 102 }; |
| 103 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
104 button_type = g_type_register_static (GTK_TYPE_BIN, "UiSkinnedButton", &button_info, 0); |
| 2822 | 105 } |
| 106 return button_type; | |
| 107 } | |
| 108 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
109 static void ui_skinned_button_class_init (UiSkinnedButtonClass *klass) { |
| 2822 | 110 GObjectClass *gobject_class; |
| 111 GtkObjectClass *object_class; | |
| 112 GtkWidgetClass *widget_class; | |
| 113 GtkContainerClass *container_class; | |
| 114 | |
| 115 gobject_class = G_OBJECT_CLASS(klass); | |
| 116 object_class = (GtkObjectClass*)klass; | |
| 117 widget_class = (GtkWidgetClass*)klass; | |
| 118 container_class = (GtkContainerClass*)klass; | |
| 119 | |
| 120 parent_class = g_type_class_peek_parent(klass); | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
121 gobject_class->constructor = ui_skinned_button_constructor; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
122 object_class->destroy = ui_skinned_button_destroy; |
| 2822 | 123 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
124 widget_class->realize = ui_skinned_button_realize; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
125 widget_class->unrealize = ui_skinned_button_unrealize; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
126 widget_class->map = ui_skinned_button_map; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
127 widget_class->unmap = ui_skinned_button_unmap; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
128 widget_class->size_allocate = ui_skinned_button_size_allocate; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
129 widget_class->expose_event = ui_skinned_button_expose; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
130 widget_class->button_press_event = ui_skinned_button_button_press; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
131 widget_class->button_release_event = ui_skinned_button_button_release; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
132 widget_class->enter_notify_event = ui_skinned_button_enter_notify; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
133 widget_class->leave_notify_event = ui_skinned_button_leave_notify; |
| 2822 | 134 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
135 container_class->add = ui_skinned_button_add; |
| 2822 | 136 |
| 137 klass->pressed = button_pressed; | |
| 138 klass->released = button_released; | |
| 139 klass->clicked = NULL; | |
|
2964
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
140 klass->right_clicked = NULL; |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
141 klass->doubled = ui_skinned_button_toggle_doublesize; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
142 klass->redraw = ui_skinned_button_redraw; |
| 2822 | 143 |
| 144 button_signals[PRESSED] = | |
| 145 g_signal_new ("pressed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
146 G_STRUCT_OFFSET (UiSkinnedButtonClass, pressed), NULL, NULL, |
| 2822 | 147 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 148 | |
| 149 button_signals[RELEASED] = | |
| 150 g_signal_new ("released", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
151 G_STRUCT_OFFSET (UiSkinnedButtonClass, released), NULL, NULL, |
| 2822 | 152 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 153 | |
| 154 button_signals[CLICKED] = | |
| 155 g_signal_new ("clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
156 G_STRUCT_OFFSET (UiSkinnedButtonClass, clicked), NULL, NULL, |
| 2822 | 157 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 158 | |
|
2964
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
159 button_signals[RIGHT_CLICKED] = |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
160 g_signal_new ("right-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
161 G_STRUCT_OFFSET (UiSkinnedButtonClass, right_clicked), NULL, NULL, |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
162 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
163 |
| 2822 | 164 button_signals[DOUBLED] = |
| 2827 | 165 g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
166 G_STRUCT_OFFSET (UiSkinnedButtonClass, doubled), NULL, NULL, |
| 2822 | 167 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 168 | |
|
2829
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2828
diff
changeset
|
169 button_signals[REDRAW] = |
|
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2828
diff
changeset
|
170 g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
171 G_STRUCT_OFFSET (UiSkinnedButtonClass, redraw), NULL, NULL, |
|
2829
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2828
diff
changeset
|
172 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
|
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2828
diff
changeset
|
173 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
174 g_type_class_add_private (gobject_class, sizeof (UiSkinnedButtonPrivate)); |
| 2822 | 175 } |
| 176 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
177 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
|
178 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
179 mutex = g_mutex_new(); |
| 2822 | 180 priv->image = gtk_image_new(); |
| 2833 | 181 button->redraw = TRUE; |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
182 button->inside = FALSE; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
183 button->type = TYPE_NOT_SET; |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
184 priv->move_x = 0; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
185 priv->move_y = 0; |
| 2833 | 186 |
| 2822 | 187 g_object_set (priv->image, "visible", TRUE, NULL); |
| 188 gtk_container_add(GTK_CONTAINER(GTK_WIDGET(button)), priv->image); | |
| 189 | |
| 190 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS); | |
| 191 GTK_WIDGET_SET_FLAGS (button, GTK_NO_WINDOW); | |
| 192 } | |
| 193 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
194 static void ui_skinned_button_destroy (GtkObject *object) { |
| 2822 | 195 (*GTK_OBJECT_CLASS (parent_class)->destroy) (object); |
| 196 } | |
| 197 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
198 static GObject* ui_skinned_button_constructor(GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { |
| 2822 | 199 GObject *object = (*G_OBJECT_CLASS (parent_class)->constructor)(type, n_construct_properties, construct_params); |
| 200 | |
| 201 return object; | |
| 202 } | |
| 203 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
204 static void ui_skinned_button_realize (GtkWidget *widget) { |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
205 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
| 2822 | 206 GdkWindowAttr attrib; |
| 207 | |
| 208 GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); | |
| 209 | |
| 210 attrib.window_type = GDK_WINDOW_CHILD; | |
| 211 attrib.x = widget->allocation.x; | |
| 212 attrib.y = widget->allocation.y; | |
| 213 attrib.width = widget->allocation.width; | |
| 214 attrib.height = widget->allocation.height; | |
| 215 attrib.wclass = GDK_INPUT_ONLY; | |
| 216 attrib.event_mask = gtk_widget_get_events (widget); | |
| 217 attrib.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); | |
| 218 | |
| 219 widget->window = gtk_widget_get_parent_window(widget); | |
| 220 g_object_ref(widget->window); | |
| 221 | |
| 222 button->event_window = gdk_window_new(gtk_widget_get_parent_window(widget), &attrib, GDK_WA_X | GDK_WA_Y); | |
| 223 gdk_window_set_user_data (button->event_window, button); | |
| 224 } | |
| 225 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
226 static void ui_skinned_button_unrealize(GtkWidget *widget) { |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
227 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
| 2822 | 228 |
| 229 if (button->event_window) { | |
| 230 gdk_window_set_user_data (button->event_window, NULL); | |
| 231 gdk_window_destroy (button->event_window); | |
| 232 button->event_window = NULL; | |
| 233 } | |
| 234 | |
| 235 GTK_WIDGET_CLASS (parent_class)->unrealize (widget); | |
| 236 } | |
| 237 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
238 static void ui_skinned_button_map(GtkWidget *widget) { |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
239 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
240 g_return_if_fail (UI_IS_SKINNED_BUTTON (widget)); |
| 2822 | 241 GTK_WIDGET_CLASS (parent_class)->map(widget); |
| 242 gdk_window_show (button->event_window); | |
| 243 } | |
| 244 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
245 static void ui_skinned_button_unmap (GtkWidget *widget) { |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
246 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
247 g_return_if_fail (UI_IS_SKINNED_BUTTON(widget)); |
| 2822 | 248 |
| 249 if (button->event_window) | |
| 250 gdk_window_hide (button->event_window); | |
| 251 | |
| 252 GTK_WIDGET_CLASS (parent_class)->unmap (widget); | |
| 253 } | |
| 254 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
255 static gboolean ui_skinned_button_expose(GtkWidget *widget, GdkEventExpose *event) { |
|
2963
74a2471f8eb7
fix ui_skinned_button_expose(); don't call ui_skinned_button_paint() directly
Tomasz Mon <desowin@gmail.com>
parents:
2918
diff
changeset
|
256 if (GTK_WIDGET_DRAWABLE (widget)) { |
|
74a2471f8eb7
fix ui_skinned_button_expose(); don't call ui_skinned_button_paint() directly
Tomasz Mon <desowin@gmail.com>
parents:
2918
diff
changeset
|
257 ui_skinned_button_paint(UI_SKINNED_BUTTON(widget)); |
| 2822 | 258 (*GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event); |
|
2963
74a2471f8eb7
fix ui_skinned_button_expose(); don't call ui_skinned_button_paint() directly
Tomasz Mon <desowin@gmail.com>
parents:
2918
diff
changeset
|
259 } |
| 2822 | 260 |
| 261 return FALSE; | |
| 262 } | |
| 263 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
264 GtkWidget* ui_skinned_button_new () { |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
265 return g_object_new (UI_TYPE_SKINNED_BUTTON, NULL); |
| 2822 | 266 } |
| 267 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
268 void ui_skinned_push_button_setup(GtkWidget *button, GtkWidget *fixed, GdkPixmap *parent, GdkGC *gc, gint x, gint y, gint w, gint h, gint nx, gint ny, gint px, gint py, SkinPixmapId si) { |
| 2822 | 269 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
270 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
271 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton); |
| 2822 | 272 priv->gc = gc; |
| 273 priv->w = w; | |
| 274 priv->h = h; | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
275 sbutton->x = x; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
276 sbutton->y = y; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
277 sbutton->nx = nx; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
278 sbutton->ny = ny; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
279 sbutton->px = px; |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
280 sbutton->py = py; |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
281 sbutton->type = TYPE_PUSH; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
282 priv->skin_index1 = si; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
283 priv->skin_index2 = si; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
284 priv->fixed = fixed; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
285 priv->double_size = FALSE; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
286 |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
287 gtk_widget_set_size_request(button, priv->w, priv->h); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
288 gtk_fixed_put(GTK_FIXED(priv->fixed),GTK_WIDGET(button), sbutton->x, sbutton->y); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
289 } |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
290 |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
291 void ui_skinned_toggle_button_setup(GtkWidget *button, GtkWidget *fixed, GdkPixmap *parent, GdkGC *gc, 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) { |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
292 |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
293 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
294 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
295 priv->gc = gc; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
296 priv->w = w; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
297 priv->h = h; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
298 sbutton->x = x; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
299 sbutton->y = y; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
300 sbutton->nx = nx; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
301 sbutton->ny = ny; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
302 sbutton->px = px; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
303 sbutton->py = py; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
304 sbutton->pnx = pnx; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
305 sbutton->pny = pny; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
306 sbutton->ppx = ppx; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
307 sbutton->ppy = ppy; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
308 sbutton->type = TYPE_TOGGLE; |
| 2822 | 309 priv->skin_index1 = si; |
| 310 priv->skin_index2 = si; | |
| 311 priv->fixed = fixed; | |
| 2827 | 312 priv->double_size = FALSE; |
| 2822 | 313 |
| 314 gtk_widget_set_size_request(button, priv->w, priv->h); | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
315 gtk_fixed_put(GTK_FIXED(priv->fixed),GTK_WIDGET(button), sbutton->x, sbutton->y); |
| 2822 | 316 } |
| 317 | |
|
2844
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
318 void ui_skinned_small_button_setup(GtkWidget *button, GtkWidget *fixed, GdkPixmap *parent, GdkGC *gc, gint x, gint y, gint w, gint h) { |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
319 |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
320 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button); |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
321 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton); |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
322 priv->gc = gc; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
323 priv->w = w; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
324 priv->h = h; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
325 sbutton->x = x; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
326 sbutton->y = y; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
327 sbutton->type = TYPE_SMALL; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
328 priv->fixed = fixed; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
329 priv->double_size = FALSE; |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
330 |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
331 gtk_widget_set_size_request(button, priv->w, priv->h); |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
332 gtk_fixed_put(GTK_FIXED(priv->fixed),GTK_WIDGET(button), sbutton->x, sbutton->y); |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
333 } |
|
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
334 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
335 static void ui_skinned_button_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
336 g_mutex_lock(mutex); |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
337 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
| 2910 | 338 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
| 2822 | 339 GtkAllocation child_alloc; |
| 340 | |
| 341 widget->allocation = *allocation; | |
| 342 if (GTK_BIN (button)->child) { //image should fill whole widget | |
| 343 child_alloc.x = widget->allocation.x; | |
| 344 child_alloc.y = widget->allocation.y; | |
| 345 child_alloc.width = MAX (1, widget->allocation.width); | |
| 346 child_alloc.height = MAX (1, widget->allocation.height); | |
| 347 | |
| 348 gtk_widget_size_allocate (GTK_BIN (button)->child, &child_alloc); | |
| 349 } | |
| 2828 | 350 |
| 351 if (GDK_IS_WINDOW(button->event_window)) | |
| 352 gdk_window_move_resize (button->event_window, widget->allocation.x, widget->allocation.y, | |
| 353 widget->allocation.width, widget->allocation.height); | |
| 2910 | 354 |
| 355 button->x = widget->allocation.x/(priv->double_size ? 2 : 1); | |
| 356 button->y = widget->allocation.y/(priv->double_size ? 2 : 1); | |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
357 priv->move_x = 0; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
358 priv->move_y = 0; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
359 |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
360 g_mutex_unlock(mutex); |
| 2822 | 361 } |
| 362 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
363 static void button_pressed(UiSkinnedButton *button) { |
| 2822 | 364 button->button_down = TRUE; |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
365 ui_skinned_button_update_state(button); |
| 2822 | 366 } |
| 367 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
368 static void button_released(UiSkinnedButton *button) { |
| 2822 | 369 button->button_down = FALSE; |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
370 if(button->hover) ui_skinned_button_clicked(button); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
371 ui_skinned_button_update_state(button); |
| 2822 | 372 } |
| 373 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
374 static void ui_skinned_button_update_state(UiSkinnedButton *button) { |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
375 ui_skinned_button_set_pressed(button, button->button_down); |
| 2822 | 376 } |
| 377 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
378 static void ui_skinned_button_set_pressed (UiSkinnedButton *button, gboolean pressed) { |
| 2822 | 379 if (pressed != button->pressed) { |
| 380 button->pressed = pressed; | |
| 2833 | 381 button->redraw = TRUE; |
|
2963
74a2471f8eb7
fix ui_skinned_button_expose(); don't call ui_skinned_button_paint() directly
Tomasz Mon <desowin@gmail.com>
parents:
2918
diff
changeset
|
382 gtk_widget_queue_draw(GTK_WIDGET(button)); |
| 2822 | 383 } |
| 384 } | |
| 385 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
386 static gboolean 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
|
387 UiSkinnedButton *button; |
| 2822 | 388 |
| 389 if (event->type == GDK_BUTTON_PRESS) { | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
390 button = UI_SKINNED_BUTTON(widget); |
| 2822 | 391 |
| 392 if (event->button == 1) | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
393 ui_skinned_button_pressed (button); |
| 2822 | 394 } |
| 395 | |
| 396 return TRUE; | |
| 397 } | |
| 398 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
399 static gboolean 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
|
400 UiSkinnedButton *button; |
| 2822 | 401 if (event->button == 1) { |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
402 button = UI_SKINNED_BUTTON(widget); |
| 2833 | 403 button->redraw = TRUE; |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
404 ui_skinned_button_released(button); |
|
2964
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
405 } else if (event->button == 3) { |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
406 g_signal_emit(widget, button_signals[RIGHT_CLICKED], 0); |
| 2822 | 407 } |
| 408 | |
| 409 return TRUE; | |
| 410 } | |
| 411 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
412 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
|
413 g_return_if_fail(UI_IS_SKINNED_BUTTON(button)); |
| 2822 | 414 g_signal_emit(button, button_signals[PRESSED], 0); |
| 415 } | |
| 416 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
417 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
|
418 g_return_if_fail(UI_IS_SKINNED_BUTTON(button)); |
| 2822 | 419 g_signal_emit(button, button_signals[RELEASED], 0); |
| 420 } | |
| 421 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
422 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
|
423 g_return_if_fail(UI_IS_SKINNED_BUTTON(button)); |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
424 button->inside = !button->inside; |
| 2822 | 425 g_signal_emit(button, button_signals[CLICKED], 0); |
| 426 } | |
| 427 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
428 static gboolean 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
|
429 UiSkinnedButton *button; |
| 2822 | 430 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
431 button = UI_SKINNED_BUTTON(widget); |
| 2822 | 432 button->hover = TRUE; |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
433 if(button->button_down) ui_skinned_button_set_pressed(button, TRUE); |
| 2822 | 434 |
| 435 return FALSE; | |
| 436 } | |
| 437 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
438 static gboolean 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
|
439 UiSkinnedButton *button; |
| 2822 | 440 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
441 button = UI_SKINNED_BUTTON (widget); |
| 2822 | 442 button->hover = FALSE; |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
443 if(button->button_down) ui_skinned_button_set_pressed(button, FALSE); |
| 2822 | 444 |
| 445 return FALSE; | |
| 446 } | |
| 447 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
448 static void ui_skinned_button_add(GtkContainer *container, GtkWidget *widget) { |
| 2822 | 449 GTK_CONTAINER_CLASS (parent_class)->add(container, widget); |
| 450 } | |
| 451 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
452 static void ui_skinned_button_toggle_doublesize(UiSkinnedButton *button) { |
| 2827 | 453 GtkWidget *widget = GTK_WIDGET (button); |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
454 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
| 2827 | 455 priv->double_size = !priv->double_size; |
| 456 | |
| 457 gtk_widget_set_size_request(widget, priv->w*(1+priv->double_size), priv->h*(1+priv->double_size)); | |
| 458 gtk_widget_set_uposition(widget, button->x*(1+priv->double_size), button->y*(1+priv->double_size)); | |
| 459 | |
| 2833 | 460 button->redraw = TRUE; |
|
2963
74a2471f8eb7
fix ui_skinned_button_expose(); don't call ui_skinned_button_paint() directly
Tomasz Mon <desowin@gmail.com>
parents:
2918
diff
changeset
|
461 gtk_widget_queue_draw(widget); |
| 2822 | 462 } |
| 463 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
464 static void ui_skinned_button_paint(UiSkinnedButton *button) { |
| 2822 | 465 GtkWidget *widget = GTK_WIDGET (button); |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
466 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
| 2822 | 467 |
|
2844
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
468 //TYPE_SMALL doesn't have its own face |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
469 if (button->type == TYPE_SMALL || button->type == TYPE_NOT_SET) |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
470 return; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
471 |
| 2833 | 472 if (button->redraw == TRUE) { |
| 473 button->redraw = FALSE; | |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
474 |
| 2833 | 475 GdkPixmap *obj; |
| 476 obj = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); | |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
477 switch (button->type) { |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
478 case TYPE_PUSH: |
| 2854 | 479 skin_draw_pixmap(bmp_active_skin, obj, priv->gc, |
| 480 button->pressed ? priv->skin_index2 : priv->skin_index1, | |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
481 button->pressed ? button->px : button->nx, |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
482 button->pressed ? button->py : button->ny, |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
483 0, 0, priv->w, priv->h); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
484 break; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
485 case TYPE_TOGGLE: |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
486 if (button->inside) |
| 2854 | 487 skin_draw_pixmap(bmp_active_skin, obj, priv->gc, |
| 488 button->pressed ? priv->skin_index2 : priv->skin_index1, | |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
489 button->pressed ? button->ppx : button->pnx, |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
490 button->pressed ? button->ppy : button->pny, |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
491 0, 0, priv->w, priv->h); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
492 else |
| 2854 | 493 skin_draw_pixmap(bmp_active_skin, obj, priv->gc, |
| 494 button->pressed ? priv->skin_index2 : priv->skin_index1, | |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
495 button->pressed ? button->px : button->nx, |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
496 button->pressed ? button->py : button->ny, |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
497 0, 0, priv->w, priv->h); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
498 break; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
499 default: |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
500 break; |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
501 } |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
502 |
| 2833 | 503 if(priv->double_size) { |
| 504 GdkImage *img, *img2x; | |
| 505 img = gdk_drawable_get_image(obj, 0, 0, priv->w, priv->h); | |
| 506 img2x = create_dblsize_image(img); | |
| 507 gtk_image_set(GTK_IMAGE(priv->image), img2x, NULL); | |
| 508 g_object_unref(img2x); | |
| 509 g_object_unref(img); | |
| 510 } else | |
| 511 gtk_image_set_from_pixmap(GTK_IMAGE(priv->image), obj, NULL); | |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
512 |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
513 g_object_unref(obj); |
|
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
514 gtk_widget_queue_resize(widget); |
| 2833 | 515 } |
| 2822 | 516 } |
| 2833 | 517 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
518 static void ui_skinned_button_redraw(UiSkinnedButton *button) { |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
519 g_mutex_lock(mutex); |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
520 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
521 if (priv->move_x || priv->move_y) |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
522 gtk_fixed_move(GTK_FIXED(priv->fixed), GTK_WIDGET(button), button->x+priv->move_x, button->y+priv->move_y); |
| 2833 | 523 button->redraw = TRUE; |
|
2963
74a2471f8eb7
fix ui_skinned_button_expose(); don't call ui_skinned_button_paint() directly
Tomasz Mon <desowin@gmail.com>
parents:
2918
diff
changeset
|
524 gtk_widget_queue_draw(GTK_WIDGET(button)); |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
525 g_mutex_unlock(mutex); |
| 2833 | 526 } |
|
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
527 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
528 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
529 void ui_skinned_set_push_button_data(GtkWidget *button, gint nx, gint ny, gint px, gint py) { |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
530 UiSkinnedButton *b = UI_SKINNED_BUTTON(button); |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
531 if (nx > -1) b->nx = nx; |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
532 if (ny > -1) b->ny = ny; |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
533 if (px > -1) b->px = px; |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
534 if (py > -1) b->py = py; |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
535 } |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
536 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
537 void ui_skinned_button_set_skin_index(GtkWidget *button, SkinPixmapId si) { |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
538 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
539 priv->skin_index1 = priv->skin_index2 = si; |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
540 } |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
541 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
542 void ui_skinned_button_set_skin_index1(GtkWidget *button, SkinPixmapId si) { |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
543 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
544 priv->skin_index1 = si; |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
545 } |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
546 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
547 void ui_skinned_button_set_skin_index2(GtkWidget *button, SkinPixmapId si) { |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
548 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
549 priv->skin_index2 = si; |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
550 } |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2854
diff
changeset
|
551 |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2854
diff
changeset
|
552 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
|
553 g_mutex_lock(mutex); |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
554 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
555 priv->move_x += x; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
556 priv->move_y += y; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
557 g_mutex_unlock(mutex); |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2854
diff
changeset
|
558 } |
