summaryrefslogtreecommitdiff
path: root/plugins
diff options
authorAndrea Azzarone <azzaronea@gmail.com>2014-02-22 05:19:40 +0100
committerAndrea Azzarone <azzaronea@gmail.com>2014-02-22 05:19:40 +0100
commit0d342de2d49ca9ca2d2c91d263d9bfb03d2f7884 (patch)
tree1c7ef6a8f17bd9b04046cc2a03a9cb58e4708aa1 /plugins
parent794154b2b3abe00dc684b9c5566bd7b93a67db6a (diff)
Add missing files.
(bzr r3566.5.442)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/unityshell/src/unity-text-input-accessible.cpp90
-rw-r--r--plugins/unityshell/src/unity-text-input-accessible.h57
2 files changed, 147 insertions, 0 deletions
diff --git a/plugins/unityshell/src/unity-text-input-accessible.cpp b/plugins/unityshell/src/unity-text-input-accessible.cpp
new file mode 100644
index 000000000..57d1a490a
--- /dev/null
+++ b/plugins/unityshell/src/unity-text-input-accessible.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2014 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ */
+
+#include "unity-text-input-accessible.h"
+
+#include "unitya11y.h"
+#include "TextInput.h"
+
+using namespace unity;
+
+/* GObject */
+static void unity_text_input_accessible_class_init(UnityTextInputAccessibleClass* klass);
+static void unity_text_input_accessible_init(UnityTextInputAccessible* self);
+//static void unity_text_input_accessible_finalize(GObject* object);
+
+/* AtkObject.h */
+static void unity_text_input_accessible_initialize(AtkObject* accessible,
+ gpointer data);
+
+G_DEFINE_TYPE(UnityTextInputAccessible, unity_text_input_accessible, NUX_TYPE_VIEW_ACCESSIBLE)
+
+static void
+unity_text_input_accessible_class_init(UnityTextInputAccessibleClass* klass)
+{
+ AtkObjectClass* atk_class = ATK_OBJECT_CLASS(klass);
+
+ /* AtkObject */
+ atk_class->initialize = unity_text_input_accessible_initialize;
+}
+
+static void
+unity_text_input_accessible_init(UnityTextInputAccessible* self)
+{}
+
+AtkObject*
+unity_text_input_accessible_new(nux::Object* object)
+{
+ AtkObject* accessible = NULL;
+
+ g_return_val_if_fail(dynamic_cast<TextInput*>(object), NULL);
+
+ accessible = ATK_OBJECT(g_object_new(UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, NULL));
+
+ atk_object_initialize(accessible, object);
+
+ return accessible;
+}
+
+static void
+unity_text_input_accessible_initialize(AtkObject* accessible,
+ gpointer data)
+{
+ nux::Object* nux_object = NULL;
+ TextInput* text_input = NULL;
+ nux::TextEntry* text_entry = NULL;
+
+ ATK_OBJECT_CLASS(unity_text_input_accessible_parent_class)->initialize(accessible, data);
+
+ accessible->role = ATK_ROLE_PANEL;
+
+ nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(accessible));
+ text_input = dynamic_cast<TextInput*>(nux_object);
+
+ if (text_input == NULL)
+ return;
+
+ text_entry = text_input->text_entry();
+
+ if (text_entry != NULL)
+ {
+ AtkObject* text_entry_accessible = NULL;
+ text_entry_accessible = unity_a11y_get_accessible(text_entry);
+ atk_object_set_name(text_entry_accessible, text_input->input_hint().c_str());
+ }
+}
diff --git a/plugins/unityshell/src/unity-text-input-accessible.h b/plugins/unityshell/src/unity-text-input-accessible.h
new file mode 100644
index 000000000..c1ab85636
--- /dev/null
+++ b/plugins/unityshell/src/unity-text-input-accessible.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ */
+
+#ifndef UNITY_TEXT_INPUT_ACCESSIBLE_H
+#define UNITY_TEXT_INPUT_ACCESSIBLE_H
+
+#include <atk/atk.h>
+
+#include "nux-view-accessible.h"
+
+G_BEGIN_DECLS
+
+#define UNITY_TYPE_TEXT_INPUT_ACCESSIBLE (unity_text_input_accessible_get_type ())
+#define UNITY_TEXT_INPUT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, UnityTextInputAccessible))
+#define UNITY_TEXT_INPUT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, UnityTextInputAccessibleClass))
+#define UNITY_IS_TEXT_INPUT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE))
+#define UNITY_IS_TEXT_INPUT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE))
+#define UNITY_TEXT_INPUT_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_TEXT_INPUT_ACCESSIBLE, UnityTextInputAccessibleClass))
+
+typedef struct _UnityTextInputAccessible UnityTextInputAccessible;
+typedef struct _UnityTextInputAccessibleClass UnityTextInputAccessibleClass;
+typedef struct _UnityTextInputAccessiblePrivate UnityTextInputAccessiblePrivate;
+
+struct _UnityTextInputAccessible
+{
+ NuxViewAccessible parent;
+
+ /*< private >*/
+ UnityTextInputAccessiblePrivate* priv;
+};
+
+struct _UnityTextInputAccessibleClass
+{
+ NuxViewAccessibleClass parent_class;
+};
+
+GType unity_text_input_accessible_get_type(void);
+AtkObject* unity_text_input_accessible_new(nux::Object* object);
+
+G_END_DECLS
+
+#endif