pub struct MessageText {
original_text: RefCell<String>,
is_html: Cell<bool>,
format: Cell<ContentFormat>,
detect_at_room: Cell<bool>,
sender: BoundObjectWeakRef<Member>,
}
Fields§
§original_text: RefCell<String>
The original text of the message that is displayed.
is_html: Cell<bool>
Whether the original text is HTML.
Only used for emotes.
format: Cell<ContentFormat>
The text format.
detect_at_room: Cell<bool>
Whether the message might contain an @room
mention.
sender: BoundObjectWeakRef<Member>
The sender of the message, if we need to listen to changes.
Implementations§
Source§impl MessageText
impl MessageText
Sourcefn register_type()
fn register_type()
Registers the type only once.
Source§impl MessageText
impl MessageText
Sourcepub(super) fn with_plain_text(&self, body: String, format: ContentFormat)
pub(super) fn with_plain_text(&self, body: String, format: ContentFormat)
Display the given plain text.
Sourcepub(super) fn with_markup(
&self,
formatted: Option<FormattedBody>,
body: String,
room: &Room,
format: ContentFormat,
detect_at_room: bool,
)
pub(super) fn with_markup( &self, formatted: Option<FormattedBody>, body: String, room: &Room, format: ContentFormat, detect_at_room: bool, )
Display the given text with possible markup.
It will detect if it should display the body or the formatted body.
Sourcepub(super) fn with_emote(
&self,
formatted: Option<FormattedBody>,
body: String,
sender: &Member,
room: &Room,
format: ContentFormat,
detect_at_room: bool,
)
pub(super) fn with_emote( &self, formatted: Option<FormattedBody>, body: String, sender: &Member, room: &Room, format: ContentFormat, detect_at_room: bool, )
Display the given emote for sender
.
It will detect if it should display the body or the formatted body.
Sourcefn update_emote(&self, room: &Room, sender_name: &str)
fn update_emote(&self, room: &Room, sender_name: &str)
Update the emote.
Sourcefn build_plain_text(&self, text: String)
fn build_plain_text(&self, text: String)
Build the message for the given plain text.
The text must have been escaped and the end whitespaces removed before calling this method.
Sourcefn build_text(&self, text: &str, room: &Room, sender_name: Option<&str>)
fn build_text(&self, text: &str, room: &Room, sender_name: Option<&str>)
Build the message for the given text in the given room.
We will try to detect URIs in the text.
If detect_at_room
is true
, we will try to detect @room
in the
text.
If sender_name
is provided, it is added as a prefix. This is used
for emotes.
Sourcefn build_html(
&self,
html: &str,
room: &Room,
sender_name: Option<&str>,
) -> Result<(), ()>
fn build_html( &self, html: &str, room: &Room, sender_name: Option<&str>, ) -> Result<(), ()>
Build the message for the given HTML in the given room.
We will try to detect URIs in the text.
If detect_at_room
is true
, we will try to detect @room
in the
text.
If sender_name
is provided, it is added as a prefix. This is used
for emotes.
Returns an error if the HTML string doesn’t contain any HTML.
Sourcefn original_text_changed(&self, text: &str) -> bool
fn original_text_changed(&self, text: &str) -> bool
Whether the given text is different than the current original text.
Sourcefn set_original_text(&self, text: String)
fn set_original_text(&self, text: String)
Set the original text of the message to display.
Sourcefn set_is_html(&self, is_html: bool)
fn set_is_html(&self, is_html: bool)
Set whether the original text of the message is HTML.
Sourcefn format_changed(&self, format: ContentFormat) -> bool
fn format_changed(&self, format: ContentFormat) -> bool
Whether the given format is different than the current format.
Sourcefn set_format(&self, format: ContentFormat)
fn set_format(&self, format: ContentFormat)
Set the text format.
Sourcefn detect_at_room(&self) -> bool
fn detect_at_room(&self) -> bool
Whether the message might contain an @room
mention.
Sourcefn set_detect_at_room(&self, detect_at_room: bool)
fn set_detect_at_room(&self, detect_at_room: bool)
Set whether the message might contain an @room
mention.
Sourcefn sender_changed(&self, sender: &Member) -> bool
fn sender_changed(&self, sender: &Member) -> bool
Whether the sender of the message changed.
Trait Implementations§
Source§impl Debug for MessageText
impl Debug for MessageText
Source§impl Default for MessageText
impl Default for MessageText
Source§fn default() -> MessageText
fn default() -> MessageText
Source§impl DerivedObjectProperties for MessageText
impl DerivedObjectProperties for MessageText
Source§fn derived_properties() -> &'static [ParamSpec]
fn derived_properties() -> &'static [ParamSpec]
Source§fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
ObjectImpl
but auto-generated by the Properties
macro
to allow handling more complex use-cases.Source§fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
ObjectImpl
but auto-generated by the Properties
macro
to allow handling more complex use-cases.Source§impl ObjectImpl for MessageText
impl ObjectImpl for MessageText
Source§fn properties() -> &'static [ParamSpec]
fn properties() -> &'static [ParamSpec]
Source§fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
Source§fn constructed(&self)
fn constructed(&self)
Source§fn notify(&self, pspec: &ParamSpec)
fn notify(&self, pspec: &ParamSpec)
self.notify("property")
.fn dispatch_properties_changed(&self, pspecs: &[ParamSpec])
Source§impl ObjectSubclass for MessageText
impl ObjectSubclass for MessageText
Source§type Interfaces = ()
type Interfaces = ()
Source§type Class = ClassStruct<MessageText>
type Class = ClassStruct<MessageText>
Source§type Instance = InstanceStruct<MessageText>
type Instance = InstanceStruct<MessageText>
Source§type Type = MessageText
type Type = MessageText
wrapper!
Source§type ParentType = Bin
type ParentType = Bin
Source§const ALLOW_NAME_CONFLICT: bool = false
const ALLOW_NAME_CONFLICT: bool = false
Source§fn type_init(_type_: &mut InitializingType<Self>)
fn type_init(_type_: &mut InitializingType<Self>)
Source§fn class_init(_klass: &mut Self::Class)
fn class_init(_klass: &mut Self::Class)
Source§fn with_class(_klass: &Self::Class) -> Self
fn with_class(_klass: &Self::Class) -> Self
Source§fn instance_init(_obj: &InitializingObject<Self>)
fn instance_init(_obj: &InitializingObject<Self>)
Source§impl ObjectSubclassType for MessageText
impl ObjectSubclassType for MessageText
Source§impl WidgetImpl for MessageText
impl WidgetImpl for MessageText
fn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool)
fn contains(&self, x: f64, y: f64) -> bool
fn direction_changed(&self, previous_direction: TextDirection)
fn focus(&self, direction_type: DirectionType) -> bool
fn request_mode(&self) -> SizeRequestMode
fn grab_focus(&self) -> bool
fn map(&self)
fn measure( &self, orientation: Orientation, for_size: i32, ) -> (i32, i32, i32, i32)
fn mnemonic_activate(&self, group_cycling: bool) -> bool
fn move_focus(&self, direction_type: DirectionType)
fn query_tooltip( &self, x: i32, y: i32, keyboard_tooltip: bool, tooltip: &Tooltip, ) -> bool
fn realize(&self)
fn root(&self)
fn set_focus_child(&self, child: Option<&Widget>)
fn size_allocate(&self, width: i32, height: i32, baseline: i32)
fn snapshot(&self, snapshot: &Snapshot)
fn state_flags_changed(&self, state_flags: &StateFlags)
fn system_setting_changed(&self, settings: &SystemSetting)
fn unmap(&self)
fn unrealize(&self)
fn unroot(&self)
impl BinImpl for MessageText
Auto Trait Implementations§
impl !Freeze for MessageText
impl !RefUnwindSafe for MessageText
impl !Send for MessageText
impl !Sync for MessageText
impl Unpin for MessageText
impl !UnwindSafe for MessageText
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
Source§fn parent_constructed(&self)
fn parent_constructed(&self)
glib::Object::constructed()
.Source§fn parent_notify(&self, pspec: &ParamSpec)
fn parent_notify(&self, pspec: &ParamSpec)
glib::Object::notify()
.Source§fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
glib::Object::dispatch_properties_changed()
.Source§fn signal_chain_from_overridden(
&self,
token: &SignalClassHandlerToken,
values: &[Value],
) -> Option<Value>
fn signal_chain_from_overridden( &self, token: &SignalClassHandlerToken, values: &[Value], ) -> Option<Value>
Source§impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
Source§fn instance(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
fn instance(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
Source§fn from_instance(obj: &<T as ObjectSubclass>::Type) -> &T
fn from_instance(obj: &<T as ObjectSubclass>::Type) -> &T
Source§fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
Source§fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
Source§fn ref_counted(&self) -> ObjectImplRef<T>
fn ref_counted(&self) -> ObjectImplRef<T>
self
.