1 /* This file is part of the GtkHTML library.
3 * Copyright 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #include "htmlembedded.h"
25 #include "htmlobject.h"
29 #include "paragraph.h"
35 create_accessible (HTMLObject
*o
,
38 AtkObject
*accessible
= NULL
;
40 switch (HTML_OBJECT_TYPE (o
)) {
41 case HTML_TYPE_CLUEFLOW
:
42 accessible
= html_a11y_paragraph_new (o
);
45 accessible
= html_a11y_text_new (o
);
48 accessible
= html_a11y_image_new (o
);
51 accessible
= html_a11y_table_new (o
);
53 case HTML_TYPE_TABLECELL
:
54 accessible
= html_a11y_cell_new (o
);
57 accessible
= html_a11y_new (o
, ATK_ROLE_SEPARATOR
);
59 case HTML_TYPE_EMBEDDED
:
60 case HTML_TYPE_SELECT
:
62 case HTML_TYPE_OBJECT
:
63 case HTML_TYPE_TEXTAREA
:
64 case HTML_TYPE_TEXTINPUT
:
65 case HTML_TYPE_BUTTON
:
66 case HTML_TYPE_CHECKBOX
:
67 case HTML_TYPE_IFRAME
:
68 if (HTML_EMBEDDED (o
)-> widget
) {
69 accessible
= gtk_widget_get_accessible (HTML_EMBEDDED (o
)->widget
);
71 if (HTML_EMBEDDED (o
)->name
) {
72 if ((accessible
!= NULL
) && (atk_object_get_name (accessible
) == NULL
))
73 atk_object_set_name (accessible
, HTML_EMBEDDED (o
)->name
);
77 case HTML_TYPE_TEXTSLAVE
: /* ignore */
80 accessible
= html_a11y_new (o
, ATK_ROLE_UNKNOWN
);
84 if (accessible
&& parent
) {
85 /* printf ("set parent of %p to %p\n", accessible, parent); */
86 atk_object_set_parent (accessible
, parent
);
93 acc_unref (gpointer data
)
97 g_object_set_data (G_OBJECT (data
), HTML_ID
, NULL
);
98 ss
= atk_object_ref_state_set (data
);
100 atk_state_set_add_state (ss
, ATK_STATE_DEFUNCT
);
101 atk_object_notify_state_change (data
, ATK_STATE_DEFUNCT
, TRUE
);
102 g_object_unref (G_OBJECT (data
));
106 html_utils_get_accessible (HTMLObject
*o
,
109 AtkObject
*accessible
;
111 g_return_val_if_fail (o
!= NULL
, NULL
);
113 accessible
= html_object_get_data_nocp (o
, ACCESSIBLE_ID
);
116 accessible
= create_accessible (o
, parent
);
118 g_object_ref (accessible
);
119 html_object_set_data_full_nocp (o
, ACCESSIBLE_ID
, accessible
, acc_unref
);