bug 735915 - make atk interface vfuncs static r=askalski, ginn.chen

This commit is contained in:
Trevor Saunders 2012-03-20 00:02:50 -04:00
Родитель 704850269d
Коммит 31076e0bed
27 изменённых файлов: 370 добавлений и 1076 удалений

Просмотреть файл

@ -39,16 +39,20 @@
#include <atk/atk.h>
#include "AtkSocketAccessible.h"
#include "nsMai.h"
#include "nsMaiInterfaceComponent.h"
void (*AtkSocketAccessible::g_atk_socket_embed) (AtkSocket*, gchar*) = NULL;
#include "InterfaceInitFuncs.h"
#include "nsMai.h"
AtkSocketEmbedType AtkSocketAccessible::g_atk_socket_embed = NULL;
GType AtkSocketAccessible::g_atk_socket_type = G_TYPE_INVALID;
const char* AtkSocketAccessible::sATKSocketEmbedSymbol = "atk_socket_embed";
const char* AtkSocketAccessible::sATKSocketGetTypeSymbol = "atk_socket_get_type";
bool AtkSocketAccessible::gCanEmbed = FALSE;
extern "C" void mai_atk_component_iface_init(AtkComponentIface* aIface);
extern "C" GType mai_atk_socket_get_type(void);
/* MaiAtkSocket */
#define MAI_TYPE_ATK_SOCKET (mai_atk_socket_get_type ())
@ -65,39 +69,17 @@ bool AtkSocketAccessible::gCanEmbed = FALSE;
MAI_TYPE_ATK_SOCKET,\
MaiAtkSocketClass))
typedef struct _MaiAtkSocket MaiAtkSocket;
typedef struct _MaiAtkSocketClass MaiAtkSocketClass;
struct _MaiAtkSocket
typedef struct _MaiAtkSocket
{
AtkSocket parent;
nsAccessibleWrap* accWrap;
};
} MaiAtkSocket;
struct _MaiAtkSocketClass
typedef struct _MaiAtkSocketClass
{
AtkSocketClass parent_class;
};
G_BEGIN_DECLS
GType mai_atk_socket_get_type(void);
AtkObject* mai_atk_socket_new(nsAccessibleWrap* aAccWrap);
void mai_atk_component_iface_init(AtkComponentIface* aIface);
AtkObject* mai_atk_socket_ref_accessible_at_point(AtkComponent *aComponent,
gint aAccX,
gint aAccY,
AtkCoordType aCoordType);
void mai_atk_socket_get_extents(AtkComponent* aComponent,
gint* aAccX,
gint* aAccY,
gint* aAccWidth,
gint* aAccHeight,
AtkCoordType aCoordType);
G_END_DECLS
} MaiAtkSocketClass;
G_DEFINE_TYPE_EXTENDED(MaiAtkSocket, mai_atk_socket,
AtkSocketAccessible::g_atk_socket_type, 0,
@ -114,7 +96,7 @@ mai_atk_socket_init(MaiAtkSocket* aAcc)
{
}
AtkObject*
static AtkObject*
mai_atk_socket_new(nsAccessibleWrap* aAccWrap)
{
NS_ENSURE_TRUE(aAccWrap, NULL);
@ -127,19 +109,10 @@ mai_atk_socket_new(nsAccessibleWrap* aAccWrap)
return ATK_OBJECT(acc);
}
void
mai_atk_component_iface_init(AtkComponentIface* aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
aIface->ref_accessible_at_point = mai_atk_socket_ref_accessible_at_point;
aIface->get_extents = mai_atk_socket_get_extents;
}
AtkObject*
mai_atk_socket_ref_accessible_at_point(AtkComponent* aComponent,
gint aX, gint aY,
AtkCoordType aCoordType)
extern "C" {
static AtkObject*
RefAccessibleAtPoint(AtkComponent* aComponent, gint aX, gint aY,
AtkCoordType aCoordType)
{
NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nsnull);
@ -147,10 +120,9 @@ mai_atk_socket_ref_accessible_at_point(AtkComponent* aComponent,
aX, aY, aCoordType);
}
void
mai_atk_socket_get_extents(AtkComponent* aComponent,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType)
static void
GetExtents(AtkComponent* aComponent, gint* aX, gint* aY, gint* aWidth,
gint* aHeight, AtkCoordType aCoordType)
{
*aX = *aY = *aWidth = *aHeight = 0;
@ -160,6 +132,18 @@ mai_atk_socket_get_extents(AtkComponent* aComponent,
getExtentsHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
aX, aY, aWidth, aHeight, aCoordType);
}
}
void
mai_atk_component_iface_init(AtkComponentIface* aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if (NS_UNLIKELY(!aIface))
return;
aIface->ref_accessible_at_point = RefAccessibleAtPoint;
aIface->get_extents = GetExtents;
}
AtkSocketAccessible::AtkSocketAccessible(nsIContent* aContent,
nsDocAccessible* aDoc,

Просмотреть файл

@ -45,9 +45,9 @@
// This file gets included by nsAccessibilityService.cpp, which can't include
// atk.h (or glib.h), so we can't rely on it being included.
#ifdef __ATK_H__
typedef void (*AtkSocketEmbedType) (AtkSocket*, gchar*);
extern "C" typedef void (*AtkSocketEmbedType) (AtkSocket*, gchar*);
#else
typedef void (*AtkSocketEmbedType) (void*, void*);
extern "C" typedef void (*AtkSocketEmbedType) (void*, void*);
#endif
/**

Просмотреть файл

@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* * You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ATK_INTERFACE_INIT_FUNCS_H_
#define ATK_INTERFACE_INIT_FUNCS_H_
#include <atk/atk.h>
class nsAccessibleWrap;
extern "C" {
void actionInterfaceInitCB(AtkActionIface* aIface);
void componentInterfaceInitCB(AtkComponentIface* aIface);
void documentInterfaceInitCB(AtkDocumentIface *aIface);
void editableTextInterfaceInitCB(AtkEditableTextIface* aIface);
void hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface);
void hypertextInterfaceInitCB(AtkHypertextIface* aIface);
void imageInterfaceInitCB(AtkImageIface* aIface);
void selectionInterfaceInitCB(AtkSelectionIface* aIface);
void tableInterfaceInitCB(AtkTableIface *aIface);
void textInterfaceInitCB(AtkTextIface* aIface);
void valueInterfaceInitCB(AtkValueIface *aIface);
}
/**
* XXX these should live in a file of utils for atk.
*/
AtkObject* refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap,
gint aX, gint aY, AtkCoordType aCoordType);
void getExtentsHelper(nsAccessibleWrap* aAccWrap,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType);
#endif // ATK_INTERFACE_INIT_FUNCS_H_

Просмотреть файл

@ -39,7 +39,6 @@
#include "nsAccessNodeWrap.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsMaiInterfaceText.h"
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html

Просмотреть файл

@ -43,12 +43,15 @@
#include "nsAccessible.h"
#include "nsAccessibleWrap.h"
#include "InterfaceInitFuncs.h"
#include "nsAccUtils.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsIAccessibleRelation.h"
#include "nsRootAccessible.h"
#include "nsDocAccessibleWrap.h"
#include "nsIAccessibleValue.h"
#include "nsMai.h"
#include "nsMaiHyperlink.h"
#include "nsString.h"
#include "nsAutoPtr.h"
#include "prprf.h"
@ -57,19 +60,8 @@
#include "Relation.h"
#include "States.h"
#include "nsMaiInterfaceComponent.h"
#include "nsMaiInterfaceAction.h"
#include "nsMaiInterfaceText.h"
#include "nsMaiInterfaceEditableText.h"
#include "nsMaiInterfaceSelection.h"
#include "nsMaiInterfaceValue.h"
#include "nsMaiInterfaceHypertext.h"
#include "nsMaiInterfaceHyperlinkImpl.h"
#include "nsMaiInterfaceTable.h"
#include "nsXPCOMStrings.h"
#include "nsComponentManagerUtils.h"
#include "nsMaiInterfaceDocument.h"
#include "nsMaiInterfaceImage.h"
using namespace mozilla;
using namespace mozilla::a11y;

Просмотреть файл

@ -37,32 +37,18 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceAction.h"
#include "InterfaceInitFuncs.h"
#include "nsAccUtils.h"
#include "nsRoleMap.h"
#include "nsString.h"
#include "nsMai.h"
#include "Role.h"
#include "nsIDOMDOMStringList.h"
#include "nsString.h"
using namespace mozilla::a11y;
void
actionInterfaceInitCB(AtkActionIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
extern "C" {
aIface->do_action = doActionCB;
aIface->get_n_actions = getActionCountCB;
aIface->get_description = getActionDescriptionCB;
aIface->get_keybinding = getKeyBindingCB;
aIface->get_name = getActionNameCB;
}
gboolean
static gboolean
doActionCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
@ -73,14 +59,14 @@ doActionCB(AtkAction *aAction, gint aActionIndex)
return (NS_FAILED(rv)) ? FALSE : TRUE;
}
gint
static gint
getActionCountCB(AtkAction *aAction)
{
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
return accWrap ? accWrap->ActionCount() : 0;
}
const gchar *
static const gchar*
getActionDescriptionCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
@ -93,7 +79,7 @@ getActionDescriptionCB(AtkAction *aAction, gint aActionIndex)
return nsAccessibleWrap::ReturnString(description);
}
const gchar *
static const gchar*
getActionNameCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
@ -106,7 +92,7 @@ getActionNameCB(AtkAction *aAction, gint aActionIndex)
return nsAccessibleWrap::ReturnString(autoStr);
}
const gchar *
static const gchar*
getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap* acc = GetAccessibleWrap(ATK_OBJECT(aAction));
@ -156,3 +142,18 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
return nsAccessibleWrap::ReturnString(keyBindingsStr);
}
}
void
actionInterfaceInitCB(AtkActionIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
return;
aIface->do_action = doActionCB;
aIface->get_n_actions = getActionCountCB;
aIface->get_description = getActionDescriptionCB;
aIface->get_keybinding = getKeyBindingCB;
aIface->get_name = getActionNameCB;
}

Просмотреть файл

@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_ACTION_H__
#define __MAI_INTERFACE_ACTION_H__
#include "nsMai.h"
G_BEGIN_DECLS
/* action interface callbacks */
void actionInterfaceInitCB(AtkActionIface *aIface);
gboolean doActionCB(AtkAction *aAction, gint aActionIndex);
gint getActionCountCB(AtkAction *aAction);
const gchar *getActionDescriptionCB(AtkAction *aAction, gint aActionIndex);
const gchar *getActionNameCB(AtkAction *aAction, gint aActionIndex);
const gchar *getKeyBindingCB(AtkAction *aAction, gint aActionIndex);
G_END_DECLS
#endif /* __MAI_INTERFACE_ACTION_H__ */

Просмотреть файл

@ -37,29 +37,16 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceComponent.h"
#include "InterfaceInitFuncs.h"
#include "nsAccessibleWrap.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsMai.h"
void
componentInterfaceInitCB(AtkComponentIface *aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if(!aIface)
return;
extern "C" {
/*
* Use default implementation in atk for contains, get_position,
* and get_size
*/
aIface->ref_accessible_at_point = refAccessibleAtPointCB;
aIface->get_extents = getExtentsCB;
aIface->grab_focus = grabFocusCB;
}
AtkObject*
static AtkObject*
refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
AtkCoordType aCoordType)
{
@ -67,7 +54,7 @@ refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
aAccX, aAccY, aCoordType);
}
void
static void
getExtentsCB(AtkComponent* aComponent, gint* aX, gint* aY,
gint* aWidth, gint* aHeight, AtkCoordType aCoordType)
{
@ -75,7 +62,7 @@ getExtentsCB(AtkComponent* aComponent, gint* aX, gint* aY,
aX, aY, aWidth, aHeight, aCoordType);
}
gboolean
static gboolean
grabFocusCB(AtkComponent* aComponent)
{
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
@ -85,6 +72,7 @@ grabFocusCB(AtkComponent* aComponent)
nsresult rv = accWrap->TakeFocus();
return (NS_FAILED(rv)) ? FALSE : TRUE;
}
}
AtkObject*
refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap, gint aX, gint aY,
@ -140,3 +128,19 @@ getExtentsHelper(nsAccessibleWrap* aAccWrap,
*aWidth = width;
*aHeight = height;
}
void
componentInterfaceInitCB(AtkComponentIface* aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if(NS_UNLIKELY(!aIface))
return;
/*
* Use default implementation in atk for contains, get_position,
* and get_size
*/
aIface->ref_accessible_at_point = refAccessibleAtPointCB;
aIface->get_extents = getExtentsCB;
aIface->grab_focus = grabFocusCB;
}

Просмотреть файл

@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_COMPONENT_H__
#define __MAI_INTERFACE_COMPONENT_H__
#include "nsMai.h"
G_BEGIN_DECLS
/* component interface callbacks */
void componentInterfaceInitCB(AtkComponentIface* aIface);
AtkObject* refAccessibleAtPointCB(AtkComponent* aComponent,
gint aX, gint aY,
AtkCoordType aCoordType);
void getExtentsCB(AtkComponent* aComponent,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType);
/* the "contains", "get_position", "get_size" can take advantage of
* "get_extents", there is no need to implement them now.
*/
gboolean grabFocusCB(AtkComponent* aComponent);
/* what are missing now for atk component:
*
* add_focus_handler
* remove_focus_handler
* set_extents
* set_position
* set_size
* get_layer
* get_mdi_zorder
*/
AtkObject* refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap,
gint aX, gint aY, AtkCoordType aCoordType);
void getExtentsHelper(nsAccessibleWrap* aAccWrap,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType);
G_END_DECLS
#endif /* __MAI_INTERFACE_COMPONENT_H__ */

Просмотреть файл

@ -37,10 +37,11 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceDocument.h"
#include "InterfaceInitFuncs.h"
#include "nsAccessibleWrap.h"
#include "nsDocAccessible.h"
#include "nsMai.h"
static const char* const kDocTypeName = "W3C-doctype";
static const char* const kDocUrlName = "DocURL";
@ -58,7 +59,7 @@ void
documentInterfaceInitCB(AtkDocumentIface *aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if(!aIface)
if(NS_UNLIKELY(!aIface))
return;
/*

Просмотреть файл

@ -1,52 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Evan Yan (evan.yan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_DOCUMENT_H__
#define __MAI_INTERFACE_DOCUMENT_H__
#include "nsMai.h"
G_BEGIN_DECLS
/* document interface callbacks */
void documentInterfaceInitCB(AtkDocumentIface *aIface);
G_END_DECLS
#endif /* __MAI_INTERFACE_DOCUMENT_H__ */

Просмотреть файл

@ -37,31 +37,18 @@
*
* ***** END LICENSE BLOCK ***** */
#include "InterfaceInitFuncs.h"
#include "nsHyperTextAccessible.h"
#include "nsMai.h"
#include "nsString.h"
#include "nsMaiInterfaceEditableText.h"
void
editableTextInterfaceInitCB(AtkEditableTextIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
extern "C" {
aIface->set_run_attributes = setRunAttributesCB;
aIface->set_text_contents = setTextContentsCB;
aIface->insert_text = insertTextCB;
aIface->copy_text = copyTextCB;
aIface->cut_text = cutTextCB;
aIface->delete_text = deleteTextCB;
aIface->paste_text = pasteTextCB;
}
/* static, callbacks for atkeditabletext virutal functions */
gboolean
static gboolean
setRunAttributesCB(AtkEditableText *aText, AtkAttributeSet *aAttribSet,
gint aStartOffset, gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
@ -80,7 +67,7 @@ setRunAttributesCB(AtkEditableText *aText, AtkAttributeSet *aAttribSet,
return NS_FAILED(rv) ? FALSE : TRUE;
}
void
static void
setTextContentsCB(AtkEditableText *aText, const gchar *aString)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -99,7 +86,7 @@ setTextContentsCB(AtkEditableText *aText, const gchar *aString)
accText->SetTextContents(strContent);
}
void
static void
insertTextCB(AtkEditableText *aText,
const gchar *aString, gint aLength, gint *aPosition)
{
@ -127,7 +114,7 @@ insertTextCB(AtkEditableText *aText,
aString, aLength, *aPosition));
}
void
static void
copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -145,7 +132,7 @@ copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
accText->CopyText(aStartPos, aEndPos);
}
void
static void
cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -162,7 +149,7 @@ cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
accText->CutText(aStartPos, aEndPos);
}
void
static void
deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -180,7 +167,7 @@ deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
accText->DeleteText(aStartPos, aEndPos);
}
void
static void
pasteTextCB(AtkEditableText *aText, gint aPosition)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -196,3 +183,20 @@ pasteTextCB(AtkEditableText *aText, gint aPosition)
MAI_LOG_DEBUG(("EditableText: pasteTextCB, aPosition=%d", aPosition));
accText->PasteText(aPosition);
}
}
void
editableTextInterfaceInitCB(AtkEditableTextIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
return;
aIface->set_run_attributes = setRunAttributesCB;
aIface->set_text_contents = setTextContentsCB;
aIface->insert_text = insertTextCB;
aIface->copy_text = copyTextCB;
aIface->cut_text = cutTextCB;
aIface->delete_text = deleteTextCB;
aIface->paste_text = pasteTextCB;
}

Просмотреть файл

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_EDITABLETEXT_H__
#define __MAI_INTERFACE_EDITABLETEXT_H__
#include "nsMai.h"
#include "nsIAccessibleEditableText.h"
G_BEGIN_DECLS
void editableTextInterfaceInitCB(AtkEditableTextIface *aIface);
/* editabletext interface callbacks */
gboolean setRunAttributesCB(AtkEditableText *aText,
AtkAttributeSet *aAttribSet,
gint aStartOffset,
gint aEndOffset);
void setTextContentsCB(AtkEditableText *aText, const gchar *aString);
void insertTextCB(AtkEditableText *aText,
const gchar *aString, gint aLength, gint *aPosition);
void copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
void cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
void deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
void pasteTextCB(AtkEditableText *aText, gint aPosition);
G_END_DECLS
#endif /* __MAI_INTERFACE_EDITABLETEXT_H__ */

Просмотреть файл

@ -37,18 +37,12 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceHyperlinkImpl.h"
#include "InterfaceInitFuncs.h"
#include "nsMaiHyperlink.h"
void
hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface)
{
g_return_if_fail(aIface != NULL);
aIface->get_hyperlink = getHyperlinkCB;
}
AtkHyperlink*
extern "C" {
static AtkHyperlink*
getHyperlinkCB(AtkHyperlinkImpl* aImpl)
{
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
@ -61,3 +55,14 @@ getHyperlinkCB(AtkHyperlinkImpl* aImpl)
NS_ENSURE_TRUE(maiHyperlink, nsnull);
return maiHyperlink->GetAtkHyperlink();
}
}
void
hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
return;
aIface->get_hyperlink = getHyperlinkCB;
}

Просмотреть файл

@ -1,55 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Neo Liu(nian.liu@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_HYPERLINKIMPL_H__
#define __MAI_INTERFACE_HYPERLINKIMPL_H__
#include "nsMai.h"
G_BEGIN_DECLS
void hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface);
/* hyperlinkImpl interface callbacks */
AtkHyperlink *getHyperlinkCB (AtkHyperlinkImpl *aImpl);
G_END_DECLS
#endif /* __MAI_INTERFACE_HYPERLINKIMPL_H__ */

Просмотреть файл

@ -37,20 +37,15 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceHypertext.h"
#include "InterfaceInitFuncs.h"
#include "nsHyperTextAccessible.h"
#include "nsMai.h"
#include "nsMaiHyperlink.h"
void
hypertextInterfaceInitCB(AtkHypertextIface *aIface)
{
g_return_if_fail(aIface != NULL);
extern "C" {
aIface->get_link = getLinkCB;
aIface->get_n_links = getLinkCountCB;
aIface->get_link_index = getLinkIndexCB;
}
AtkHyperlink *
static AtkHyperlink*
getLinkCB(AtkHypertext *aText, gint aLinkIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -73,7 +68,7 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
return maiHyperlink->GetAtkHyperlink();
}
gint
static gint
getLinkCountCB(AtkHypertext *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -86,7 +81,7 @@ getLinkCountCB(AtkHypertext *aText)
return hyperText->GetLinkCount();
}
gint
static gint
getLinkIndexCB(AtkHypertext *aText, gint aCharIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -102,3 +97,16 @@ getLinkIndexCB(AtkHypertext *aText, gint aCharIndex)
return index;
}
}
void
hypertextInterfaceInitCB(AtkHypertextIface* aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
return;
aIface->get_link = getLinkCB;
aIface->get_n_links = getLinkCountCB;
aIface->get_link_index = getLinkIndexCB;
}

Просмотреть файл

@ -1,58 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_HYPERTEXT_H__
#define __MAI_INTERFACE_HYPERTEXT_H__
#include "nsMai.h"
#include "nsMaiHyperlink.h"
#include "nsIAccessibleHyperText.h"
G_BEGIN_DECLS
void hypertextInterfaceInitCB(AtkHypertextIface *aIface);
/* hypertext interface callbacks */
AtkHyperlink *getLinkCB(AtkHypertext *aText, gint aLinkIndex);
gint getLinkCountCB(AtkHypertext *aText);
gint getLinkIndexCB(AtkHypertext *aText, gint aCharIndex);
G_END_DECLS
#endif /* __MAI_INTERFACE_HYPERTEXT_H__ */

Просмотреть файл

@ -37,25 +37,16 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceImage.h"
#include "InterfaceInitFuncs.h"
#include "nsAccessibleWrap.h"
#include "nsHTMLImageAccessible.h"
#include "nsMai.h"
extern "C" const gchar* getDescriptionCB(AtkObject* aAtkObj);
extern "C" {
const gchar* getDescriptionCB(AtkObject* aAtkObj);
void
imageInterfaceInitCB(AtkImageIface *aIface)
{
g_return_if_fail(aIface != NULL);
aIface->get_image_position = getImagePositionCB;
aIface->get_image_description = getImageDescriptionCB;
aIface->get_image_size = getImageSizeCB;
}
void
static void
getImagePositionCB(AtkImage *aImage, gint *aAccX, gint *aAccY,
AtkCoordType aCoordType)
{
@ -71,13 +62,13 @@ getImagePositionCB(AtkImage *aImage, gint *aAccX, gint *aAccY,
image->GetImagePosition(geckoCoordType, aAccX, aAccY);
}
const gchar *
static const gchar*
getImageDescriptionCB(AtkImage *aImage)
{
return getDescriptionCB(ATK_OBJECT(aImage));
}
void
static void
getImageSizeCB(AtkImage *aImage, gint *aAccWidth, gint *aAccHeight)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
@ -86,3 +77,16 @@ getImageSizeCB(AtkImage *aImage, gint *aAccWidth, gint *aAccHeight)
accWrap->AsImage()->GetImageSize(aAccWidth, aAccHeight);
}
}
void
imageInterfaceInitCB(AtkImageIface* aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
return;
aIface->get_image_position = getImagePositionCB;
aIface->get_image_description = getImageDescriptionCB;
aIface->get_image_size = getImageSizeCB;
}

Просмотреть файл

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gao, Ming (gaoming@cn.ibm.com)
* Neo Liu(nian.liu@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_IMAGE_H__
#define __MAI_INTERFACE_IMAGE_H__
#include "nsMai.h"
#include "nsIAccessibleImage.h"
G_BEGIN_DECLS
void imageInterfaceInitCB(AtkImageIface *aIface);
/* image interface callbacks */
void getImagePositionCB(AtkImage *aImage,
gint *aAccX,
gint *aAccY,
AtkCoordType aCoordType);
const gchar* getImageDescriptionCB(AtkImage *aImage);
void getImageSizeCB(AtkImage *aImage,
gint *aAccWidth,
gint *aAccHeight);
G_END_DECLS
#endif /* __MAI_INTERFACE_DOCUMENT_H__ */

Просмотреть файл

@ -37,25 +37,16 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceSelection.h"
#include "InterfaceInitFuncs.h"
void
selectionInterfaceInitCB(AtkSelectionIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
#include "nsAccessibleWrap.h"
#include "nsMai.h"
aIface->add_selection = addSelectionCB;
aIface->clear_selection = clearSelectionCB;
aIface->ref_selection = refSelectionCB;
aIface->get_selection_count = getSelectionCountCB;
aIface->is_child_selected = isChildSelectedCB;
aIface->remove_selection = removeSelectionCB;
aIface->select_all_selection = selectAllSelectionCB;
}
#include <atk/atk.h>
gboolean
extern "C" {
static gboolean
addSelectionCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
@ -65,7 +56,7 @@ addSelectionCB(AtkSelection *aSelection, gint i)
return accWrap->AddItemToSelection(i);
}
gboolean
static gboolean
clearSelectionCB(AtkSelection *aSelection)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
@ -75,7 +66,7 @@ clearSelectionCB(AtkSelection *aSelection)
return accWrap->UnselectAll();
}
AtkObject *
static AtkObject*
refSelectionCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
@ -93,7 +84,7 @@ refSelectionCB(AtkSelection *aSelection, gint i)
return atkObj;
}
gint
static gint
getSelectionCountCB(AtkSelection *aSelection)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
@ -103,7 +94,7 @@ getSelectionCountCB(AtkSelection *aSelection)
return accWrap->SelectedItemCount();
}
gboolean
static gboolean
isChildSelectedCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
@ -113,7 +104,7 @@ isChildSelectedCB(AtkSelection *aSelection, gint i)
return accWrap->IsItemSelected(i);
}
gboolean
static gboolean
removeSelectionCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
@ -123,7 +114,7 @@ removeSelectionCB(AtkSelection *aSelection, gint i)
return accWrap->RemoveItemFromSelection(i);
}
gboolean
static gboolean
selectAllSelectionCB(AtkSelection *aSelection)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
@ -132,3 +123,20 @@ selectAllSelectionCB(AtkSelection *aSelection)
return accWrap->SelectAll();
}
}
void
selectionInterfaceInitCB(AtkSelectionIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
return;
aIface->add_selection = addSelectionCB;
aIface->clear_selection = clearSelectionCB;
aIface->ref_selection = refSelectionCB;
aIface->get_selection_count = getSelectionCountCB;
aIface->is_child_selected = isChildSelectedCB;
aIface->remove_selection = removeSelectionCB;
aIface->select_all_selection = selectAllSelectionCB;
}

Просмотреть файл

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Silvia Zhao (silvia.zhao@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_SELECTION_H__
#define __MAI_INTERFACE_SELECTION_H__
#include "nsMai.h"
G_BEGIN_DECLS
/* selection interface callbacks */
void selectionInterfaceInitCB(AtkSelectionIface *aIface);
gboolean addSelectionCB(AtkSelection *aSelection, gint i);
gboolean clearSelectionCB(AtkSelection *aSelection);
AtkObject *refSelectionCB(AtkSelection *aSelection, gint i);
gint getSelectionCountCB(AtkSelection *aSelection);
gboolean isChildSelectedCB(AtkSelection *aSelection, gint i);
gboolean removeSelectionCB(AtkSelection *aSelection, gint i);
gboolean selectAllSelectionCB(AtkSelection *aSelection);
G_END_DECLS
#endif /* __MAI_INTERFACE_SELECTION_H__ */

Просмотреть файл

@ -37,41 +37,18 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceTable.h"
#include "InterfaceInitFuncs.h"
#include "nsAccessibleWrap.h"
#include "nsAccUtils.h"
#include "nsIAccessibleTable.h"
#include "nsMai.h"
#include "nsArrayUtils.h"
void
tableInterfaceInitCB(AtkTableIface *aIface)
extern "C" {
{
g_return_if_fail(aIface != NULL);
aIface->ref_at = refAtCB;
aIface->get_index_at = getIndexAtCB;
aIface->get_column_at_index = getColumnAtIndexCB;
aIface->get_row_at_index = getRowAtIndexCB;
aIface->get_n_columns = getColumnCountCB;
aIface->get_n_rows = getRowCountCB;
aIface->get_column_extent_at = getColumnExtentAtCB;
aIface->get_row_extent_at = getRowExtentAtCB;
aIface->get_caption = getCaptionCB;
aIface->get_column_description = getColumnDescriptionCB;
aIface->get_column_header = getColumnHeaderCB;
aIface->get_row_description = getRowDescriptionCB;
aIface->get_row_header = getRowHeaderCB;
aIface->get_summary = getSummaryCB;
aIface->get_selected_columns = getSelectedColumnsCB;
aIface->get_selected_rows = getSelectedRowsCB;
aIface->is_column_selected = isColumnSelectedCB;
aIface->is_row_selected = isRowSelectedCB;
aIface->is_selected = isCellSelectedCB;
}
/* static */
AtkObject*
static AtkObject*
refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -95,7 +72,7 @@ refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
return cellAtkObj;
}
gint
static gint
getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -114,7 +91,7 @@ getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
return static_cast<gint>(index);
}
gint
static gint
getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -133,7 +110,7 @@ getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
return static_cast<gint>(col);
}
gint
static gint
getRowAtIndexCB(AtkTable *aTable, gint aIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -152,7 +129,7 @@ getRowAtIndexCB(AtkTable *aTable, gint aIndex)
return static_cast<gint>(row);
}
gint
static gint
getColumnCountCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -171,7 +148,7 @@ getColumnCountCB(AtkTable *aTable)
return static_cast<gint>(count);
}
gint
static gint
getRowCountCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -190,7 +167,7 @@ getRowCountCB(AtkTable *aTable)
return static_cast<gint>(count);
}
gint
static gint
getColumnExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn)
{
@ -210,7 +187,7 @@ getColumnExtentAtCB(AtkTable *aTable,
return static_cast<gint>(extent);
}
gint
static gint
getRowExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn)
{
@ -230,7 +207,7 @@ getRowExtentAtCB(AtkTable *aTable,
return static_cast<gint>(extent);
}
AtkObject*
static AtkObject*
getCaptionCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -250,7 +227,7 @@ getCaptionCB(AtkTable *aTable)
return nsAccessibleWrap::GetAtkObject(caption);
}
const gchar*
static const gchar*
getColumnDescriptionCB(AtkTable *aTable, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -269,7 +246,7 @@ getColumnDescriptionCB(AtkTable *aTable, gint aColumn)
return nsAccessibleWrap::ReturnString(autoStr);
}
AtkObject*
static AtkObject*
getColumnHeaderCB(AtkTable *aTable, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -311,7 +288,7 @@ getColumnHeaderCB(AtkTable *aTable, gint aColumn)
return nsnull;
}
const gchar*
static const gchar*
getRowDescriptionCB(AtkTable *aTable, gint aRow)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -330,7 +307,7 @@ getRowDescriptionCB(AtkTable *aTable, gint aRow)
return nsAccessibleWrap::ReturnString(autoStr);
}
AtkObject*
static AtkObject*
getRowHeaderCB(AtkTable *aTable, gint aRow)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -372,7 +349,7 @@ getRowHeaderCB(AtkTable *aTable, gint aRow)
return nsnull;
}
AtkObject*
static AtkObject*
getSummaryCB(AtkTable *aTable)
{
// Neither html:table nor xul:tree nor ARIA grid/tree have an ability to
@ -382,7 +359,7 @@ getSummaryCB(AtkTable *aTable)
return nsnull;
}
gint
static gint
getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -417,7 +394,7 @@ getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
return size;
}
gint
static gint
getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -452,7 +429,7 @@ getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
return size;
}
gboolean
static gboolean
isColumnSelectedCB(AtkTable *aTable, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -469,7 +446,7 @@ isColumnSelectedCB(AtkTable *aTable, gint aColumn)
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
gboolean
static gboolean
isRowSelectedCB(AtkTable *aTable, gint aRow)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -486,7 +463,7 @@ isRowSelectedCB(AtkTable *aTable, gint aRow)
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
gboolean
static gboolean
isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
@ -502,3 +479,32 @@ isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
}
void
tableInterfaceInitCB(AtkTableIface* aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
return;
aIface->ref_at = refAtCB;
aIface->get_index_at = getIndexAtCB;
aIface->get_column_at_index = getColumnAtIndexCB;
aIface->get_row_at_index = getRowAtIndexCB;
aIface->get_n_columns = getColumnCountCB;
aIface->get_n_rows = getRowCountCB;
aIface->get_column_extent_at = getColumnExtentAtCB;
aIface->get_row_extent_at = getRowExtentAtCB;
aIface->get_caption = getCaptionCB;
aIface->get_column_description = getColumnDescriptionCB;
aIface->get_column_header = getColumnHeaderCB;
aIface->get_row_description = getRowDescriptionCB;
aIface->get_row_header = getRowHeaderCB;
aIface->get_summary = getSummaryCB;
aIface->get_selected_columns = getSelectedColumnsCB;
aIface->get_selected_rows = getSelectedRowsCB;
aIface->is_column_selected = isColumnSelectedCB;
aIface->is_row_selected = isRowSelectedCB;
aIface->is_selected = isCellSelectedCB;
}

Просмотреть файл

@ -1,121 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_TABLE_H__
#define __MAI_INTERFACE_TABLE_H__
#include "nsMai.h"
#include "nsIAccessibleTable.h"
G_BEGIN_DECLS
/* table interface callbacks */
void tableInterfaceInitCB(AtkTableIface *aIface);
AtkObject* refAtCB(AtkTable *aTable, gint aRow, gint aColumn);
gint getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn);
gint getColumnAtIndexCB(AtkTable *aTable, gint aIndex);
gint getRowAtIndexCB(AtkTable *aTable, gint aIndex);
gint getColumnCountCB(AtkTable *aTable);
gint getRowCountCB(AtkTable *aTable);
gint getColumnExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
gint getRowExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
AtkObject* getCaptionCB(AtkTable *aTable);
const gchar* getColumnDescriptionCB(AtkTable *aTable, gint aColumn);
AtkObject* getColumnHeaderCB(AtkTable *aTable, gint aColumn);
const gchar* getRowDescriptionCB(AtkTable *aTable, gint aRow);
AtkObject* getRowHeaderCB(AtkTable *aTable, gint aRow);
AtkObject* getSummaryCB(AtkTable *aTable);
gint getSelectedColumnsCB(AtkTable *aTable, gint **aSelected);
gint getSelectedRowsCB(AtkTable *aTable, gint **aSelected);
gboolean isColumnSelectedCB(AtkTable *aTable, gint aColumn);
gboolean isRowSelectedCB(AtkTable *aTable, gint aRow);
gboolean isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn);
/* what are missing now for atk table */
/* ==================================================
void (* set_caption) (AtkTable *aTable,
AtkObject *caption);
void (* set_column_description) (AtkTable *aTable,
gint aColumn,
const gchar *description);
void (* set_column_header) (AtkTable *aTable,
gint aColumn,
AtkObject *header);
void (* set_row_description) (AtkTable *aTable,
gint aRow,
const gchar *description);
void (* set_row_header) (AtkTable *aTable,
gint aRow,
AtkObject *header);
void (* set_summary) (AtkTable *aTable,
AtkObject *accessible);
gboolean (* add_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* remove_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* add_column_selection) (AtkTable *aTable,
gint aColumn);
gboolean (* remove_column_selection) (AtkTable *aTable,
gint aColumn);
////////////////////////////////////////
// signal handlers
//
void (* row_inserted) (AtkTable *aTable,
gint aRow,
gint num_inserted);
void (* column_inserted) (AtkTable *aTable,
gint aColumn,
gint num_inserted);
void (* row_deleted) (AtkTable *aTable,
gint aRow,
gint num_deleted);
void (* column_deleted) (AtkTable *aTable,
gint aColumn,
gint num_deleted);
void (* row_reordered) (AtkTable *aTable);
void (* column_reordered) (AtkTable *aTable);
void (* model_changed) (AtkTable *aTable);
* ==================================================
*/
G_END_DECLS
#endif /* __MAI_INTERFACE_TABLE_H__ */

Просмотреть файл

@ -38,46 +38,18 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceText.h"
#include "InterfaceInitFuncs.h"
#include "nsHyperTextAccessible.h"
#include "nsMai.h"
#include "nsRoleMap.h"
#include "nsIPersistentProperties2.h"
AtkAttributeSet* ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes);
void
textInterfaceInitCB(AtkTextIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
aIface->get_text = getTextCB;
aIface->get_text_after_offset = getTextAfterOffsetCB;
aIface->get_text_at_offset = getTextAtOffsetCB;
aIface->get_character_at_offset = getCharacterAtOffsetCB;
aIface->get_text_before_offset = getTextBeforeOffsetCB;
aIface->get_caret_offset = getCaretOffsetCB;
aIface->get_run_attributes = getRunAttributesCB;
aIface->get_default_attributes = getDefaultAttributesCB;
aIface->get_character_extents = getCharacterExtentsCB;
aIface->get_range_extents = getRangeExtentsCB;
aIface->get_character_count = getCharacterCountCB;
aIface->get_offset_at_point = getOffsetAtPointCB;
aIface->get_n_selections = getTextSelectionCountCB;
aIface->get_selection = getTextSelectionCB;
// set methods
aIface->add_selection = addTextSelectionCB;
aIface->remove_selection = removeTextSelectionCB;
aIface->set_selection = setTextSelectionCB;
aIface->set_caret_offset = setCaretOffsetCB;
}
void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
static void
ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
{
// convert each char to "*" when it's "password text"
PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
@ -87,7 +59,9 @@ void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
}
}
gchar *
extern "C" {
static gchar*
getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -110,7 +84,7 @@ getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gchar *
static gchar*
getTextAfterOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset)
@ -139,7 +113,7 @@ getTextAfterOffsetCB(AtkText *aText, gint aOffset,
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gchar *
static gchar*
getTextAtOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset)
@ -168,7 +142,7 @@ getTextAtOffsetCB(AtkText *aText, gint aOffset,
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gunichar
static gunichar
getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -194,7 +168,7 @@ getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
}
gchar *
static gchar*
getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset)
@ -223,7 +197,7 @@ getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gint
static gint
getCaretOffsetCB(AtkText *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -240,7 +214,7 @@ getCaretOffsetCB(AtkText *aText)
return (NS_FAILED(rv)) ? 0 : static_cast<gint>(offset);
}
AtkAttributeSet *
static AtkAttributeSet*
getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aStartOffset,
gint *aEndOffset)
@ -270,7 +244,7 @@ getRunAttributesCB(AtkText *aText, gint aOffset,
return ConvertToAtkAttributeSet(attributes);
}
AtkAttributeSet *
static AtkAttributeSet*
getDefaultAttributesCB(AtkText *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -290,7 +264,7 @@ getDefaultAttributesCB(AtkText *aText)
return ConvertToAtkAttributeSet(attributes);
}
void
static void
getCharacterExtentsCB(AtkText *aText, gint aOffset,
gint *aX, gint *aY,
gint *aWidth, gint *aHeight,
@ -329,7 +303,7 @@ getCharacterExtentsCB(AtkText *aText, gint aOffset,
"MaiInterfaceText::GetCharacterExtents, failed\n");
}
void
static void
getRangeExtentsCB(AtkText *aText, gint aStartOffset, gint aEndOffset,
AtkCoordType aCoords, AtkTextRectangle *aRect)
{
@ -367,7 +341,7 @@ getRangeExtentsCB(AtkText *aText, gint aStartOffset, gint aEndOffset,
"MaiInterfaceText::GetRangeExtents, failed\n");
}
gint
static gint
getCharacterCountCB(AtkText *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -379,7 +353,7 @@ getCharacterCountCB(AtkText *aText)
0 : static_cast<gint>(textAcc->CharacterCount());
}
gint
static gint
getOffsetAtPointCB(AtkText *aText,
gint aX, gint aY,
AtkCoordType aCoords)
@ -404,7 +378,7 @@ getOffsetAtPointCB(AtkText *aText,
return static_cast<gint>(offset);
}
gint
static gint
getTextSelectionCountCB(AtkText *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -422,7 +396,7 @@ getTextSelectionCountCB(AtkText *aText)
return NS_FAILED(rv) ? 0 : selectionCount;
}
gchar *
static gchar*
getTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset)
{
@ -448,7 +422,7 @@ getTextSelectionCB(AtkText *aText, gint aSelectionNum,
}
// set methods
gboolean
static gboolean
addTextSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset)
@ -467,7 +441,7 @@ addTextSelectionCB(AtkText *aText,
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}
gboolean
static gboolean
removeTextSelectionCB(AtkText *aText,
gint aSelectionNum)
{
@ -485,7 +459,7 @@ removeTextSelectionCB(AtkText *aText,
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}
gboolean
static gboolean
setTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset)
{
@ -503,7 +477,7 @@ setTextSelectionCB(AtkText *aText, gint aSelectionNum,
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}
gboolean
static gboolean
setCaretOffsetCB(AtkText *aText, gint aOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@ -518,3 +492,33 @@ setCaretOffsetCB(AtkText *aText, gint aOffset)
nsresult rv = accText->SetCaretOffset(aOffset);
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}
}
void
textInterfaceInitCB(AtkTextIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
return;
aIface->get_text = getTextCB;
aIface->get_text_after_offset = getTextAfterOffsetCB;
aIface->get_text_at_offset = getTextAtOffsetCB;
aIface->get_character_at_offset = getCharacterAtOffsetCB;
aIface->get_text_before_offset = getTextBeforeOffsetCB;
aIface->get_caret_offset = getCaretOffsetCB;
aIface->get_run_attributes = getRunAttributesCB;
aIface->get_default_attributes = getDefaultAttributesCB;
aIface->get_character_extents = getCharacterExtentsCB;
aIface->get_range_extents = getRangeExtentsCB;
aIface->get_character_count = getCharacterCountCB;
aIface->get_offset_at_point = getOffsetAtPointCB;
aIface->get_n_selections = getTextSelectionCountCB;
aIface->get_selection = getTextSelectionCB;
// set methods
aIface->add_selection = addTextSelectionCB;
aIface->remove_selection = removeTextSelectionCB;
aIface->set_selection = setTextSelectionCB;
aIface->set_caret_offset = setCaretOffsetCB;
}

Просмотреть файл

@ -1,102 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_TEXT_H__
#define __MAI_INTERFACE_TEXT_H__
#include "nsMai.h"
#include "nsIAccessibleText.h"
G_BEGIN_DECLS
void textInterfaceInitCB(AtkTextIface *aIface);
/* text interface callbacks */
gchar *getTextCB(AtkText *aText,
gint aStartOffset, gint aEndOffset);
gchar *getTextAfterOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
gchar *getTextAtOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
gunichar getCharacterAtOffsetCB(AtkText *aText, gint aOffset);
gchar *getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
gint getCaretOffsetCB(AtkText *aText);
AtkAttributeSet *getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aStartOffset,
gint *aEndOffset);
AtkAttributeSet* getDefaultAttributesCB(AtkText *aText);
void getCharacterExtentsCB(AtkText *aText, gint aOffset,
gint *aX, gint *aY,
gint *aWidth, gint *aHeight,
AtkCoordType aCoords);
void getRangeExtentsCB(AtkText *aText, gint aStartOffset,
gint aEndOffset, AtkCoordType aCoords,
AtkTextRectangle *aRect);
gint getCharacterCountCB(AtkText *aText);
gint getOffsetAtPointCB(AtkText *aText,
gint aX, gint aY,
AtkCoordType aCoords);
gint getTextSelectionCountCB(AtkText *aText);
gchar *getTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset);
// set methods
gboolean addTextSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset);
gboolean removeTextSelectionCB(AtkText *aText,
gint aSelectionNum);
gboolean setTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset);
gboolean setCaretOffsetCB(AtkText *aText, gint aOffset);
/*************************************************
// signal handlers
//
void TextChangedCB(AtkText *aText, gint aPosition, gint aLength);
void TextCaretMovedCB(AtkText *aText, gint aLocation);
void TextSelectionChangedCB(AtkText *aText);
*/
G_END_DECLS
#endif /* __MAI_INTERFACE_TEXT_H__ */

Просмотреть файл

@ -37,23 +37,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceValue.h"
#include "InterfaceInitFuncs.h"
void
valueInterfaceInitCB(AtkValueIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
#include "nsAccessibleWrap.h"
#include "nsMai.h"
aIface->get_current_value = getCurrentValueCB;
aIface->get_maximum_value = getMaximumValueCB;
aIface->get_minimum_value = getMinimumValueCB;
aIface->get_minimum_increment = getMinimumIncrementCB;
aIface->set_current_value = setCurrentValueCB;
}
extern "C" {
void
static void
getCurrentValueCB(AtkValue *obj, GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
@ -74,7 +65,7 @@ getCurrentValueCB(AtkValue *obj, GValue *value)
g_value_set_double (value, accDouble);
}
void
static void
getMaximumValueCB(AtkValue *obj, GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
@ -95,7 +86,7 @@ getMaximumValueCB(AtkValue *obj, GValue *value)
g_value_set_double (value, accDouble);
}
void
static void
getMinimumValueCB(AtkValue *obj, GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
@ -116,7 +107,7 @@ getMinimumValueCB(AtkValue *obj, GValue *value)
g_value_set_double (value, accDouble);
}
void
static void
getMinimumIncrementCB(AtkValue *obj, GValue *minimumIncrement)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
@ -137,7 +128,7 @@ getMinimumIncrementCB(AtkValue *obj, GValue *minimumIncrement)
g_value_set_double (minimumIncrement, accDouble);
}
gboolean
static gboolean
setCurrentValueCB(AtkValue *obj, const GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
@ -152,3 +143,18 @@ setCurrentValueCB(AtkValue *obj, const GValue *value)
double accDouble =g_value_get_double (value);
return !NS_FAILED(accValue->SetCurrentValue(accDouble));
}
}
void
valueInterfaceInitCB(AtkValueIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
return;
aIface->get_current_value = getCurrentValueCB;
aIface->get_maximum_value = getMaximumValueCB;
aIface->get_minimum_value = getMinimumValueCB;
aIface->get_minimum_increment = getMinimumIncrementCB;
aIface->set_current_value = setCurrentValueCB;
}

Просмотреть файл

@ -1,58 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Silvia Zhao (silvia.zhao@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_VALUE_H__
#define __MAI_INTERFACE_VALUE_H__
#include "nsMai.h"
#include "nsIAccessibleValue.h"
G_BEGIN_DECLS
/*value interface callbacks*/
void valueInterfaceInitCB(AtkValueIface *aIface);
void getCurrentValueCB(AtkValue *obj, GValue *value);
void getMaximumValueCB(AtkValue *obj, GValue *value);
void getMinimumValueCB(AtkValue *obj, GValue *value);
void getMinimumIncrementCB(AtkValue *obj, GValue *minIncrement);
gboolean setCurrentValueCB(AtkValue *obj, const GValue *value);
G_END_DECLS
#endif /* __MAI_INTERFACE_VALUE_H__ */