if (NS_FAILED(rv)) return FALSE; else return TRUE;
return (NS_FAILED(rv)) ? FALSE : TRUE;
static MaiInterfaceComponent *getComponent (AtkComponent *aIface);/* component interface callbacks */static void interfaceInitCB(AtkComponentIface *aIface);static AtkObject *refAccessibleAtPointCB(AtkComponent *aComponent,                                         gint aAccX, gint aAccY,                                         AtkCoordType aCoordType);static void getExtentsCB(AtkComponent *aComponent,                         gint *aAccX, gint *aAccY,                         gint *aAccWidth, gint *aAccHeight,                         AtkCoordType aCoordType);/* the "contains", "get_position", "get_size" can take advantage of * "get_extents", there is no need to implement them now. */static 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 * ================================================== */G_END_DECLSMaiInterfaceComponent::MaiInterfaceComponent(MaiWidget *aMaiWidget):    MaiInterface(aMaiWidget){}MaiInterfaceComponent::~MaiInterfaceComponent(){}MaiInterfaceTypeMaiInterfaceComponent::GetType(){    return MAI_INTERFACE_COMPONENT;}const GInterfaceInfo *MaiInterfaceComponent::GetInterfaceInfo(){    static const GInterfaceInfo atk_if_component_info = {        (GInterfaceInitFunc)interfaceInitCB,        (GInterfaceFinalizeFunc) NULL,        NULL    };    return &atk_if_component_info;}MaiObject *MaiInterfaceComponent::RefAccessibleAtPoint(gint aAccX, gint aAccY,                                            AtkCoordType aCoordType){    nsIAccessible *accessible = GetNSAccessible();    g_return_val_if_fail(accessible != NULL, NULL);    // or ATK_XY_SCREEN  what is definition this in nsIAccessible?    if (aCoordType == ATK_XY_WINDOW) {        /* deal with the coord type */    }    nsCOMPtr<nsIAccessible> pointAcc;    nsresult rv = accessible->AccGetAt(aAccX, aAccY, getter_AddRefs(pointAcc));    if (NS_FAILED(rv))        return NULL;    /* ??? when to free ??? */    MaiWidget *maiWidget = new MaiWidget(pointAcc);    return maiWidget;}voidMaiInterfaceComponent::GetExtents(gint *aAccX,                                  gint *aAccY,                                  gint *aAccWidth,                                  gint *aAccHeight,                                  AtkCoordType aCoordType){    nsIAccessible *accessible = GetNSAccessible();    g_return_if_fail(accessible != NULL);    PRInt32 nsAccX, nsAccY, nsAccWidth, nsAccHeight;    nsresult rv = accessible->AccGetBounds(&nsAccX, &nsAccY,                                           &nsAccWidth, &nsAccHeight);    if (NS_FAILED(rv))        return;    // or ATK_XY_SCREEN  what is definition this in nsIAccessible?    if (aCoordType == ATK_XY_WINDOW) {        /* deal with the coord type */    }    *aAccX = nsAccX;    *aAccY = nsAccY;    *aAccWidth = nsAccWidth;    *aAccHeight = nsAccHeight;}gbooleanMaiInterfaceComponent::GrabFocus(){    nsIAccessible *accessible = GetNSAccessible();    g_return_val_if_fail(accessible != NULL, FALSE);    nsresult rv = accessible->AccTakeFocus();    if (NS_FAILED(rv))        return FALSE;    else        return TRUE;}/* static functions *//* do general checking for callbacks functions * return the MaiInterfaceComponent extracted from atk component */MaiInterfaceComponent *getComponent(AtkComponent *aComponent){    g_return_val_if_fail(MAI_IS_ATK_WIDGET(aComponent), NULL);    MaiWidget *maiWidget = (MaiWidget*)(MAI_ATK_OBJECT(aComponent)->maiObject);    g_return_val_if_fail(maiWidget != NULL, NULL);    g_return_val_if_fail(maiWidget->GetAtkObject() == (AtkObject*)aComponent,                         NULL);    MaiInterfaceComponent *maiInterfaceComponent = (MaiInterfaceComponent*)        maiWidget->GetMaiInterface(MAI_INTERFACE_COMPONENT);    return maiInterfaceComponent;}