2020-08-26 00:40:32 +03:00
|
|
|
/* clang-format off */
|
2012-01-27 10:14:09 +04:00
|
|
|
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2020-08-26 00:40:32 +03:00
|
|
|
/* clang-format on */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2012-01-27 10:14:09 +04:00
|
|
|
|
|
|
|
#ifndef _MacUtils_H_
|
|
|
|
#define _MacUtils_H_
|
|
|
|
|
2017-08-17 02:48:52 +03:00
|
|
|
#include "nsStringFwd.h"
|
|
|
|
|
2012-01-27 10:14:09 +04:00
|
|
|
@class NSString;
|
2021-01-15 20:22:49 +03:00
|
|
|
@class mozAccessible;
|
2012-01-27 10:14:09 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
namespace utils {
|
|
|
|
|
2020-05-27 18:50:47 +03:00
|
|
|
// convert an array of Gecko accessibles to an NSArray of native accessibles
|
2022-04-01 12:49:56 +03:00
|
|
|
template <typename AccArray>
|
2022-04-01 12:50:02 +03:00
|
|
|
NSArray<mozAccessible*>* ConvertToNSArray(AccArray& aArray) {
|
|
|
|
NSMutableArray* nativeArray = [[[NSMutableArray alloc] init] autorelease];
|
|
|
|
|
|
|
|
// iterate through the list, and get each native accessible.
|
|
|
|
for (Accessible* curAccessible : aArray) {
|
|
|
|
mozAccessible* curNative = GetNativeFromGeckoAccessible(curAccessible);
|
|
|
|
if (curNative)
|
|
|
|
[nativeArray addObject:GetObjectOrRepresentedView(curNative)];
|
|
|
|
}
|
|
|
|
|
|
|
|
return nativeArray;
|
|
|
|
}
|
2020-05-27 18:50:47 +03:00
|
|
|
|
2012-01-27 10:14:09 +04:00
|
|
|
/**
|
|
|
|
* Get a localized string from the string bundle.
|
|
|
|
* Return nil if not found.
|
|
|
|
*/
|
|
|
|
NSString* LocalizedString(const nsString& aString);
|
|
|
|
|
2020-03-17 01:15:57 +03:00
|
|
|
/**
|
|
|
|
* Gets an accessible atttribute from the mozAccessible's associated
|
|
|
|
* accessible wrapper or proxy, and returns the value as an NSString.
|
|
|
|
* nil if no attribute is found.
|
|
|
|
*/
|
2021-06-11 02:07:05 +03:00
|
|
|
NSString* GetAccAttr(mozAccessible* aNativeAccessible, nsAtom* aAttrName);
|
2012-01-27 10:14:09 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|