annotate src/gtkexpander.c @ 13374:14d1892e0932

[gaim-migrate @ 15747] Fix the showstopper bug about autoreconnect being too aggressive "If you try to connect to an account and it fails, switching your global status to Offline will not prevent the autoreconnect from trying to re-connect" committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 02 Mar 2006 05:58:21 +0000
parents 0b4923aee31d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /* GTK - The GIMP Toolkit
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 * Copyright (C) 2003 Sun Microsystems, Inc.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * modify it under the terms of the GNU Library General Public
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * Library General Public License for more details.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 * You should have received a copy of the GNU Library General Public
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * License along with this library; if not, write to the
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * Boston, MA 02111-1307, USA.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 * Authors:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 * Mark McLoughlin <mark@skynet.ie>
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 */
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 /*
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 #include <config.h>
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 */
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 #include <gtk/gtkversion.h>
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 #if !GTK_CHECK_VERSION(2,4,0)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 #include "gtkexpander.h"
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 #include <gtk/gtklabel.h>
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 #include <gtk/gtkcontainer.h>
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
34 #include <gtk/gtkmarshal.h>
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 #include <gtk/gtkmain.h>
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 #include <gtk/gtkprivate.h>
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 #include <gdk/gdkkeysyms.h>
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
39 #define P_(x) (x)
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41 #define DEFAULT_EXPANDER_SIZE 10
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 #define DEFAULT_EXPANDER_SPACING 2
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 enum
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 PROP_0,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47 PROP_EXPANDED,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48 PROP_LABEL,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 PROP_USE_UNDERLINE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50 PROP_USE_MARKUP,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
51 PROP_SPACING,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
52 PROP_LABEL_WIDGET
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 };
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55 struct _GtkExpanderPrivate
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57 GtkWidget *label_widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58 GdkWindow *event_window;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59 gint spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
60
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
61 GtkExpanderStyle expander_style;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62 guint animation_timeout;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
63
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
64 guint expanded : 1;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 guint use_underline : 1;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
66 guint use_markup : 1;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67 guint button_down : 1;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68 guint prelight : 1;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69 };
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71 static void gtk_expander_class_init (GtkExpanderClass *klass);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72 static void gtk_expander_init (GtkExpander *expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
73
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74 static void gtk_expander_set_property (GObject *object,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 guint prop_id,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 const GValue *value,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77 GParamSpec *pspec);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78 static void gtk_expander_get_property (GObject *object,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 guint prop_id,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 GValue *value,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81 GParamSpec *pspec);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
83 static void gtk_expander_finalize (GObject *object);
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
84
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
85 static void gtk_expander_destroy (GtkObject *object);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 static void gtk_expander_realize (GtkWidget *widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 static void gtk_expander_unrealize (GtkWidget *widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89 static void gtk_expander_size_request (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90 GtkRequisition *requisition);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
91 static void gtk_expander_size_allocate (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92 GtkAllocation *allocation);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 static void gtk_expander_map (GtkWidget *widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94 static void gtk_expander_unmap (GtkWidget *widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
95 static gboolean gtk_expander_expose (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
96 GdkEventExpose *event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97 static gboolean gtk_expander_button_press (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98 GdkEventButton *event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 static gboolean gtk_expander_button_release (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 GdkEventButton *event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 static gboolean gtk_expander_enter_notify (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102 GdkEventCrossing *event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
103 static gboolean gtk_expander_leave_notify (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104 GdkEventCrossing *event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 static gboolean gtk_expander_focus (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106 GtkDirectionType direction);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107 static void gtk_expander_grab_notify (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 gboolean was_grabbed);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109 static void gtk_expander_state_changed (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 GtkStateType previous_state);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
112 static void gtk_expander_add (GtkContainer *container,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
113 GtkWidget *widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114 static void gtk_expander_remove (GtkContainer *container,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115 GtkWidget *widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116 static void gtk_expander_forall (GtkContainer *container,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117 gboolean include_internals,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
118 GtkCallback callback,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119 gpointer callback_data);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121 static void gtk_expander_activate (GtkExpander *expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
122
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
123 static void get_expander_bounds (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
124 GdkRectangle *rect);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
125
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126 static GtkBinClass *parent_class = NULL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
127
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
128 GType
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129 gtk_expander_get_type (void)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131 static GType expander_type = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
132
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
133 if (!expander_type)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
135 static const GTypeInfo expander_info =
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
137 sizeof (GtkExpanderClass),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
138 NULL, /* base_init */
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
139 NULL, /* base_finalize */
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 (GClassInitFunc) gtk_expander_class_init,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141 NULL, /* class_finalize */
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
142 NULL, /* class_data */
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 sizeof (GtkExpander),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144 0, /* n_preallocs */
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
145 (GInstanceInitFunc) gtk_expander_init,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
146 };
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
147
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
148 expander_type = g_type_register_static (GTK_TYPE_BIN,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
149 "GtkExpander",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
150 &expander_info, 0);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 return expander_type;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 gtk_expander_class_init (GtkExpanderClass *klass)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159 GObjectClass *gobject_class;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160 GtkObjectClass *object_class;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161 GtkWidgetClass *widget_class;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162 GtkContainerClass *container_class;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
163
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 parent_class = g_type_class_peek_parent (klass);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
166 gobject_class = (GObjectClass *) klass;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 object_class = (GtkObjectClass *) klass;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 widget_class = (GtkWidgetClass *) klass;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 container_class = (GtkContainerClass *) klass;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 gobject_class->set_property = gtk_expander_set_property;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 gobject_class->get_property = gtk_expander_get_property;
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
173 gobject_class->finalize = gtk_expander_finalize;
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175 object_class->destroy = gtk_expander_destroy;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 widget_class->realize = gtk_expander_realize;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 widget_class->unrealize = gtk_expander_unrealize;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179 widget_class->size_request = gtk_expander_size_request;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180 widget_class->size_allocate = gtk_expander_size_allocate;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181 widget_class->map = gtk_expander_map;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
182 widget_class->unmap = gtk_expander_unmap;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
183 widget_class->expose_event = gtk_expander_expose;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
184 widget_class->button_press_event = gtk_expander_button_press;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
185 widget_class->button_release_event = gtk_expander_button_release;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186 widget_class->enter_notify_event = gtk_expander_enter_notify;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187 widget_class->leave_notify_event = gtk_expander_leave_notify;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188 widget_class->focus = gtk_expander_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189 widget_class->grab_notify = gtk_expander_grab_notify;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190 widget_class->state_changed = gtk_expander_state_changed;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
192 container_class->add = gtk_expander_add;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193 container_class->remove = gtk_expander_remove;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
194 container_class->forall = gtk_expander_forall;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
195
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 klass->activate = gtk_expander_activate;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198 g_object_class_install_property (gobject_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
199 PROP_EXPANDED,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
200 g_param_spec_boolean ("expanded",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 P_("Expanded"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202 P_("Whether the expander has been opened to reveal the child widget"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
203 FALSE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206 g_object_class_install_property (gobject_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 PROP_LABEL,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 g_param_spec_string ("label",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 P_("Label"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 P_("Text of the expander's label"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211 NULL,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214 g_object_class_install_property (gobject_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215 PROP_USE_UNDERLINE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 g_param_spec_boolean ("use_underline",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217 P_("Use underline"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
218 P_("If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
219 FALSE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
220 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222 g_object_class_install_property (gobject_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
223 PROP_USE_MARKUP,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
224 g_param_spec_boolean ("use_markup",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
225 P_("Use markup"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
226 P_("The text of the label includes XML markup. See pango_parse_markup()"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227 FALSE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
228 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
230 g_object_class_install_property (gobject_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
231 PROP_SPACING,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232 g_param_spec_int ("spacing",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233 P_("Spacing"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 P_("Space to put between the label and the child"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235 0,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236 G_MAXINT,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 0,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238 G_PARAM_READWRITE));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
239
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
240 g_object_class_install_property (gobject_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
241 PROP_LABEL_WIDGET,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
242 g_param_spec_object ("label_widget",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243 P_("Label widget"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244 P_("A widget to display in place of the usual expander label"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
245 GTK_TYPE_WIDGET,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
246 G_PARAM_READWRITE));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
247
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
248 gtk_widget_class_install_style_property (widget_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
249 g_param_spec_int ("expander-size",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
250 P_("Expander Size"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
251 P_("Size of the expander arrow"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
252 0,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
253 G_MAXINT,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
254 DEFAULT_EXPANDER_SIZE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255 G_PARAM_READABLE));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
257 gtk_widget_class_install_style_property (widget_class,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
258 g_param_spec_int ("expander-spacing",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259 P_("Indicator Spacing"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
260 P_("Spacing around expander arrow"),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
261 0,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
262 G_MAXINT,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
263 DEFAULT_EXPANDER_SPACING,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
264 G_PARAM_READABLE));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
265
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
266 widget_class->activate_signal =
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
267 g_signal_new ("activate",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
268 G_TYPE_FROM_CLASS (gobject_class),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
269 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
270 G_STRUCT_OFFSET (GtkExpanderClass, activate),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
271 NULL, NULL,
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
272 gtk_marshal_VOID__VOID,
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
273 G_TYPE_NONE, 0);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
274 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
275
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
276 static void
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
277 gtk_expander_finalize (GObject *obj)
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
278 {
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
279 GtkExpander *self = (GtkExpander *)obj;
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
280
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
281 g_free(self->priv);
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
282
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
283 G_OBJECT_CLASS(parent_class)->finalize (obj);
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
284 }
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
285
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
286 static void
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
287 gtk_expander_init (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
288 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
289 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
290
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
291 expander->priv = priv = g_new0(GtkExpanderPrivate, 1);
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
292
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
293 GTK_WIDGET_SET_FLAGS (expander, GTK_CAN_FOCUS);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
294 GTK_WIDGET_SET_FLAGS (expander, GTK_NO_WINDOW);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
295
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
296 priv->label_widget = NULL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
297 priv->event_window = NULL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
298 priv->spacing = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
299
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
300 priv->expander_style = GTK_EXPANDER_COLLAPSED;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
301 priv->animation_timeout = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
302
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
303 priv->expanded = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
304 priv->use_underline = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
305 priv->use_markup = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
306 priv->button_down = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
307 priv->prelight = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
308 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
309
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
310 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
311 gtk_expander_set_property (GObject *object,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
312 guint prop_id,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
313 const GValue *value,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
314 GParamSpec *pspec)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
315 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
316 GtkExpander *expander = GTK_EXPANDER (object);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
317
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
318 switch (prop_id)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
319 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
320 case PROP_EXPANDED:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
321 gtk_expander_set_expanded (expander, g_value_get_boolean (value));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
322 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
323 case PROP_LABEL:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
324 gtk_expander_set_label (expander, g_value_get_string (value));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
325 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
326 case PROP_USE_UNDERLINE:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
327 gtk_expander_set_use_underline (expander, g_value_get_boolean (value));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
328 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
329 case PROP_USE_MARKUP:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
330 gtk_expander_set_use_markup (expander, g_value_get_boolean (value));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
331 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
332 case PROP_SPACING:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
333 gtk_expander_set_spacing (expander, g_value_get_int (value));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
334 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
335 case PROP_LABEL_WIDGET:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
336 gtk_expander_set_label_widget (expander, g_value_get_object (value));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
337 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
338 default:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
339 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
340 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
341 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
342 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
343
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
344 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
345 gtk_expander_get_property (GObject *object,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
346 guint prop_id,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
347 GValue *value,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
348 GParamSpec *pspec)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
349 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
350 GtkExpander *expander = GTK_EXPANDER (object);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
351 GtkExpanderPrivate *priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
352
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
353 switch (prop_id)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
354 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
355 case PROP_EXPANDED:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
356 g_value_set_boolean (value, priv->expanded);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
357 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
358 case PROP_LABEL:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
359 g_value_set_string (value, gtk_expander_get_label (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
360 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
361 case PROP_USE_UNDERLINE:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
362 g_value_set_boolean (value, priv->use_underline);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
363 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
364 case PROP_USE_MARKUP:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
365 g_value_set_boolean (value, priv->use_markup);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
366 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
367 case PROP_SPACING:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
368 g_value_set_int (value, priv->spacing);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
369 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
370 case PROP_LABEL_WIDGET:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
371 g_value_set_object (value,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
372 priv->label_widget ?
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
373 G_OBJECT (priv->label_widget) : NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
374 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
375 default:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
376 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
377 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
378 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
379 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
380
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
381 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
382 gtk_expander_destroy (GtkObject *object)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
383 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
384 GtkExpanderPrivate *priv = GTK_EXPANDER (object)->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
385
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
386 if (priv->animation_timeout)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
387 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
388 g_source_remove (priv->animation_timeout);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
389 priv->animation_timeout = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
390 }
11752
0b4923aee31d [gaim-migrate @ 14043]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11735
diff changeset
391
11735
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
392 GTK_OBJECT_CLASS (parent_class)->destroy (object);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
393 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
394
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
395 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
396 gtk_expander_realize (GtkWidget *widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
397 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
398 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
399 GdkWindowAttr attributes;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
400 gint attributes_mask;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
401 gint border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
402 GdkRectangle expander_rect;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
403
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
404 priv = GTK_EXPANDER (widget)->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
405 GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
406
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
407 border_width = GTK_CONTAINER (widget)->border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
408
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
409 get_expander_bounds (GTK_EXPANDER (widget), &expander_rect);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
410
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
411 attributes.window_type = GDK_WINDOW_CHILD;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
412 attributes.x = widget->allocation.x + border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
413 attributes.y = expander_rect.y;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
414 attributes.width = MAX (widget->allocation.width - 2 * border_width, 1);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
415 attributes.height = expander_rect.width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
416 attributes.wclass = GDK_INPUT_ONLY;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
417 attributes.event_mask = gtk_widget_get_events (widget) |
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
418 GDK_BUTTON_PRESS_MASK |
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
419 GDK_BUTTON_RELEASE_MASK |
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
420 GDK_ENTER_NOTIFY_MASK |
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
421 GDK_LEAVE_NOTIFY_MASK;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
422
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
423 attributes_mask = GDK_WA_X | GDK_WA_Y;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
424
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
425 widget->window = gtk_widget_get_parent_window (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
426 g_object_ref (widget->window);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
427
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
428 priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
429 &attributes, attributes_mask);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
430 gdk_window_set_user_data (priv->event_window, widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
431
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
432 widget->style = gtk_style_attach (widget->style, widget->window);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
433 gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
434 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
435
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
436 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
437 gtk_expander_unrealize (GtkWidget *widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
438 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
439 GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
440
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
441 if (priv->event_window)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
442 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
443 gdk_window_set_user_data (priv->event_window, NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
444 gdk_window_destroy (priv->event_window);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
445 priv->event_window = NULL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
446 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
447
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
448 GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
449 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
450
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
451 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
452 gtk_expander_size_request (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
453 GtkRequisition *requisition)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
454 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
455 GtkExpander *expander;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
456 GtkBin *bin;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
457 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
458 gint border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
459 gint expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
460 gint expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
461 gboolean interior_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
462 gint focus_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
463 gint focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
464
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
465 bin = GTK_BIN (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
466 expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
467 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
468
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
469 border_width = GTK_CONTAINER (widget)->border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
470
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
471 gtk_widget_style_get (widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
472 "interior-focus", &interior_focus,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
473 "focus-line-width", &focus_width,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
474 "focus-padding", &focus_pad,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
475 "expander-size", &expander_size,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
476 "expander-spacing", &expander_spacing,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
477 NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
478
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
479 requisition->width = expander_size + 2 * expander_spacing +
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
480 2 * focus_width + 2 * focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
481 requisition->height = interior_focus ? (2 * focus_width + 2 * focus_pad) : 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
482
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
483 if (priv->label_widget && GTK_WIDGET_VISIBLE (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
484 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
485 GtkRequisition label_requisition;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
486
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
487 gtk_widget_size_request (priv->label_widget, &label_requisition);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
488
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
489 requisition->width += label_requisition.width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
490 requisition->height += label_requisition.height;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
491 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
492
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
493 requisition->height = MAX (expander_size + 2 * expander_spacing, requisition->height);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
494
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
495 if (!interior_focus)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
496 requisition->height += 2 * focus_width + 2 * focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
497
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
498 if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
499 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
500 GtkRequisition child_requisition;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
501
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
502 gtk_widget_size_request (bin->child, &child_requisition);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
503
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
504 requisition->width = MAX (requisition->width, child_requisition.width);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
505 requisition->height += child_requisition.height + priv->spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
506 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
507
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
508 requisition->width += 2 * border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
509 requisition->height += 2 * border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
510 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
511
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
512 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
513 get_expander_bounds (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
514 GdkRectangle *rect)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
515 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
516 GtkWidget *widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
517 GtkBin *bin;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
518 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
519 gint border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
520 gint expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
521 gint expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
522 gboolean interior_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
523 gint focus_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
524 gint focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
525 gboolean ltr;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
526
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
527 widget = GTK_WIDGET (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
528 bin = GTK_BIN (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
529 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
530
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
531 border_width = GTK_CONTAINER (expander)->border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
532
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
533 gtk_widget_style_get (widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
534 "interior-focus", &interior_focus,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
535 "focus-line-width", &focus_width,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
536 "focus-padding", &focus_pad,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
537 "expander-size", &expander_size,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
538 "expander-spacing", &expander_spacing,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
539 NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
540
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
541 ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
542
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
543 rect->x = widget->allocation.x + border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
544 rect->y = widget->allocation.y + border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
545
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
546 if (ltr)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
547 rect->x += expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
548 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
549 rect->x += widget->allocation.width - 2 * border_width -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
550 expander_spacing - expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
551
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
552 if (priv->label_widget && GTK_WIDGET_VISIBLE (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
553 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
554 GtkAllocation label_allocation;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
555
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
556 label_allocation = priv->label_widget->allocation;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
557
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
558 if (expander_size < label_allocation.height)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
559 rect->y += focus_width + focus_pad + (label_allocation.height - expander_size) / 2;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
560 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
561 rect->y += expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
562 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
563 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
564 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
565 rect->y += expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
566 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
567
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
568 if (!interior_focus)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
569 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
570 if (ltr)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
571 rect->x += focus_width + focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
572 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
573 rect->x -= focus_width + focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
574 rect->y += focus_width + focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
575 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
576
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
577 rect->width = rect->height = expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
578 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
579
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
580 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
581 gtk_expander_size_allocate (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
582 GtkAllocation *allocation)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
583 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
584 GtkExpander *expander;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
585 GtkBin *bin;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
586 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
587 GtkRequisition child_requisition;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
588 gboolean child_visible = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
589 gint border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
590 gint expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
591 gint expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
592 gboolean interior_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
593 gint focus_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
594 gint focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
595 gint label_height;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
596
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
597 expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
598 bin = GTK_BIN (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
599 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
600
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
601 border_width = GTK_CONTAINER (widget)->border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
602
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
603 gtk_widget_style_get (widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
604 "interior-focus", &interior_focus,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
605 "focus-line-width", &focus_width,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
606 "focus-padding", &focus_pad,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
607 "expander-size", &expander_size,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
608 "expander-spacing", &expander_spacing,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
609 NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
610
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
611 child_requisition.width = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
612 child_requisition.height = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
613 if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
614 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
615 child_visible = TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
616 gtk_widget_get_child_requisition (bin->child, &child_requisition);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
617 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
618
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
619 widget->allocation = *allocation;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
620
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
621 if (priv->label_widget && GTK_WIDGET_VISIBLE (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
622 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
623 GtkAllocation label_allocation;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
624 GtkRequisition label_requisition;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
625 gboolean ltr;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
626
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
627 gtk_widget_get_child_requisition (priv->label_widget, &label_requisition);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
628
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
629 ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
630
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
631 if (ltr)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
632 label_allocation.x = (widget->allocation.x +
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
633 border_width + focus_width + focus_pad +
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
634 expander_size + 2 * expander_spacing);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
635 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
636 label_allocation.x = (widget->allocation.x + widget->allocation.width -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
637 (label_requisition.width +
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
638 border_width + focus_width + focus_pad +
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
639 expander_size + 2 * expander_spacing));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
640
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
641 label_allocation.y = widget->allocation.y + border_width + focus_width + focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
642
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
643 label_allocation.width = MIN (label_requisition.width,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
644 allocation->width - 2 * border_width -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
645 expander_size - 2 * expander_spacing -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
646 2 * focus_width - 2 * focus_pad);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
647 label_allocation.width = MAX (label_allocation.width, 1);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
648
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
649 label_allocation.height = MIN (label_requisition.height,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
650 allocation->height - 2 * border_width -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
651 2 * focus_width - 2 * focus_pad -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
652 (child_visible ? priv->spacing : 0));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
653 label_allocation.height = MAX (label_allocation.height, 1);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
654
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
655 gtk_widget_size_allocate (priv->label_widget, &label_allocation);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
656
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
657 label_height = label_allocation.height;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
658 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
659 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
660 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
661 label_height = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
662 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
663
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
664 if (GTK_WIDGET_REALIZED (widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
665 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
666 GdkRectangle rect;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
667
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
668 get_expander_bounds (expander, &rect);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
669
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
670 gdk_window_move_resize (priv->event_window,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
671 allocation->x + border_width, rect.y,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
672 MAX (allocation->width - 2 * border_width, 1), rect.width);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
673 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
674
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
675 if (child_visible)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
676 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
677 GtkAllocation child_allocation;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
678 gint top_height;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
679
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
680 top_height = MAX (2 * expander_spacing + expander_size,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
681 label_height +
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
682 (interior_focus ? 2 * focus_width + 2 * focus_pad : 0));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
683
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
684 child_allocation.x = widget->allocation.x + border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
685 child_allocation.y = widget->allocation.y + border_width + top_height + priv->spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
686
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
687 if (!interior_focus)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
688 child_allocation.y += 2 * focus_width + 2 * focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
689
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
690 child_allocation.width = MAX (allocation->width - 2 * border_width, 1);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
691
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
692 child_allocation.height = allocation->height - top_height -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
693 2 * border_width - priv->spacing -
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
694 (!interior_focus ? 2 * focus_width + 2 * focus_pad : 0);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
695 child_allocation.height = MAX (child_allocation.height, 1);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
696
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
697 gtk_widget_size_allocate (bin->child, &child_allocation);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
698 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
699 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
700
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
701 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
702 gtk_expander_map (GtkWidget *widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
703 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
704 GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
705
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
706 if (priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
707 gtk_widget_map (priv->label_widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
708
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
709 GTK_WIDGET_CLASS (parent_class)->map (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
710
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
711 if (priv->event_window)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
712 gdk_window_show (priv->event_window);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
713 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
714
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
715 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
716 gtk_expander_unmap (GtkWidget *widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
717 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
718 GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
719
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
720 if (priv->event_window)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
721 gdk_window_hide (priv->event_window);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
722
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
723 GTK_WIDGET_CLASS (parent_class)->unmap (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
724
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
725 if (priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
726 gtk_widget_unmap (priv->label_widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
727 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
728
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
729 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
730 gtk_expander_paint_prelight (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
731 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
732 GtkWidget *widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
733 GtkContainer *container;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
734 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
735 GdkRectangle area;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
736 gboolean interior_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
737 int focus_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
738 int focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
739 int expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
740 int expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
741
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
742 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
743 widget = GTK_WIDGET (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
744 container = GTK_CONTAINER (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
745
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
746 gtk_widget_style_get (widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
747 "interior-focus", &interior_focus,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
748 "focus-line-width", &focus_width,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
749 "focus-padding", &focus_pad,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
750 "expander-size", &expander_size,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
751 "expander-spacing", &expander_spacing,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
752 NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
753
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
754 area.x = widget->allocation.x + container->border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
755 area.y = widget->allocation.y + container->border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
756 area.width = widget->allocation.width - (2 * container->border_width);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
757
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
758 if (priv->label_widget && GTK_WIDGET_VISIBLE (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
759 area.height = priv->label_widget->allocation.height;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
760 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
761 area.height = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
762
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
763 area.height += interior_focus ? (focus_width + focus_pad) * 2 : 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
764 area.height = MAX (area.height, expander_size + 2 * expander_spacing);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
765 area.height += !interior_focus ? (focus_width + focus_pad) * 2 : 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
766
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
767 gtk_paint_flat_box (widget->style, widget->window,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
768 GTK_STATE_PRELIGHT,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
769 GTK_SHADOW_ETCHED_OUT,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
770 &area, widget, "expander",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
771 area.x, area.y,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
772 area.width, area.height);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
773 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
774
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
775 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
776 gtk_expander_paint (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
777 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
778 GtkWidget *widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
779 GdkRectangle clip;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
780 GtkStateType state;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
781
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
782 widget = GTK_WIDGET (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
783
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
784 get_expander_bounds (expander, &clip);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
785
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
786 state = widget->state;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
787 if (expander->priv->prelight)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
788 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
789 state = GTK_STATE_PRELIGHT;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
790
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
791 gtk_expander_paint_prelight (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
792 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
793
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
794 gtk_paint_expander (widget->style,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
795 widget->window,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
796 state,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
797 &clip,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
798 widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
799 "expander",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
800 clip.x + clip.width / 2,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
801 clip.y + clip.height / 2,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
802 expander->priv->expander_style);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
803 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
804
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
805 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
806 gtk_expander_paint_focus (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
807 GdkRectangle *area)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
808 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
809 GtkWidget *widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
810 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
811 gint x, y, width, height;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
812 gboolean interior_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
813 gint border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
814 gint focus_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
815 gint focus_pad;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
816 gint expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
817 gint expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
818 gboolean ltr;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
819
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
820 widget = GTK_WIDGET (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
821 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
822
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
823 border_width = GTK_CONTAINER (widget)->border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
824
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
825 gtk_widget_style_get (widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
826 "interior-focus", &interior_focus,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
827 "focus-line-width", &focus_width,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
828 "focus-padding", &focus_pad,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
829 "expander-size", &expander_size,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
830 "expander-spacing", &expander_spacing,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
831 NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
832
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
833 ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
834
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
835 x = widget->allocation.x + border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
836 y = widget->allocation.y + border_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
837
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
838 if (ltr && interior_focus)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
839 x += expander_spacing * 2 + expander_size;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
840
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
841 width = height = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
842
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
843 if (priv->label_widget && GTK_WIDGET_VISIBLE (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
844 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
845 GtkAllocation label_allocation = priv->label_widget->allocation;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
846
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
847 width = label_allocation.width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
848 height = label_allocation.height;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
849 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
850
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
851 if (!interior_focus)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
852 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
853 width += expander_size + 2 * expander_spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
854 height = MAX (height, expander_size + 2 * expander_spacing);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
855 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
856
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
857 width += 2 * focus_pad + 2 * focus_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
858 height += 2 * focus_pad + 2 * focus_width;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
859
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
860 gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
861 area, widget, "expander",
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
862 x, y, width, height);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
863 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
864
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
865 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
866 gtk_expander_expose (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
867 GdkEventExpose *event)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
868 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
869 if (GTK_WIDGET_DRAWABLE (widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
870 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
871 GtkExpander *expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
872
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
873 gtk_expander_paint (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
874
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
875 if (GTK_WIDGET_HAS_FOCUS (expander))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
876 gtk_expander_paint_focus (expander, &event->area);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
877
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
878 GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
879 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
880
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
881 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
882 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
883
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
884 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
885 gtk_expander_button_press (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
886 GdkEventButton *event)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
887 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
888 GtkExpander *expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
889
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
890 if (event->button == 1 && event->window == expander->priv->event_window)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
891 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
892 expander->priv->button_down = TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
893 return TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
894 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
895
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
896 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
897 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
898
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
899 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
900 gtk_expander_button_release (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
901 GdkEventButton *event)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
902 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
903 GtkExpander *expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
904
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
905 if (event->button == 1 && expander->priv->button_down)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
906 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
907 gtk_widget_activate (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
908 expander->priv->button_down = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
909 return TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
910 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
911
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
912 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
913 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
914
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
915 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
916 gtk_expander_grab_notify (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
917 gboolean was_grabbed)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
918 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
919 if (!was_grabbed)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
920 GTK_EXPANDER (widget)->priv->button_down = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
921 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
922
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
923 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
924 gtk_expander_state_changed (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
925 GtkStateType previous_state)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
926 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
927 if (!GTK_WIDGET_IS_SENSITIVE (widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
928 GTK_EXPANDER (widget)->priv->button_down = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
929 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
930
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
931 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
932 gtk_expander_redraw_expander (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
933 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
934 GtkWidget *widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
935
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
936 widget = GTK_WIDGET (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
937
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
938 if (GTK_WIDGET_REALIZED (widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
939 gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
940 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
941
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
942 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
943 gtk_expander_enter_notify (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
944 GdkEventCrossing *event)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
945 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
946 GtkExpander *expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
947 GtkWidget *event_widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
948
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
949 event_widget = gtk_get_event_widget ((GdkEvent *) event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
950
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
951 if (event_widget == widget &&
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
952 event->detail != GDK_NOTIFY_INFERIOR)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
953 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
954 expander->priv->prelight = TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
955
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
956 if (expander->priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
957 gtk_widget_set_state (expander->priv->label_widget, GTK_STATE_PRELIGHT);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
958
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
959 gtk_expander_redraw_expander (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
960 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
961
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
962 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
963 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
964
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
965 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
966 gtk_expander_leave_notify (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
967 GdkEventCrossing *event)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
968 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
969 GtkExpander *expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
970 GtkWidget *event_widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
971
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
972 event_widget = gtk_get_event_widget ((GdkEvent *) event);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
973
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
974 if (event_widget == widget &&
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
975 event->detail != GDK_NOTIFY_INFERIOR)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
976 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
977 expander->priv->prelight = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
978
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
979 if (expander->priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
980 gtk_widget_set_state (expander->priv->label_widget, GTK_STATE_NORMAL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
981
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
982 gtk_expander_redraw_expander (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
983 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
984
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
985 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
986 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
987
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
988 typedef enum
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
989 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
990 FOCUS_NONE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
991 FOCUS_WIDGET,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
992 FOCUS_LABEL,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
993 FOCUS_CHILD
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
994 } FocusSite;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
995
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
996 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
997 focus_current_site (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
998 GtkDirectionType direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
999 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1000 GtkWidget *current_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1001
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1002 current_focus = GTK_CONTAINER (expander)->focus_child;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1003
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1004 if (!current_focus)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1005 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1006
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1007 return gtk_widget_child_focus (current_focus, direction);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1008 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1009
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1010 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1011 focus_in_site (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1012 FocusSite site,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1013 GtkDirectionType direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1014 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1015 switch (site)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1016 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1017 case FOCUS_WIDGET:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1018 gtk_widget_grab_focus (GTK_WIDGET (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1019 return TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1020 case FOCUS_LABEL:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1021 if (expander->priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1022 return gtk_widget_child_focus (expander->priv->label_widget, direction);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1023 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1024 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1025 case FOCUS_CHILD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1026 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1027 GtkWidget *child = gtk_bin_get_child (GTK_BIN (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1028
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1029 if (child && GTK_WIDGET_CHILD_VISIBLE (child))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1030 return gtk_widget_child_focus (child, direction);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1031 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1032 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1033 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1034 case FOCUS_NONE:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1035 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1036 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1037
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1038 g_assert_not_reached ();
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1039 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1040 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1041
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1042 static FocusSite
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1043 get_next_site (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1044 FocusSite site,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1045 GtkDirectionType direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1046 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1047 gboolean ltr;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1048
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1049 ltr = gtk_widget_get_direction (GTK_WIDGET (expander)) != GTK_TEXT_DIR_RTL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1050
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1051 switch (site)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1052 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1053 case FOCUS_NONE:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1054 switch (direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1055 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1056 case GTK_DIR_TAB_BACKWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1057 case GTK_DIR_LEFT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1058 case GTK_DIR_UP:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1059 return FOCUS_CHILD;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1060 case GTK_DIR_TAB_FORWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1061 case GTK_DIR_DOWN:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1062 case GTK_DIR_RIGHT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1063 return FOCUS_WIDGET;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1064 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1065 case FOCUS_WIDGET:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1066 switch (direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1067 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1068 case GTK_DIR_TAB_BACKWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1069 case GTK_DIR_UP:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1070 return FOCUS_NONE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1071 case GTK_DIR_LEFT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1072 return ltr ? FOCUS_NONE : FOCUS_LABEL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1073 case GTK_DIR_TAB_FORWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1074 case GTK_DIR_DOWN:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1075 return FOCUS_LABEL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1076 case GTK_DIR_RIGHT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1077 return ltr ? FOCUS_LABEL : FOCUS_NONE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1078 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1079 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1080 case FOCUS_LABEL:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1081 switch (direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1082 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1083 case GTK_DIR_TAB_BACKWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1084 case GTK_DIR_UP:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1085 return FOCUS_WIDGET;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1086 case GTK_DIR_LEFT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1087 return ltr ? FOCUS_WIDGET : FOCUS_CHILD;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1088 case GTK_DIR_TAB_FORWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1089 case GTK_DIR_DOWN:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1090 return FOCUS_CHILD;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1091 case GTK_DIR_RIGHT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1092 return ltr ? FOCUS_CHILD : FOCUS_WIDGET;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1093 break;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1094 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1095 case FOCUS_CHILD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1096 switch (direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1097 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1098 case GTK_DIR_TAB_BACKWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1099 case GTK_DIR_LEFT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1100 case GTK_DIR_UP:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1101 return FOCUS_LABEL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1102 case GTK_DIR_TAB_FORWARD:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1103 case GTK_DIR_DOWN:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1104 case GTK_DIR_RIGHT:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1105 return FOCUS_NONE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1106 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1107 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1108
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1109 g_assert_not_reached ();
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1110 return FOCUS_NONE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1111 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1112
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1113 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1114 gtk_expander_focus (GtkWidget *widget,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1115 GtkDirectionType direction)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1116 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1117 GtkExpander *expander = GTK_EXPANDER (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1118
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1119 if (!focus_current_site (expander, direction))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1120 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1121 GtkWidget *old_focus_child;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1122 gboolean widget_is_focus;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1123 FocusSite site = FOCUS_NONE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1124
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1125 widget_is_focus = gtk_widget_is_focus (widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1126 old_focus_child = GTK_CONTAINER (widget)->focus_child;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1127
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1128 if (old_focus_child && old_focus_child == expander->priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1129 site = FOCUS_LABEL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1130 else if (old_focus_child)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1131 site = FOCUS_CHILD;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1132 else if (widget_is_focus)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1133 site = FOCUS_WIDGET;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1134
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1135 while ((site = get_next_site (expander, site, direction)) != FOCUS_NONE)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1136 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1137 if (focus_in_site (expander, site, direction))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1138 return TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1139 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1140
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1141 return FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1142 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1143
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1144 return TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1145 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1146
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1147 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1148 gtk_expander_add (GtkContainer *container,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1149 GtkWidget *widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1150 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1151 GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1152
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1153 gtk_widget_set_child_visible (widget, GTK_EXPANDER (container)->priv->expanded);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1154 gtk_widget_queue_resize (GTK_WIDGET (container));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1155 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1156
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1157 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1158 gtk_expander_remove (GtkContainer *container,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1159 GtkWidget *widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1160 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1161 GtkExpander *expander = GTK_EXPANDER (container);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1162
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1163 if (GTK_EXPANDER (expander)->priv->label_widget == widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1164 gtk_expander_set_label_widget (expander, NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1165 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1166 GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1167 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1168
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1169 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1170 gtk_expander_forall (GtkContainer *container,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1171 gboolean include_internals,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1172 GtkCallback callback,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1173 gpointer callback_data)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1174 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1175 GtkBin *bin = GTK_BIN (container);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1176 GtkExpanderPrivate *priv = GTK_EXPANDER (container)->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1177
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1178 if (bin->child)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1179 (* callback) (bin->child, callback_data);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1180
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1181 if (priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1182 (* callback) (priv->label_widget, callback_data);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1183 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1184
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1185 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1186 gtk_expander_activate (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1187 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1188 gtk_expander_set_expanded (expander, !expander->priv->expanded);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1189 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1190
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1191
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1192 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1193 * gtk_expander_new:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1194 * @label: the text of the label
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1195 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1196 * Creates a new expander using @label as the text of the label.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1197 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1198 * Return value: a new #GtkExpander widget.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1199 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1200 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1201 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1202 GtkWidget *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1203 gtk_expander_new (const gchar *label)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1204 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1205 return g_object_new (GTK_TYPE_EXPANDER, "label", label, NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1206 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1207
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1208 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1209 * gtk_expander_new_with_mnemonic:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1210 * @label: the text of the label with an underscore in front of the
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1211 * mnemonic character
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1212 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1213 * Creates a new expander using @label as the text of the label.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1214 * If characters in @label are preceded by an underscore, they are underlined.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1215 * If you need a literal underscore character in a label, use '__' (two
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1216 * underscores). The first underlined character represents a keyboard
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1217 * accelerator called a mnemonic.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1218 * Pressing Alt and that key activates the button.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1219 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1220 * Return value: a new #GtkExpander widget.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1221 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1222 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1223 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1224 GtkWidget *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1225 gtk_expander_new_with_mnemonic (const gchar *label)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1226 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1227 return g_object_new (GTK_TYPE_EXPANDER,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1228 "label", label,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1229 "use_underline", TRUE,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1230 NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1231 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1232
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1233 static gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1234 gtk_expander_animation_timeout (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1235 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1236 GtkExpanderPrivate *priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1237 GdkRectangle area;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1238 gboolean finish = FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1239
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1240 GDK_THREADS_ENTER();
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1241
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1242 if (GTK_WIDGET_REALIZED (expander))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1243 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1244 get_expander_bounds (expander, &area);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1245 gdk_window_invalidate_rect (GTK_WIDGET (expander)->window, &area, TRUE);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1246 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1247
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1248 if (priv->expanded)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1249 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1250 if (priv->expander_style == GTK_EXPANDER_COLLAPSED)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1251 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1252 priv->expander_style = GTK_EXPANDER_SEMI_EXPANDED;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1253 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1254 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1255 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1256 priv->expander_style = GTK_EXPANDER_EXPANDED;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1257 finish = TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1258 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1259 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1260 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1261 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1262 if (priv->expander_style == GTK_EXPANDER_EXPANDED)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1263 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1264 priv->expander_style = GTK_EXPANDER_SEMI_COLLAPSED;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1265 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1266 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1267 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1268 priv->expander_style = GTK_EXPANDER_COLLAPSED;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1269 finish = TRUE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1270 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1271 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1272
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1273 if (finish)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1274 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1275 priv->animation_timeout = 0;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1276 if (GTK_BIN (expander)->child)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1277 gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1278 gtk_widget_queue_resize (GTK_WIDGET (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1279 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1280
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1281 GDK_THREADS_LEAVE();
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1282
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1283 return !finish;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1284 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1285
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1286 static void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1287 gtk_expander_start_animation (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1288 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1289 GtkExpanderPrivate *priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1290
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1291 if (priv->animation_timeout)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1292 g_source_remove (priv->animation_timeout);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1293
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1294 priv->animation_timeout =
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1295 g_timeout_add (50,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1296 (GSourceFunc) gtk_expander_animation_timeout,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1297 expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1298 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1299
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1300 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1301 * gtk_expander_set_expanded:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1302 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1303 * @expanded: whether the child widget is revealed
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1304 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1305 * Sets the state of the expander. Set to %TRUE, if you want
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1306 * the child widget to be revealed, and %FALSE if you want the
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1307 * child widget to be hidden.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1308 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1309 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1310 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1311 void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1312 gtk_expander_set_expanded (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1313 gboolean expanded)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1314 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1315 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1316
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1317 g_return_if_fail (GTK_IS_EXPANDER (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1318
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1319 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1320
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1321 expanded = expanded != FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1322
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1323 if (priv->expanded != expanded)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1324 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1325 priv->expanded = expanded;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1326
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1327 if (GTK_WIDGET_REALIZED (expander))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1328 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1329 gtk_expander_start_animation (expander);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1330 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1331 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1332 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1333 priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED :
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1334 GTK_EXPANDER_COLLAPSED;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1335
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1336 if (GTK_BIN (expander)->child)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1337 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1338 gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1339 gtk_widget_queue_resize (GTK_WIDGET (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1340 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1341 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1342
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1343 g_object_notify (G_OBJECT (expander), "expanded");
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1344 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1345 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1346
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1347 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1348 * gtk_expander_get_expanded:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1349 * @expander:a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1350 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1351 * Queries a #GtkExpander and returns its current state. Returns %TRUE
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1352 * if the child widget is revealed.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1353 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1354 * See gtk_expander_set_expanded().
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1355 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1356 * Return value: the current state of the expander.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1357 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1358 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1359 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1360 gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1361 gtk_expander_get_expanded (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1362 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1363 g_return_val_if_fail (GTK_IS_EXPANDER (expander), FALSE);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1364
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1365 return expander->priv->expanded;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1366 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1367
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1368 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1369 * gtk_expander_set_spacing:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1370 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1371 * @spacing: distance between the expander and child in pixels.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1372 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1373 * Sets the spacing field of @expander, which is the number of pixels to
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1374 * place between expander and the child.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1375 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1376 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1377 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1378 void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1379 gtk_expander_set_spacing (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1380 gint spacing)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1381 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1382 g_return_if_fail (GTK_IS_EXPANDER (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1383 g_return_if_fail (spacing >= 0);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1384
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1385 if (expander->priv->spacing != spacing)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1386 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1387 expander->priv->spacing = spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1388
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1389 gtk_widget_queue_resize (GTK_WIDGET (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1390
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1391 g_object_notify (G_OBJECT (expander), "spacing");
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1392 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1393 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1394
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1395 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1396 * gtk_expander_get_spacing:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1397 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1398 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1399 * Gets the value set by gtk_expander_set_spacing().
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1400 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1401 * Return value: spacing between the expander and child.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1402 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1403 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1404 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1405 gint
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1406 gtk_expander_get_spacing (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1407 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1408 g_return_val_if_fail (GTK_IS_EXPANDER (expander), 0);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1409
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1410 return expander->priv->spacing;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1411 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1412
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1413 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1414 * gtk_expander_set_label:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1415 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1416 * @label: a string
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1417 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1418 * Sets the text of the label of the expander to @label.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1419 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1420 * This will also clear any previously set labels.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1421 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1422 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1423 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1424 void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1425 gtk_expander_set_label (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1426 const gchar *label)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1427 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1428 g_return_if_fail (GTK_IS_EXPANDER (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1429
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1430 if (!label)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1431 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1432 gtk_expander_set_label_widget (expander, NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1433 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1434 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1435 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1436 GtkWidget *child;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1437
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1438 child = gtk_label_new (label);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1439 gtk_label_set_use_underline (GTK_LABEL (child), expander->priv->use_underline);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1440 gtk_label_set_use_markup (GTK_LABEL (child), expander->priv->use_markup);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1441 gtk_widget_show (child);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1442
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1443 gtk_expander_set_label_widget (expander, child);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1444 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1445
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1446 g_object_notify (G_OBJECT (expander), "label");
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1447 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1448
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1449 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1450 * gtk_expander_get_label:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1451 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1452 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1453 * Fetches the text from the label of the expander, as set by
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1454 * gtk_expander_set_label(). If the label text has not
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1455 * been set the return value will be %NULL. This will be the
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1456 * case if you create an empty button with gtk_button_new() to
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1457 * use as a container.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1458 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1459 * Return value: The text of the label widget. This string is owned
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1460 * by the widget and must not be modified or freed.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1461 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1462 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1463 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1464 G_CONST_RETURN char *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1465 gtk_expander_get_label (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1466 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1467 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1468
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1469 g_return_val_if_fail (GTK_IS_EXPANDER (expander), NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1470
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1471 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1472
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1473 if (priv->label_widget && GTK_IS_LABEL (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1474 return gtk_label_get_text (GTK_LABEL (priv->label_widget));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1475 else
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1476 return NULL;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1477 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1478
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1479 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1480 * gtk_expander_set_use_underline:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1481 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1482 * @use_underline: %TRUE if underlines in the text indicate mnemonics
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1483 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1484 * If true, an underline in the text of the expander label indicates
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1485 * the next character should be used for the mnemonic accelerator key.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1486 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1487 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1488 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1489 void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1490 gtk_expander_set_use_underline (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1491 gboolean use_underline)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1492 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1493 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1494
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1495 g_return_if_fail (GTK_IS_EXPANDER (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1496
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1497 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1498
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1499 use_underline = use_underline != FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1500
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1501 if (priv->use_underline != use_underline)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1502 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1503 priv->use_underline = use_underline;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1504
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1505 if (priv->label_widget && GTK_IS_LABEL (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1506 gtk_label_set_use_underline (GTK_LABEL (priv->label_widget), use_underline);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1507
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1508 g_object_notify (G_OBJECT (expander), "use-underline");
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1509 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1510 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1511
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1512 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1513 * gtk_expander_get_use_underline:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1514 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1515 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1516 * Returns whether an embedded underline in the expander label indicates a
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1517 * mnemonic. See gtk_expander_set_use_underline().
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1518 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1519 * Return value: %TRUE if an embedded underline in the expander label
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1520 * indicates the mnemonic accelerator keys.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1521 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1522 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1523 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1524 gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1525 gtk_expander_get_use_underline (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1526 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1527 g_return_val_if_fail (GTK_IS_EXPANDER (expander), FALSE);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1528
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1529 return expander->priv->use_underline;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1530 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1531
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1532 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1533 * gtk_expander_set_use_markup:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1534 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1535 * @use_markup: %TRUE if the label's text should be parsed for markup
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1536 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1537 * Sets whether the text of the label contains markup in <link
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1538 * linkend="PangoMarkupFormat">Pango's text markup
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1539 * language</link>. See gtk_label_set_markup().
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1540 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1541 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1542 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1543 void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1544 gtk_expander_set_use_markup (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1545 gboolean use_markup)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1546 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1547 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1548
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1549 g_return_if_fail (GTK_IS_EXPANDER (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1550
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1551 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1552
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1553 use_markup = use_markup != FALSE;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1554
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1555 if (priv->use_markup != use_markup)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1556 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1557 priv->use_markup = use_markup;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1558
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1559 if (priv->label_widget && GTK_IS_LABEL (priv->label_widget))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1560 gtk_label_set_use_markup (GTK_LABEL (priv->label_widget), use_markup);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1561
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1562 g_object_notify (G_OBJECT (expander), "use-markup");
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1563 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1564 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1565
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1566 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1567 * gtk_expander_get_use_markup:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1568 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1569 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1570 * Returns whether the label's text is interpreted as marked up with
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1571 * the <link linkend="PangoMarkupFormat">Pango text markup
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1572 * language</link>. See gtk_expander_set_use_markup ().
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1573 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1574 * Return value: %TRUE if the label's text will be parsed for markup
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1575 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1576 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1577 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1578 gboolean
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1579 gtk_expander_get_use_markup (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1580 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1581 g_return_val_if_fail (GTK_IS_EXPANDER (expander), FALSE);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1582
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1583 return expander->priv->use_markup;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1584 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1585
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1586 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1587 * gtk_expander_set_label_widget:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1588 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1589 * @label_widget: the new label widget
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1590 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1591 * Set the label widget for the expander. This is the widget
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1592 * that will appear embedded alongside the expander arrow.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1593 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1594 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1595 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1596 void
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1597 gtk_expander_set_label_widget (GtkExpander *expander,
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1598 GtkWidget *label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1599 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1600 GtkExpanderPrivate *priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1601
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1602 g_return_if_fail (GTK_IS_EXPANDER (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1603 g_return_if_fail (label_widget == NULL || GTK_IS_WIDGET (label_widget));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1604 g_return_if_fail (label_widget == NULL || label_widget->parent == NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1605
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1606 priv = expander->priv;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1607
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1608 if (priv->label_widget == label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1609 return;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1610
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1611 if (priv->label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1612 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1613 gtk_widget_set_state (priv->label_widget, GTK_STATE_NORMAL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1614 gtk_widget_unparent (priv->label_widget);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1615 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1616
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1617 priv->label_widget = label_widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1618
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1619 if (label_widget)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1620 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1621 priv->label_widget = label_widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1622
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1623 gtk_widget_set_parent (label_widget, GTK_WIDGET (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1624
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1625 if (priv->prelight)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1626 gtk_widget_set_state (label_widget, GTK_STATE_PRELIGHT);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1627 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1628
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1629 if (GTK_WIDGET_VISIBLE (expander))
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1630 gtk_widget_queue_resize (GTK_WIDGET (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1631
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1632 g_object_freeze_notify (G_OBJECT (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1633 g_object_notify (G_OBJECT (expander), "label-widget");
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1634 g_object_notify (G_OBJECT (expander), "label");
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1635 g_object_thaw_notify (G_OBJECT (expander));
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1636 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1637
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1638 /**
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1639 * gtk_expander_get_label_widget:
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1640 * @expander: a #GtkExpander
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1641 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1642 * Retrieves the label widget for the frame. See
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1643 * gtk_expander_set_label_widget().
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1644 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1645 * Return value: the label widget, or %NULL if there is none.
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1646 *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1647 * Since: 2.4
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1648 **/
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1649 GtkWidget *
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1650 gtk_expander_get_label_widget (GtkExpander *expander)
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1651 {
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1652 g_return_val_if_fail (GTK_IS_EXPANDER (expander), NULL);
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1653
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1654 return expander->priv->label_widget;
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1655 }
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1656
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1657 #define __GTK_EXPANDER_C__
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1658
8d7c99f20e4c [gaim-migrate @ 14026]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1659 #endif /* Gtk 2.4 */