Mercurial > audlegacy
annotate src/audacious/ui_skinned_button.c @ 3123:f1c756f39e6c trunk audacious-1.4.0-DR1
Invoke "Plugins are not derived work" clause provided by GPL3.
| author | William Pitcock <nenolod@atheme-project.org> |
|---|---|
| date | Fri, 20 Jul 2007 09:09:58 -0500 |
| parents | 3b6d316f8b09 |
| children | 19908efce4e5 |
| 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 | |
|
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 | 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 | |
|
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 | 19 */ |
| 20 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
21 #include "widgets/widgetcore.h" |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
22 #include "ui_skinned_button.h" |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
23 #include "util.h" |
| 2822 | 24 |
| 3105 | 25 #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
|
26 typedef struct _UiSkinnedButtonPrivate UiSkinnedButtonPrivate; |
| 2822 | 27 |
|
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
28 static GMutex *mutex = NULL; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
29 |
|
2964
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
30 enum { |
| 3105 | 31 PRESSED, |
| 32 RELEASED, | |
| 33 CLICKED, | |
| 34 RIGHT_CLICKED, | |
| 35 DOUBLED, | |
| 36 REDRAW, | |
| 37 LAST_SIGNAL | |
|
2964
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
38 }; |
|
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
39 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
40 struct _UiSkinnedButtonPrivate { |
|
3006
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
41 //Skinned part |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
42 GdkGC *gc; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
43 gint w; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
44 gint h; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
45 SkinPixmapId skin_index1; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
46 SkinPixmapId skin_index2; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
47 GtkWidget *fixed; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
48 gboolean double_size; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
49 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
|
50 |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
51 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
|
52 //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
|
53 gint pnx, pny, ppx, ppy; |
| 2822 | 54 }; |
| 55 | |
| 56 | |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
57 static GtkWidgetClass *parent_class = NULL; |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
58 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
|
59 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
|
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); |
|
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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 static gint ui_skinned_button_expose(GtkWidget *widget,GdkEventExpose *event); |
| 2822 | 67 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
68 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
|
69 static void ui_skinned_button_update_state(UiSkinnedButton *button); |
| 2822 | 70 |
| 71 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
|
72 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
|
73 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
|
74 static void button_pressed(UiSkinnedButton *button); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
75 static void button_released(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_pressed(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_released(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_clicked(UiSkinnedButton *button); |
|
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
79 static void ui_skinned_button_set_pressed (UiSkinnedButton *button, gboolean pressed); |
| 2834 | 80 |
|
2842
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_redraw(UiSkinnedButton *button); |
| 2822 | 86 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
87 GType ui_skinned_button_get_type() { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
88 static GType button_type = 0; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
89 if (!button_type) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
90 static const GTypeInfo button_info = { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
91 sizeof (UiSkinnedButtonClass), |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
92 NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
93 NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
94 (GClassInitFunc) ui_skinned_button_class_init, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
95 NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
96 NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
97 sizeof (UiSkinnedButton), |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
98 0, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
99 (GInstanceInitFunc) ui_skinned_button_init, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
100 }; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
101 button_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedButton", &button_info, 0); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
102 } |
| 2822 | 103 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
104 return button_type; |
| 2822 | 105 } |
| 106 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
107 static void ui_skinned_button_class_init (UiSkinnedButtonClass *klass) { |
|
2996
a2eb970ca669
bring back UiSkinnedTextboxPrivate
Tomasz Mon <desowin@gmail.com>
parents:
2995
diff
changeset
|
108 GObjectClass *gobject_class; |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
109 GtkObjectClass *object_class; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
110 GtkWidgetClass *widget_class; |
| 2822 | 111 |
|
2996
a2eb970ca669
bring back UiSkinnedTextboxPrivate
Tomasz Mon <desowin@gmail.com>
parents:
2995
diff
changeset
|
112 gobject_class = G_OBJECT_CLASS(klass); |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
113 object_class = (GtkObjectClass*) klass; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
114 widget_class = (GtkWidgetClass*) klass; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
115 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
|
116 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
117 object_class->destroy = ui_skinned_button_destroy; |
| 2822 | 118 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
119 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
|
120 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
|
121 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
|
122 widget_class->unmap = ui_skinned_button_unmap; |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
123 widget_class->expose_event = ui_skinned_button_expose; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 widget_class->leave_notify_event = ui_skinned_button_leave_notify; |
| 2822 | 130 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
131 klass->pressed = button_pressed; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
132 klass->released = button_released; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
133 klass->clicked = NULL; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
134 klass->right_clicked = NULL; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
135 klass->doubled = ui_skinned_button_toggle_doublesize; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
136 klass->redraw = ui_skinned_button_redraw; |
| 2822 | 137 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
138 button_signals[PRESSED] = |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
139 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
|
140 G_STRUCT_OFFSET (UiSkinnedButtonClass, pressed), NULL, NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
141 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 2822 | 142 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
143 button_signals[RELEASED] = |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
144 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
|
145 G_STRUCT_OFFSET (UiSkinnedButtonClass, released), NULL, NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
146 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 2822 | 147 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
148 button_signals[CLICKED] = |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
149 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
|
150 G_STRUCT_OFFSET (UiSkinnedButtonClass, clicked), NULL, NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
151 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 2822 | 152 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
153 button_signals[RIGHT_CLICKED] = |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
154 g_signal_new ("right-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
|
155 G_STRUCT_OFFSET (UiSkinnedButtonClass, right_clicked), NULL, NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
156 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
|
2964
7926d46872c8
right click on mainwin_about brings menu
Tomasz Mon <desowin@gmail.com>
parents:
2963
diff
changeset
|
157 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
158 button_signals[DOUBLED] = |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
159 g_signal_new ("toggle-double-size", 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
|
160 G_STRUCT_OFFSET (UiSkinnedButtonClass, doubled), NULL, NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
161 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
| 2822 | 162 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
163 button_signals[REDRAW] = |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
164 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
|
165 G_STRUCT_OFFSET (UiSkinnedButtonClass, redraw), NULL, NULL, |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
166 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
|
2829
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2828
diff
changeset
|
167 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
168 g_type_class_add_private (gobject_class, sizeof (UiSkinnedButtonPrivate)); |
| 2822 | 169 } |
| 170 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
171 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
|
172 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
173 mutex = g_mutex_new(); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
174 button->inside = FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
175 button->type = TYPE_NOT_SET; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
176 priv->move_x = 0; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
177 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
|
178 button->event_window = NULL; |
| 2822 | 179 } |
| 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_destroy (GtkObject *object) { |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
182 UiSkinnedButton *button; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
183 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
184 g_return_if_fail (object != NULL); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
185 g_return_if_fail (UI_SKINNED_IS_BUTTON (object)); |
| 2822 | 186 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
187 button = UI_SKINNED_BUTTON(object); |
| 2822 | 188 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
189 if (GTK_OBJECT_CLASS (parent_class)->destroy) |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
190 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); |
| 2822 | 191 } |
| 192 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
193 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
|
194 g_return_if_fail (widget != NULL); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
195 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
|
196 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
197 GdkWindowAttr attributes; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
198 gint attributes_mask; |
| 2822 | 199 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
200 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); |
| 2822 | 201 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
202 attributes.x = widget->allocation.x; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
203 attributes.y = widget->allocation.y; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
204 attributes.width = widget->allocation.width; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
205 attributes.height = widget->allocation.height; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
206 attributes.window_type = GDK_WINDOW_CHILD; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
207 attributes.event_mask = gtk_widget_get_events(widget); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
208 attributes.event_mask |= GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK; |
| 2822 | 209 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
210 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
|
211 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
|
212 g_object_ref (widget->window); |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
213 attributes.wclass = GDK_INPUT_ONLY; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
214 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
|
215 button->event_window = gdk_window_new (widget->window, &attributes, attributes_mask); |
| 3052 | 216 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
|
217 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
|
218 } 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
|
219 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
|
220 attributes.colormap = gtk_widget_get_colormap(widget); |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
221 attributes.wclass = GDK_INPUT_OUTPUT; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
222 attributes.event_mask |= GDK_EXPOSURE_MASK; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 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
|
227 } |
| 2822 | 228 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
229 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
|
230 } |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
231 |
|
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
|
232 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
|
233 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
|
234 |
|
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 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
|
236 { |
|
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 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
|
238 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
|
239 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
|
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 |
|
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 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
|
243 (* 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
|
244 } |
| 3052 | 245 |
|
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
|
246 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
|
247 { |
|
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 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
|
249 |
|
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 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
|
251 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
|
252 |
|
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 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
|
254 (* 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
|
255 } |
|
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
|
256 |
|
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
|
257 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
|
258 { |
|
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
|
259 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
|
260 |
|
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
|
261 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
|
262 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
|
263 |
|
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
|
264 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
|
265 (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); |
| 2822 | 266 } |
| 267 | |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
268 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
|
269 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(widget); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
270 requisition->width = priv->w*(1+priv->double_size); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
271 requisition->height = priv->h*(1+priv->double_size); |
| 2822 | 272 } |
| 273 | |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
274 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
|
275 g_mutex_lock(mutex); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
276 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
277 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
278 widget->allocation = *allocation; |
|
3011
99865f696f13
don't use gtk_widget_set_uposition()
Tomasz Mon <desowin@gmail.com>
parents:
3007
diff
changeset
|
279 widget->allocation.x *= (1+priv->double_size); |
|
99865f696f13
don't use gtk_widget_set_uposition()
Tomasz Mon <desowin@gmail.com>
parents:
3007
diff
changeset
|
280 widget->allocation.y *= (1+priv->double_size); |
|
99865f696f13
don't use gtk_widget_set_uposition()
Tomasz Mon <desowin@gmail.com>
parents:
3007
diff
changeset
|
281 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
282 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
|
283 { |
|
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
|
284 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
|
285 gdk_window_move_resize(button->event_window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height); |
|
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
|
286 else |
|
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
|
287 gdk_window_move_resize(widget->window, allocation->x*(1+priv->double_size), allocation->y*(1+priv->double_size), allocation->width, allocation->height); |
|
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
|
288 } |
|
3011
99865f696f13
don't use gtk_widget_set_uposition()
Tomasz Mon <desowin@gmail.com>
parents:
3007
diff
changeset
|
289 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
290 button->x = widget->allocation.x/(priv->double_size ? 2 : 1); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
291 button->y = widget->allocation.y/(priv->double_size ? 2 : 1); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
292 priv->move_x = 0; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
293 priv->move_y = 0; |
| 2822 | 294 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
295 g_mutex_unlock(mutex); |
| 2822 | 296 } |
| 297 | |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
298 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
|
299 g_return_val_if_fail (widget != NULL, FALSE); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
300 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
|
301 g_return_val_if_fail (event != NULL, FALSE); |
| 2822 | 302 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
303 UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
304 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
305 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
306 //TYPE_SMALL doesn't have its own face |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
307 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
|
308 return FALSE; |
|
2844
22da7cd0eca0
UiSkinnedButton can now work as SButton
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
309 |
|
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
|
310 /* 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
|
311 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
|
312 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
|
313 |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
314 GdkPixmap *obj; |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
315 GdkGC *gc; |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
316 obj = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
317 gc = gdk_gc_new(obj); |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
318 |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
319 switch (button->type) { |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
320 case TYPE_PUSH: |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
321 skin_draw_pixmap(bmp_active_skin, obj, gc, |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
322 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
|
323 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
|
324 button->pressed ? priv->py : priv->ny, |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
325 0, 0, priv->w, priv->h); |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
326 break; |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
327 case TYPE_TOGGLE: |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
328 if (button->inside) |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
329 skin_draw_pixmap(bmp_active_skin, obj, gc, |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
330 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
|
331 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
|
332 button->pressed ? priv->ppy : priv->pny, |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
333 0, 0, priv->w, priv->h); |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
334 else |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
335 skin_draw_pixmap(bmp_active_skin, obj, gc, |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
336 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
|
337 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
|
338 button->pressed ? priv->py : priv->ny, |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
339 0, 0, priv->w, priv->h); |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
340 break; |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
341 default: |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
342 break; |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
343 } |
|
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
344 |
|
3077
4b076ad636e6
use GdkPixmaps for doublesizing
Tomasz Mon <desowin@gmail.com>
parents:
3060
diff
changeset
|
345 GdkPixmap *image = NULL; |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
346 |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
347 if (priv->double_size) { |
|
3077
4b076ad636e6
use GdkPixmaps for doublesizing
Tomasz Mon <desowin@gmail.com>
parents:
3060
diff
changeset
|
348 image = create_dblsize_pixmap(obj); |
|
4b076ad636e6
use GdkPixmaps for doublesizing
Tomasz Mon <desowin@gmail.com>
parents:
3060
diff
changeset
|
349 } else { |
|
4b076ad636e6
use GdkPixmaps for doublesizing
Tomasz Mon <desowin@gmail.com>
parents:
3060
diff
changeset
|
350 image = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); |
| 3031 | 351 gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->w, priv->h); |
|
3077
4b076ad636e6
use GdkPixmaps for doublesizing
Tomasz Mon <desowin@gmail.com>
parents:
3060
diff
changeset
|
352 } |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
353 |
|
2998
c200d6764e91
fix expose events, thanks to giacomo
Tomasz Mon <desowin@gmail.com>
parents:
2996
diff
changeset
|
354 g_object_unref(obj); |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
355 |
| 3031 | 356 gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
357 priv->w*(1+priv->double_size), priv->h*(1+priv->double_size)); |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
358 |
|
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
359 g_object_unref(gc); |
| 3031 | 360 g_object_unref(image); |
| 361 | |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
362 return FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
363 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
364 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
365 GtkWidget* ui_skinned_button_new () { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
366 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
|
367 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
368 return GTK_WIDGET(button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
369 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
370 |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
371 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
|
372 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
373 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
374 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
375 priv->w = w; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
376 priv->h = h; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
377 sbutton->x = x; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
378 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
|
379 priv->nx = nx; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
380 priv->ny = ny; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
381 priv->px = px; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
382 priv->py = py; |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
383 sbutton->type = TYPE_PUSH; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
384 priv->skin_index1 = si; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
385 priv->skin_index2 = si; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
386 priv->fixed = fixed; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
387 priv->double_size = FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
388 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
389 gtk_fixed_put(GTK_FIXED(priv->fixed),GTK_WIDGET(button), sbutton->x, sbutton->y); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
390 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
391 |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
392 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
|
393 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
394 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
395 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
396 priv->w = w; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
397 priv->h = h; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
398 sbutton->x = x; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
399 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
|
400 priv->nx = nx; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
401 priv->ny = ny; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
402 priv->px = px; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
403 priv->py = py; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
404 priv->pnx = pnx; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
405 priv->pny = pny; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
406 priv->ppx = ppx; |
|
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
407 priv->ppy = ppy; |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
408 sbutton->type = TYPE_TOGGLE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
409 priv->skin_index1 = si; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
410 priv->skin_index2 = si; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
411 priv->fixed = fixed; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
412 priv->double_size = FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
413 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
414 gtk_fixed_put(GTK_FIXED(priv->fixed),GTK_WIDGET(button), sbutton->x, sbutton->y); |
|
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 |
|
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
2998
diff
changeset
|
417 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
|
418 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
419 UiSkinnedButton *sbutton = UI_SKINNED_BUTTON(button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
420 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE(sbutton); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
421 priv->w = w; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
422 priv->h = h; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
423 sbutton->x = x; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
424 sbutton->y = y; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
425 sbutton->type = TYPE_SMALL; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
426 priv->fixed = fixed; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
427 priv->double_size = FALSE; |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
428 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
429 gtk_fixed_put(GTK_FIXED(priv->fixed),GTK_WIDGET(button), sbutton->x, sbutton->y); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
430 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
431 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
432 static void button_pressed(UiSkinnedButton *button) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
433 button->button_down = TRUE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
434 ui_skinned_button_update_state(button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
435 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
436 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
437 static void button_released(UiSkinnedButton *button) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
438 button->button_down = FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
439 if(button->hover) ui_skinned_button_clicked(button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
440 ui_skinned_button_update_state(button); |
|
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 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
443 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
|
444 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
|
445 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
446 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
447 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
|
448 if (pressed != button->pressed) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
449 button->pressed = pressed; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
450 gtk_widget_queue_draw(GTK_WIDGET(button)); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
451 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
452 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
453 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
454 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
|
455 UiSkinnedButton *button; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
456 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
457 if (event->type == GDK_BUTTON_PRESS) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
458 button = UI_SKINNED_BUTTON(widget); |
|
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 if (event->button == 1) |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
461 ui_skinned_button_pressed (button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
462 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
463 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
464 return TRUE; |
|
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_button_release(GtkWidget *widget, GdkEventButton *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 if (event->button == 1) { |
|
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 ui_skinned_button_released(button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
472 } else if (event->button == 3) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
473 g_signal_emit(widget, button_signals[RIGHT_CLICKED], 0); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
474 } |
|
2843
91ef09fe7936
UiSkinnedButton can now work as TButton
Tomasz Mon <desowin@gmail.com>
parents:
2842
diff
changeset
|
475 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
476 return TRUE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
477 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
478 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
479 static void ui_skinned_button_pressed(UiSkinnedButton *button) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
480 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
|
481 g_signal_emit(button, button_signals[PRESSED], 0); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
482 } |
|
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 static void ui_skinned_button_released(UiSkinnedButton *button) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
485 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
|
486 g_signal_emit(button, button_signals[RELEASED], 0); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
487 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
488 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
489 static void ui_skinned_button_clicked(UiSkinnedButton *button) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
490 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
|
491 button->inside = !button->inside; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
492 g_signal_emit(button, button_signals[CLICKED], 0); |
|
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 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
495 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
|
496 UiSkinnedButton *button; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
497 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
498 button = UI_SKINNED_BUTTON(widget); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
499 button->hover = TRUE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
500 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
|
501 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
502 return FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
503 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
504 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
505 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
|
506 UiSkinnedButton *button; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
507 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
508 button = UI_SKINNED_BUTTON (widget); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
509 button->hover = FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
510 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
|
511 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
512 return FALSE; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
513 } |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
514 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
515 static void ui_skinned_button_toggle_doublesize(UiSkinnedButton *button) { |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
516 GtkWidget *widget = GTK_WIDGET (button); |
|
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->double_size = !priv->double_size; |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
519 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
520 gtk_widget_set_size_request(widget, priv->w*(1+priv->double_size), priv->h*(1+priv->double_size)); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
521 |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
522 gtk_widget_queue_draw(widget); |
| 2822 | 523 } |
| 2833 | 524 |
|
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2834
diff
changeset
|
525 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
|
526 g_mutex_lock(mutex); |
|
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 if (priv->move_x || priv->move_y) |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
529 gtk_fixed_move(GTK_FIXED(priv->fixed), GTK_WIDGET(button), 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
|
530 |
|
2995
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
531 gtk_widget_queue_draw(GTK_WIDGET(button)); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
532 g_mutex_unlock(mutex); |
| 2833 | 533 } |
|
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
534 |
|
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 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 if (py > -1) priv->py = py; |
|
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
542 } |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
543 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
544 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
|
545 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
546 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
|
547 } |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
548 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
549 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
|
550 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
551 priv->skin_index1 = si; |
|
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
552 } |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
553 |
|
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
554 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
|
555 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
934c1a79904f
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2965
diff
changeset
|
556 priv->skin_index2 = si; |
|
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2844
diff
changeset
|
557 } |
|
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2854
diff
changeset
|
558 |
|
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2854
diff
changeset
|
559 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
|
560 g_mutex_lock(mutex); |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
561 UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
562 priv->move_x += x; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
563 priv->move_y += y; |
|
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2964
diff
changeset
|
564 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
|
565 } |
