Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtk: Implementable implementation for AccessibleText #1789

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions gtk4/src/accessible_text_range.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#[derive(Copy, Clone)]
#[doc(alias = "GtkAccessibleTextRange")]
#[repr(transparent)]
pub struct AccessibleTextRange(crate::ffi::GtkAccessibleTextRange);
use glib::translate::UnsafeFrom;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use glib::translate::UnsafeFrom;
use glib::translate::*;

use gtk4_sys::GtkAccessibleTextRange;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You import it, then only use it in certain places... Usually we do use crate::ffi; and call ffi types with ffi::$Type or functions as well.


glib::wrapper! {
#[doc(alias = "GtkAccessibleTextRange")]
pub struct AccessibleTextRange(BoxedInline<crate::ffi::GtkAccessibleTextRange>);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be moved to a separate commit.


impl AccessibleTextRange {
pub fn new(start: usize, length: usize) -> Self {
unsafe { AccessibleTextRange::unsafe_from(GtkAccessibleTextRange { start, length }) }
}

pub fn start(&self) -> usize {
self.0.start
self.inner.start
}

pub fn length(&self) -> usize {
self.0.length
self.inner.length
}
}

Expand Down
3 changes: 3 additions & 0 deletions gtk4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ mod tree_view;
mod tree_view_column;
mod widget;

#[cfg(feature = "v4_14")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
pub use accessible_text_range::AccessibleTextRange;
pub use bitset_iter::BitsetIter;
pub use border::Border;
pub use builder_cscope::BuilderCScope;
Expand Down
Loading
Loading