Struct win_wrap::uia::pattern::text::UiAutomationTextRange

source ·
pub struct UiAutomationTextRange(/* private fields */);
Expand description

提供对支持 IUIAutomationTextPattern 接口的容器中连续文本范围的访问。 客户端应用程序可以使用 IUIAutomationTextRange 接口从文本范围中选择、比较和查询嵌入对象。 该接口使用两个端点来分隔文本范围的开始和结束位置。 文本的不相交范围由 IUIAutomationTextRangeArray 接口表示。

Implementations§

source§

impl UiAutomationTextRange

source

pub fn compare(&self, range: &UiAutomationTextRange) -> bool

查询一个值,该值指定此文本区域是否与另一个文本区域具有相同的端点。 range 指向要与此范围进行比较的文本范围。

source

pub fn add_to_selection(&self)

将文本区域添加到支持所选文本的多个不相交范围的控件中的选定文本范围的集合中。

source

pub fn compare_endpoints( &self, src_start_endpoint: bool, range: &UiAutomationTextRange, target_start_endpoint: bool, ) -> i32

查询一个值,该值指定此文本区域的起始或结束端点是否与另一个文本区域的起始或结束端点相同。 src_start_endpoint 源范围的端点类型,如果是true表示使用起始点,false表示使用结束点。 range 要比较的文本区域。 target_start_endpoint 目标范围的端点类型,如果是true表示使用起始点,false表示使用结束点。

source

pub fn expand_to_enclosing_unit(&self, text_unit: TextUnit)

按指定的文本单位规范化文本范围。 客户端应用程序(如屏幕阅读器)使用此方法检索插入点或插入符号位置处存在的完整单词、句子或段落。 尽管名称如此,但 expand_to_enclosing_unit 方法不一定扩展文本范围。 相反,它通过移动终结点来“规范化”文本范围,使该范围包含指定的文本单元。 如果范围小于指定单位,则扩大范围,如果范围长于指定单位,则缩短范围。 如果范围已经是指定单位的确切数量,则保持不变。 如果控件不支持指定的文本单位,则 expand_to_enclosing_unit 默认为支持的下一个最大文本单元。 从最小单位到最大单位的顺序如下: 字符、格式、词、行、段、页、文档。 expand_to_enclosing_unit 同时支持可见文本和隐藏文本。 Format,作为单位值,定位文本范围的边界,以根据范围内文本的共享文本属性(或格式)来扩展或移动范围。但是,文本单元不会在嵌入对象(如图像或超链接)的边界上移动或扩展文本范围。 有关详细信息,请参阅 UI 自动化文本单元或文本内容的 UI 自动化支持。 text_unit 文本单位,例如行或段落。

source

pub fn get_text(&self, max_length: i32) -> String

返回文本范围的纯文本。 max_length 要返回的字符串的最大长度,如果不需要限制,则为 -1。

Trait Implementations§

source§

impl Clone for UiAutomationTextRange

source§

fn clone(&self) -> UiAutomationTextRange

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UiAutomationTextRange

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Send for UiAutomationTextRange

source§

impl Sync for UiAutomationTextRange

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.