Revert "Revert "Merge remote-tracking branch 'origin/sandbox/mniesluchow/upstream_2_1...
[platform/upstream/atk.git] / atk / atkwindow.c
1 /* ATK -  Accessibility Toolkit
2  * Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include "atkwindow.h"
23 #include "atkmarshal.h"
24
25 /**
26  * SECTION:atkwindow
27  * @Short_description: The ATK Interface provided by UI components that represent a top-level window.
28  * @Title: AtkWindow
29  * @See_also: #AtkObject
30  *
31  * #AtkWindow should be implemented by the UI elements that represent
32  * a top-level window, such as the main window of an application or
33  * dialog.
34  *
35  */
36
37 enum {
38   ACTIVATE,
39   CREATE,
40   DEACTIVATE,
41   DESTROY,
42   MAXIMIZE,
43   MINIMIZE,
44   MOVE,
45   RESIZE,
46   RESTORE,
47   LAST_SIGNAL
48 };
49
50 static guint atk_window_signals[LAST_SIGNAL] = { 0 };
51
52 static guint
53 atk_window_add_signal (const gchar *name)
54 {
55   return g_signal_new (name,
56                        ATK_TYPE_WINDOW,
57                        G_SIGNAL_RUN_LAST,
58                        0,
59                        (GSignalAccumulator) NULL, NULL,
60                        g_cclosure_marshal_VOID__VOID,
61                        G_TYPE_NONE,
62                        0);
63 }
64
65 typedef AtkWindowIface AtkWindowInterface;
66 G_DEFINE_INTERFACE (AtkWindow, atk_window, ATK_TYPE_OBJECT)
67
68 static void
69 atk_window_default_init (AtkWindowIface *iface)
70 {
71   static gboolean initialized = FALSE;
72
73   if (!initialized)
74     {
75       /**
76        * AtkWindow::activate:
77        * @object: the object which received the signal
78        *
79        * The signal #AtkWindow::activate is emitted when a window
80        * becomes the active window of the application or session.
81        *
82        * Since: 2.2
83        */
84       atk_window_signals[ACTIVATE] = atk_window_add_signal ("activate");
85       /**
86        * AtkWindow::create:
87        * @object: the object which received the signal
88        *
89        * The signal #AtkWindow::create is emitted when a new window
90        * is created.
91        *
92        * Since: 2.2
93        */
94       atk_window_signals[CREATE] = atk_window_add_signal ("create");
95       /**
96        * AtkWindow::deactivate:
97        * @object: the object which received the signal
98        *
99        * The signal #AtkWindow::deactivate is emitted when a window is
100        * no longer the active window of the application or session.
101        *
102        * Since: 2.2
103        */
104       atk_window_signals[DEACTIVATE] = atk_window_add_signal ("deactivate");
105       /**
106        * AtkWindow::destroy:
107        * @object: the object which received the signal
108        *
109        * The signal #AtkWindow::destroy is emitted when a window is
110        * destroyed.
111        *
112        * Since: 2.2
113        */
114       atk_window_signals[DESTROY] = atk_window_add_signal ("destroy");
115       /**
116        * AtkWindow::maximize:
117        * @object: the object which received the signal
118        *
119        * The signal #AtkWindow::maximize is emitted when a window
120        * is maximized.
121        *
122        * Since: 2.2
123        */
124       atk_window_signals[MAXIMIZE] = atk_window_add_signal ("maximize");
125       /**
126        * AtkWindow::minimize:
127        * @object: the object which received the signal
128        *
129        * The signal #AtkWindow::minimize is emitted when a window
130        * is minimized.
131        *
132        * Since: 2.2
133        */
134       atk_window_signals[MINIMIZE] = atk_window_add_signal ("minimize");
135       /**
136        * AtkWindow::move:
137        * @object: the object which received the signal
138        *
139        * The signal #AtkWindow::move is emitted when a window
140        * is moved.
141        *
142        * Since: 2.2
143        */
144       atk_window_signals[MOVE] = atk_window_add_signal ("move");
145       /**
146        * AtkWindow::resize:
147        * @object: the object which received the signal
148        *
149        * The signal #AtkWindow::resize is emitted when a window
150        * is resized.
151        *
152        * Since: 2.2
153        */
154       atk_window_signals[RESIZE] = atk_window_add_signal ("resize");
155       /**
156        * AtkWindow::restore:
157        * @object: the object which received the signal
158        *
159        * The signal #AtkWindow::restore is emitted when a window
160        * is restored.
161        *
162        * Since: 2.2
163        */
164       atk_window_signals[RESTORE] = atk_window_add_signal ("restore");
165
166       initialized = TRUE;
167     }
168 }