avm2: Implement `TextField.alwaysShowSelection`
This commit is contained in:
parent
842f310fe7
commit
a6d321e1de
|
@ -53,20 +53,35 @@ pub fn text_field_allocator<'gc>(
|
|||
}
|
||||
|
||||
pub fn get_always_show_selection<'gc>(
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
_this: Object<'gc>,
|
||||
_activation: &mut Activation<'_, 'gc>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm2_stub_getter!(activation, "flash.text.TextField", "alwaysShowSelection");
|
||||
Ok(Value::Bool(false))
|
||||
let Some(this) = this
|
||||
.as_display_object()
|
||||
.and_then(|this| this.as_edit_text())
|
||||
else {
|
||||
return Ok(Value::Undefined);
|
||||
};
|
||||
|
||||
Ok(this.always_show_selection().into())
|
||||
}
|
||||
|
||||
pub fn set_always_show_selection<'gc>(
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
avm2_stub_setter!(activation, "flash.text.TextField", "alwaysShowSelection");
|
||||
let Some(this) = this
|
||||
.as_display_object()
|
||||
.and_then(|this| this.as_edit_text())
|
||||
else {
|
||||
return Ok(Value::Undefined);
|
||||
};
|
||||
|
||||
let value = args.get_bool(0);
|
||||
this.set_always_show_selection(&mut activation.context, value);
|
||||
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue