-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avm2: Migrate ContextMenu-related classes to AS
- Loading branch information
Showing
14 changed files
with
90 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package flash.display { | ||
import flash.events.EventDispatcher; | ||
public class NativeMenu extends EventDispatcher { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package flash.display { | ||
import flash.events.EventDispatcher; | ||
public class NativeMenuItem extends EventDispatcher { | ||
public var enabled: Boolean; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
//! `flash.ui` namespace | ||
pub mod contextmenu; | ||
pub mod contextmenuitem; | ||
pub mod context_menu; | ||
pub mod keyboard; | ||
pub mod mouse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package flash.ui | ||
{ | ||
import flash.display.NativeMenu; | ||
|
||
public final class ContextMenu extends NativeMenu | ||
{ | ||
public function ContextMenu() | ||
{ | ||
super(); | ||
this.customItems = new Array(); | ||
} | ||
|
||
public var customItems: Array; | ||
|
||
public native function hideBuiltInItems(): void; | ||
|
||
public static function get isSupported() : Boolean | ||
{ | ||
// TODO: return true when implementation actually affects the context menu | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package flash.ui | ||
{ | ||
import flash.display.NativeMenuItem; | ||
|
||
public final class ContextMenuItem extends NativeMenuItem | ||
{ | ||
public function ContextMenuItem( | ||
caption:String, | ||
separatorBefore:Boolean = false, | ||
enabled:Boolean = true, | ||
visible:Boolean = true | ||
) | ||
{ | ||
this.caption = caption; | ||
this.separatorBefore = separatorBefore; | ||
this.enabled = enabled; | ||
this.visible = visible; | ||
} | ||
|
||
public function clone(): ContextMenuItem | ||
{ | ||
return new ContextMenuItem(this.caption, this.separatorBefore, this.enabled, this.visible); | ||
} | ||
|
||
public var caption: String; | ||
public var separatorBefore: Boolean; | ||
public var visible: Boolean; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use crate::avm2::activation::Activation; | ||
use crate::avm2::object::Object; | ||
use crate::avm2::value::Value; | ||
use crate::avm2::Error; | ||
|
||
pub fn hide_built_in_items<'gc>( | ||
activation: &mut Activation<'_, 'gc, '_>, | ||
_this: Option<Object<'gc>>, | ||
_args: &[Value<'gc>], | ||
) -> Result<Value<'gc>, Error> { | ||
// TODO: replace this by a proper implementation. | ||
log::warn!("flash.ui.ContextMenu is a stub"); | ||
activation | ||
.context | ||
.stage | ||
.set_show_menu(&mut activation.context, false); | ||
|
||
Ok(Value::Undefined) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.