annotate src/audacious/ui_skinned_window.c @ 3147:f8a449aa8a6f trunk

branch merge
author Tomasz Mon <desowin@gmail.com>
date Mon, 23 Jul 2007 10:39:01 +0200
parents f1c756f39e6c
children 018b37cf0730
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
1 /*
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
2 * Audacious: A cross-platform multimedia player
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
3 * Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk>
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
4 *
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 3068
diff changeset
7 * the Free Software Foundation; under version 3 of the License.
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
8 *
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
12 * GNU General Public License for more details.
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
13 *
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 3068
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.
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
19 */
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
20
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
21 #include "platform/smartinclude.h"
2496
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
22 #include "widgets/widgetcore.h"
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
23
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
24 #include <gtk/gtkmain.h>
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
25 #include <glib-object.h>
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
26 #include <glib/gmacros.h>
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
27 #include <gtk/gtkmarshal.h>
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
28 #include <gtk/gtkwindow.h>
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
29
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
30 #include "main.h"
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
31 #include "dock.h"
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
32 #include "ui_skinned_window.h"
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
33 #include "ui_skinned_cursor.h"
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
34
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
35 static void ui_skinned_window_class_init(SkinnedWindowClass *klass);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
36 static void ui_skinned_window_init(GtkWidget *widget);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
37 static GtkWindowClass *parent = NULL;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
38
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
39 GType
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
40 ui_skinned_window_get_type(void)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
41 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
42 static GType window_type = 0;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
43
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
44 if (!window_type)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
45 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
46 static const GTypeInfo window_info =
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
47 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
48 sizeof (SkinnedWindowClass),
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
49 NULL, /* base_init */
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
50 NULL, /* base_finalize */
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
51 (GClassInitFunc) ui_skinned_window_class_init,
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
52 NULL, /* class_finalize */
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
53 NULL, /* class_data */
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
54 sizeof (SkinnedWindow),
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
55 0, /* n_preallocs */
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
56 (GInstanceInitFunc) ui_skinned_window_init
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
57 };
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
58
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
59 window_type =
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
60 g_type_register_static (GTK_TYPE_WINDOW, "SkinnedWindow",
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
61 &window_info, 0);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
62 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
63
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
64 return window_type;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
65 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
66
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
67 static gboolean
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
68 ui_skinned_window_configure(GtkWidget *widget,
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
69 GdkEventConfigure *event)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
70 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
71 GtkWidgetClass *widget_class;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
72 SkinnedWindow *window = SKINNED_WINDOW(widget);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
73
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
74 widget_class = (GtkWidgetClass*) parent;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
75
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
76 if (widget_class->configure_event != NULL)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
77 widget_class->configure_event(widget, event);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
78
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
79 window->x = event->x;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
80 window->y = event->y;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
81
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
82 return FALSE;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
83 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
84
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
85 static gboolean
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
86 ui_skinned_window_motion_notify_event(GtkWidget *widget,
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
87 GdkEventMotion *event)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
88 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
89 GtkWidgetClass *widget_class;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
90
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
91 widget_class = (GtkWidgetClass*) parent;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
92
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
93 if (widget_class->motion_notify_event != NULL)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
94 widget_class->motion_notify_event(widget, event);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
95
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
96 if (dock_is_moving(GTK_WINDOW(widget)))
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
97 dock_move_motion(GTK_WINDOW(widget), event);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
98
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
99 return FALSE;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
100 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
101
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
102 static void
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
103 ui_skinned_window_class_init(SkinnedWindowClass *klass)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
104 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
105 GtkWidgetClass *widget_class;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
106
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
107 widget_class = (GtkWidgetClass*) klass;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
108
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
109 parent = gtk_type_class(gtk_window_get_type());
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
110
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
111 widget_class->configure_event = ui_skinned_window_configure;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
112 widget_class->motion_notify_event = ui_skinned_window_motion_notify_event;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
113 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
114
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
115 void
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
116 ui_skinned_window_hide(SkinnedWindow *window)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
117 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
118 g_return_if_fail(SKINNED_CHECK_WINDOW(window));
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
119
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
120 gtk_window_get_position(GTK_WINDOW(window), &window->x, &window->y);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
121 gtk_widget_hide(GTK_WIDGET(window));
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
122 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
123
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
124 void
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
125 ui_skinned_window_show(SkinnedWindow *window)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
126 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
127 g_return_if_fail(SKINNED_CHECK_WINDOW(window));
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
128
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
129 gtk_window_move(GTK_WINDOW(window), window->x, window->y);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
130 gtk_widget_show_all(GTK_WIDGET(window));
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
131 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
132
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
133 static void
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
134 ui_skinned_window_init(GtkWidget *widget)
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
135 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
136 SkinnedWindow *window;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
137 window = SKINNED_WINDOW(widget);
2651
4d5e6a8717dd [svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents: 2530
diff changeset
138 window->x = -1;
4d5e6a8717dd [svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents: 2530
diff changeset
139 window->y = -1;
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
140 }
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
141
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
142 GtkWidget *
3068
c5189bc4100b Refactor skinned window code.
William Pitcock <nenolod@atheme-project.org>
parents: 3067
diff changeset
143 ui_skinned_window_new(const gchar *wmclass_name)
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
144 {
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
145 GtkWidget *widget = g_object_new(ui_skinned_window_get_type(), NULL);
3063
0ac3c3bc5d4a Set GTK+ window types.
William Pitcock <nenolod@atheme-project.org>
parents: 2840
diff changeset
146 GtkWindow *window = GTK_WINDOW(widget);
0ac3c3bc5d4a Set GTK+ window types.
William Pitcock <nenolod@atheme-project.org>
parents: 2840
diff changeset
147
3068
c5189bc4100b Refactor skinned window code.
William Pitcock <nenolod@atheme-project.org>
parents: 3067
diff changeset
148 window->type = SKINNED_WINDOW_TYPE;
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
149
2515
319b10203d7c [svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents: 2496
diff changeset
150 if (wmclass_name)
319b10203d7c [svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents: 2496
diff changeset
151 gtk_window_set_wmclass(GTK_WINDOW(widget), wmclass_name, "Audacious");
319b10203d7c [svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents: 2496
diff changeset
152
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
153 gtk_widget_add_events(GTK_WIDGET(widget),
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
154 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK |
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
155 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
156 GDK_SCROLL_MASK | GDK_KEY_PRESS_MASK |
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
157 GDK_VISIBILITY_NOTIFY_MASK);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
158 gtk_widget_realize(GTK_WIDGET(widget));
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
159
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
160 dock_window_list = dock_window_set_decorated(dock_window_list,
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
161 GTK_WINDOW(widget), cfg.show_wm_decorations);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
162 gtk_widget_set_app_paintable(GTK_WIDGET(widget), TRUE);
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
163
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
164 ui_skinned_cursor_set(GTK_WIDGET(widget));
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
165
2525
ddd127429fc6 [svn] - move the GC into the SkinnedWindow class.
nenolod
parents: 2515
diff changeset
166 SKINNED_WINDOW(widget)->gc = gdk_gc_new(widget->window);
ddd127429fc6 [svn] - move the GC into the SkinnedWindow class.
nenolod
parents: 2515
diff changeset
167
2821
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
168 /* GtkFixed hasn't got its GdkWindow, this means that it can be used to
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
169 display widgets while the logo below will be displayed anyway;
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
170 however fixed positions are not that great, cause the button sizes may (will)
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
171 vary depending on the gtk style used, so it's not possible to center
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
172 them unless a fixed width and heigth is forced (and this may bring to cutted
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
173 text if someone, i.e., uses a big font for gtk widgets);
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
174 other types of container most likely have their GdkWindow, this simply
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
175 means that the logo must be drawn on the container widget, instead of the
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
176 window; otherwise, it won't be displayed correctly */
ade60a2c52fb [svn] beginning of widgetcore rewrite
desowin
parents: 2651
diff changeset
177 SKINNED_WINDOW(widget)->fixed = gtk_fixed_new();
2840
53dd8641b4d1 fix flickering
Tomasz Mon <desowin@gmail.com>
parents: 2821
diff changeset
178 gtk_container_add(GTK_CONTAINER(widget), GTK_WIDGET(SKINNED_WINDOW(widget)->fixed));
2494
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
179 return widget;
59661bd074b4 [svn] Try to put some skinned window code in a common place.
nenolod
parents:
diff changeset
180 }
2496
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
181
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
182 void
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
183 ui_skinned_window_widgetlist_associate(GtkWidget * widget, Widget * w)
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
184 {
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
185 SkinnedWindow *sw;
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
186
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
187 g_return_if_fail(widget != NULL);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
188 g_return_if_fail(w != NULL);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
189
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
190 sw = SKINNED_WINDOW(widget);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
191
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
192 sw->widget_list = g_list_append(sw->widget_list, w);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
193 }
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
194
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
195 void
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
196 ui_skinned_window_widgetlist_dissociate(GtkWidget * widget, Widget * w)
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
197 {
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
198 SkinnedWindow *sw;
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
199
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
200 g_return_if_fail(widget != NULL);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
201 g_return_if_fail(w != NULL);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
202
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
203 sw = SKINNED_WINDOW(widget);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
204
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
205 sw->widget_list = g_list_remove(sw->widget_list, w);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
206 }
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
207
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
208 gboolean
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
209 ui_skinned_window_widgetlist_contained(GtkWidget * widget, gint x, gint y)
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
210 {
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
211 SkinnedWindow *sw;
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
212 GList *l;
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
213
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
214 g_return_val_if_fail(widget != NULL, FALSE);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
215
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
216 sw = SKINNED_WINDOW(widget);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
217
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
218 for (l = sw->widget_list; l != NULL; l = g_list_next(l))
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
219 {
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
220 Widget *w = WIDGET(l->data);
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
221
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
222 if (widget_contains(WIDGET(w), x, y) == TRUE)
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
223 return TRUE;
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
224 }
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
225
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
226 return FALSE;
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
227 }
71bee08db1c6 [svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents: 2494
diff changeset
228