(MaiWidget*)(MAI_ATK_OBJECT(aEditable)->maiObject);
NS_STATIC_CAST(MaiWidget*, (MAI_ATK_OBJECT(aEditable)->maiObject));
static void interfaceInitCB(AtkEditableTextIface *aIface);/* editabletext interface callbacks */static gboolean setRunAttributesCB(AtkEditableText *aText,                                   AtkAttributeSet *aAttribSet,                                   gint aStartOffset,                                   gint aEndOffset);static void setTextContentsCB(AtkEditableText *aText, const gchar *aString);static void insertTextCB(AtkEditableText *aText,                         const gchar *aString, gint aLength, gint *aPosition);static void copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);static void cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);static void deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);static void pasteTextCB(AtkEditableText *aText, gint aPosition);G_END_DECLSMaiInterfaceEditableText::MaiInterfaceEditableText(MaiWidget *aMaiWidget):    MaiInterface(aMaiWidget){}MaiInterfaceEditableText::~MaiInterfaceEditableText(){}MaiInterfaceTypeMaiInterfaceEditableText::GetType(){    return MAI_INTERFACE_EDITABLE_TEXT;}const GInterfaceInfo *MaiInterfaceEditableText::GetInterfaceInfo(){    static const GInterfaceInfo atk_if_editabletext_info = {        (GInterfaceInitFunc)interfaceInitCB,        (GInterfaceFinalizeFunc) NULL,        NULL    };    return &atk_if_editabletext_info;}#define MAI_IFACE_RETURN_VAL_IF_FAIL(accessIface, value) \    nsCOMPtr<nsIAccessibleEditableText> \        accessIface(do_QueryInterface(GetNSAccessible())); \    if (!(accessIface)) \        return (value)#define MAI_IFACE_RETURN_IF_FAIL(accessIface) \    nsCOMPtr<nsIAccessibleEditableText> \        accessIface(do_QueryInterface(GetNSAccessible())); \    if (!(accessIface)) \        returngbooleanMaiInterfaceEditableText::SetRunAttributes(AtkAttributeSet *aAttribSet,                                           gint aStartOffset, gint aEndOffset){    MAI_IFACE_RETURN_VAL_IF_FAIL(accessIface, FALSE);    nsCOMPtr<nsISupports> attrSet;    /* how to insert attributes into nsISupports ??? */    nsresult rv = accessIface->SetAttributes(aStartOffset, aEndOffset,                                             attrSet);    return NS_FAILED(rv) ? FALSE : TRUE;}voidMaiInterfaceEditableText::SetTextContents(const gchar *aString){    MAI_IFACE_RETURN_IF_FAIL(accessIface);    NS_ConvertUTF8toUCS2 strContent(aString);    nsresult rv = accessIface->SetTextContents(strContent);    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),                     "MaiInterfaceEditableText::SetTextContents, failed\n");}voidMaiInterfaceEditableText::InsertText(const gchar *aString, gint aLength,                                     gint *aPosition){    MAI_IFACE_RETURN_IF_FAIL(accessIface);    NS_ConvertUTF8toUCS2 strContent(aString);    /////////////////////////////////////////////////////////////////////    // interface changed in nsIAccessibleEditabelText.idl ???    //    // PRInt32 pos = *aPosition;    // nsresult rv = accessIface->InsertText(strContent, aLength, &pos);    // *aPosition = pos;    /////////////////////////////////////////////////////////////////////    nsresult rv = accessIface->InsertText(strContent, *aPosition);    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),                     "MaiInterfaceEditableText::InsertText, failed\n");}voidMaiInterfaceEditableText::CopyText(gint aStartPos, gint aEndPos){    MAI_IFACE_RETURN_IF_FAIL(accessIface);    nsresult rv = accessIface->CopyText(aStartPos, aEndPos);    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),                     "MaiInterfaceEditableText::CopyText, failed\n");}voidMaiInterfaceEditableText::CutText(gint aStartPos, gint aEndPos){    MAI_IFACE_RETURN_IF_FAIL(accessIface);    nsresult rv = accessIface->CutText(aStartPos, aEndPos);    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),                     "MaiInterfaceEditableText::CutText, failed\n");}voidMaiInterfaceEditableText::DeleteText(gint aStartPos, gint aEndPos){    MAI_IFACE_RETURN_IF_FAIL(accessIface);    nsresult rv = accessIface->DeleteText(aStartPos, aEndPos);    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),                     "MaiInterfaceEditableText::DeleteText, failed\n");}voidMaiInterfaceEditableText::PasteText(gint aPosition){    MAI_IFACE_RETURN_IF_FAIL(accessIface);    nsresult rv = accessIface->PasteText(aPosition);    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),                     "MaiInterfaceEditableText::PasteText, failed\n");}/* statics *//* do general checking for callbacks functions * return the MaiInterfaceEditableText extracted from atk editabletext */MaiInterfaceEditableText *getEditableText(AtkEditableText *aEditable){    g_return_val_if_fail(MAI_IS_ATK_WIDGET(aEditable), NULL);    MaiWidget *maiWidget =        (MaiWidget*)(MAI_ATK_OBJECT(aEditable)->maiObject);    g_return_val_if_fail(maiWidget != NULL, NULL);    g_return_val_if_fail(maiWidget->GetAtkObject() == (AtkObject*)aEditable,                         NULL);    MaiInterfaceEditableText *ifaceEditableText = (MaiInterfaceEditableText*)        maiWidget->GetMaiInterface(MAI_INTERFACE_EDITABLE_TEXT);    return ifaceEditableText;}voidinterfaceInitCB(AtkEditableTextIface *aIface){    g_return_if_fail(aIface != NULL);    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;}