Struct win_wrap::uia::pattern::text::UiAutomationTextPattern

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

提供对包含文本的控件的访问。

Implementations§

source§

impl UiAutomationTextPattern

source

pub fn document_range(&self) -> UiAutomationTextRange

查询包含文档正文的文本范围。 此属性是只读的。 某些辅助文本(如页眉、脚注或批注)可能不包括在内。

source

pub fn get_selection(&self) -> Vec<UiAutomationTextRange>

查询文本范围的集合,该集合表示基于文本的控件中当前选定的文本。 如果控件支持选择多个不连续的文本范围,则 ranges 集合将为每个选定的范围接收一个文本范围。 如果控件仅包含所选文本的单个范围,则 ranges 集合将接收单个文本范围。 如果控件包含文本插入点,但未选择任何文本,则 ranges 集合将在文本插入点的位置接收一个退化(空)文本区域。 如果控件不包含文本插入点或不支持文本选择,则范围设置为 NULL。 使用 supported_text_selection 属性测试控件是否支持文本选择。

source

pub fn supported_text_selection(&self) -> SupportedTextSelection

查询一个值,该值指定控件支持的文本选择的类型。 此属性是只读的。

source

pub fn get_visible_ranges(&self) -> Vec<UiAutomationTextRange>

从基于文本的控件中检索不相交的文本范围的数组,其中每个文本区域表示可见文本的连续范围。

source

pub fn range_from_child( &self, child: &UiAutomationElement, ) -> Option<UiAutomationTextRange>

查询包含子元素(如图像、超链接、Microsoft Excel 电子表格或其他嵌入对象)的文本区域。 如果区域中没有包含子元素的文本,则返回退化(空)区域。 child 要包含在文本范围中的子元素,可以是与 UiAutomationTextPattern 关联的元素的子参数,也可以是 UiAutomationTextRange 的子元素数组的子参数。

source

pub fn range_from_point(&self, x: i32, y: i32) -> Option<UiAutomationTextRange>

查询最接近指定屏幕坐标的退化(空)文本范围。 如果屏幕坐标位于图像、超链接、Microsoft Excel 电子表格或其他嵌入对象的坐标内,则返回换行子对象的文本区域。 由于不会忽略隐藏文本,因此此方法从最接近指定坐标的可见文本中检索退化范围。 Windows Internet Explorer 9 中 range_from_point 的实现不会返回预期的结果。相反,客户应该:

  1. 调用get_visible_ranges方法以检索可见文本范围的数组。
  2. 对于数组中的每个文本范围,调用get_bounding_rectangles以检索边界矩形。
  3. 检查边界矩形以查找占据特定屏幕坐标的文本范围。

Trait Implementations§

source§

impl PatternCreator<IUIAutomationTextPattern> for UiAutomationTextPattern

source§

const PATTERN: UIA_PATTERN_ID = UIA_TextPatternId

模式的ID
source§

fn obtain(value: &UiAutomationElement) -> Result<Self, PatternError>
where <Self as TryFrom<I>>::Error: Debug,

从UI元素获取此模式。 value UI元素。
source§

impl TryFrom<IUIAutomationTextPattern> for UiAutomationTextPattern

source§

type Error = PatternError

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

fn try_from(value: IUIAutomationTextPattern) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<IUIAutomationTextPattern2> for UiAutomationTextPattern

source§

type Error = PatternError

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

fn try_from(value: IUIAutomationTextPattern2) -> Result<Self, Self::Error>

Performs the conversion.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

source§

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>,

source§

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.