768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
1 |
/*
|
2 |
* Copyright (C) 2011 Canonical Ltd
|
|
3 |
*
|
|
4 |
* This program is free software: you can redistribute it and/or modify
|
|
5 |
* it under the terms of the GNU General Public License version 3 as
|
|
6 |
* published by the Free Software Foundation.
|
|
7 |
*
|
|
8 |
* This program is distributed in the hope that it will be useful,
|
|
9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
* GNU General Public License for more details.
|
|
12 |
*
|
|
13 |
* You should have received a copy of the GNU General Public License
|
|
14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15 |
*
|
|
16 |
* Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
|
|
17 |
*/
|
|
18 |
||
19 |
/**
|
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
20 |
* SECTION:unity-panel-view-accessible
|
21 |
* @Title: UnityPanelViewAccessible
|
|
22 |
* @short_description: Implementation of the ATK interfaces for #PanelView
|
|
23 |
* @see_also: PanelView
|
|
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
24 |
*
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
25 |
* #UnityPanelViewAccessible implements the required ATK interfaces for
|
26 |
* #PanelView, ie: exposing the different items contained in the panel
|
|
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
27 |
* as children.
|
28 |
*
|
|
29 |
*/
|
|
30 |
||
768.2.25
by Rodrigo Moya
Add panel window via unity_util_accessible_add_window |
31 |
#include <glib/gi18n-lib.h> |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
32 |
#include <Nux/Nux.h> |
33 |
#include "PanelView.h" |
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
34 |
#include "unity-panel-view-accessible.h" |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
35 |
|
36 |
#include "unitya11y.h" |
|
37 |
||
38 |
/* GObject */
|
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
39 |
static void unity_panel_view_accessible_class_init (UnityPanelViewAccessibleClass *klass); |
40 |
static void unity_panel_view_accessible_init (UnityPanelViewAccessible *self); |
|
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
41 |
|
42 |
/* AtkObject */
|
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
43 |
static void unity_panel_view_accessible_initialize (AtkObject *accessible, gpointer data); |
44 |
static gint unity_panel_view_accessible_get_n_children (AtkObject *accessible); |
|
45 |
static AtkObject *unity_panel_view_accessible_ref_child (AtkObject *accessible, gint i); |
|
46 |
||
47 |
G_DEFINE_TYPE (UnityPanelViewAccessible, unity_panel_view_accessible, NUX_TYPE_VIEW_ACCESSIBLE) |
|
48 |
||
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
49 |
static void |
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
50 |
unity_panel_view_accessible_class_init (UnityPanelViewAccessibleClass *klass) |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
51 |
{
|
52 |
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
|
53 |
||
54 |
/* AtkObject */
|
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
55 |
atk_class->initialize = unity_panel_view_accessible_initialize; |
56 |
atk_class->get_n_children = unity_panel_view_accessible_get_n_children; |
|
57 |
atk_class->ref_child = unity_panel_view_accessible_ref_child; |
|
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
58 |
}
|
59 |
||
60 |
static void |
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
61 |
unity_panel_view_accessible_init (UnityPanelViewAccessible *self) |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
62 |
{
|
63 |
}
|
|
64 |
||
65 |
AtkObject * |
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
66 |
unity_panel_view_accessible_new (nux::Object *object) |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
67 |
{
|
68 |
AtkObject *accessible; |
|
69 |
||
70 |
g_return_val_if_fail (dynamic_cast<PanelView *>(object), NULL); |
|
71 |
||
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
72 |
accessible = ATK_OBJECT (g_object_new (UNITY_TYPE_PANEL_VIEW_ACCESSIBLE, NULL)); |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
73 |
|
74 |
atk_object_initialize (accessible, object); |
|
75 |
||
76 |
return accessible; |
|
77 |
}
|
|
78 |
||
79 |
static void |
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
80 |
unity_panel_view_accessible_initialize (AtkObject *accessible, gpointer data) |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
81 |
{
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
82 |
ATK_OBJECT_CLASS (unity_panel_view_accessible_parent_class)->initialize (accessible, data); |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
83 |
|
768.2.7
by Rodrigo Moya
Add basic structure of UnityPanelHomeButtonAccessible object |
84 |
accessible->role = ATK_ROLE_PANEL; |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
85 |
}
|
86 |
||
87 |
static gint |
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
88 |
unity_panel_view_accessible_get_n_children (AtkObject *accessible) |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
89 |
{
|
90 |
nux::Object *nux_object = NULL; |
|
91 |
PanelView *panel; |
|
768.2.20
by Rodrigo Moya
Only return 1 child for PanelView a11y object |
92 |
PanelHomeButton *home_button; |
768.2.14
by Rodrigo Moya
Use the layout's children |
93 |
gint rc = 0; |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
94 |
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
95 |
g_return_val_if_fail (UNITY_IS_PANEL_VIEW_ACCESSIBLE (accessible), 0); |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
96 |
|
97 |
nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible)); |
|
98 |
if (!nux_object) /* state is defunct */ |
|
99 |
return 0; |
|
100 |
||
101 |
panel = dynamic_cast<PanelView *>(nux_object); |
|
768.2.20
by Rodrigo Moya
Only return 1 child for PanelView a11y object |
102 |
if ((home_button = panel->HomeButton ()) != NULL) |
768.2.16
by Rodrigo Moya
Return the layout as the only children for UnityPanelAccessible |
103 |
rc = 1; |
768.2.14
by Rodrigo Moya
Use the layout's children |
104 |
|
105 |
return rc; |
|
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
106 |
}
|
107 |
||
108 |
static AtkObject * |
|
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
109 |
unity_panel_view_accessible_ref_child (AtkObject *accessible, gint i) |
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
110 |
{
|
768.2.2
by Rodrigo Moya
Make PanelView track all its children and use that in UnityPanelAccessible |
111 |
nux::Object *nux_object = NULL; |
112 |
PanelView *panel; |
|
768.2.20
by Rodrigo Moya
Only return 1 child for PanelView a11y object |
113 |
PanelHomeButton *home_button; |
768.2.2
by Rodrigo Moya
Make PanelView track all its children and use that in UnityPanelAccessible |
114 |
AtkObject *child_accessible = NULL; |
115 |
||
768.2.17
by Rodrigo Moya
Rename UnityPanelAccessible to UnityPanelViewAccessible for consistency |
116 |
g_return_val_if_fail (UNITY_IS_PANEL_VIEW_ACCESSIBLE (accessible), NULL); |
768.2.2
by Rodrigo Moya
Make PanelView track all its children and use that in UnityPanelAccessible |
117 |
|
118 |
nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible)); |
|
119 |
if (!nux_object) /* state is defunct */ |
|
120 |
return NULL; |
|
121 |
||
122 |
panel = dynamic_cast<PanelView *>(nux_object); |
|
768.2.20
by Rodrigo Moya
Only return 1 child for PanelView a11y object |
123 |
if ((home_button = panel->HomeButton ()) != NULL) |
768.2.14
by Rodrigo Moya
Use the layout's children |
124 |
{
|
125 |
nux::Object *child = NULL; |
|
768.2.16
by Rodrigo Moya
Return the layout as the only children for UnityPanelAccessible |
126 |
|
768.2.20
by Rodrigo Moya
Only return 1 child for PanelView a11y object |
127 |
child = dynamic_cast<nux::Object *>(home_button); |
768.2.14
by Rodrigo Moya
Use the layout's children |
128 |
child_accessible = unity_a11y_get_accessible (child); |
129 |
if (child_accessible != NULL) |
|
130 |
g_object_ref (child_accessible); |
|
131 |
}
|
|
768.2.2
by Rodrigo Moya
Make PanelView track all its children and use that in UnityPanelAccessible |
132 |
|
133 |
return child_accessible; |
|
768.2.1
by Rodrigo Moya
Basic structure of UnityPanelAccessible and some build fixes |
134 |
}
|