Fire a special scene object action when an object is clicked or object
radial menu item is selected. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2671 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: MisoScenePanel.java,v 1.44 2003/06/19 22:03:14 mdb Exp $
|
// $Id: MisoScenePanel.java,v 1.45 2003/06/19 22:20:02 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.client;
|
package com.threerings.miso.client;
|
||||||
|
|
||||||
@@ -368,7 +368,8 @@ public class MisoScenePanel extends VirtualMediaPanel
|
|||||||
|
|
||||||
// if there's no handler, just fire the action immediately
|
// if there's no handler, just fire the action immediately
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
fireObjectAction(null, scobj, new ActionEvent(this, 0, action, 0));
|
fireObjectAction(null, scobj, new SceneObjectActionEvent(
|
||||||
|
this, 0, action, 0, scobj));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,8 +381,8 @@ public class MisoScenePanel extends VirtualMediaPanel
|
|||||||
// if there's no menu for this object, fire the action immediately
|
// if there's no menu for this object, fire the action immediately
|
||||||
RadialMenu menu = handler.handlePressed(scobj);
|
RadialMenu menu = handler.handlePressed(scobj);
|
||||||
if (menu == null) {
|
if (menu == null) {
|
||||||
fireObjectAction(handler, scobj,
|
fireObjectAction(handler, scobj, new SceneObjectActionEvent(
|
||||||
new ActionEvent(this, 0, action, 0));
|
this, 0, action, 0, scobj));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,7 +401,10 @@ public class MisoScenePanel extends VirtualMediaPanel
|
|||||||
_activeMenu = menu;
|
_activeMenu = menu;
|
||||||
_activeMenu.addActionListener(new ActionListener() {
|
_activeMenu.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed (ActionEvent e) {
|
public void actionPerformed (ActionEvent e) {
|
||||||
fireObjectAction(handler, scobj, e);
|
SceneObjectActionEvent event = new SceneObjectActionEvent(
|
||||||
|
e.getSource(), e.getID(), e.getActionCommand(),
|
||||||
|
e.getModifiers(), scobj);
|
||||||
|
fireObjectAction(handler, scobj, event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_activeMenu.activate(this, mbounds, scobj);
|
_activeMenu.activate(this, mbounds, scobj);
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// $Id: SceneObjectActionEvent.java,v 1.1 2003/06/19 22:20:02 mdb Exp $
|
||||||
|
|
||||||
|
package com.threerings.miso.client;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An {@link ActionEvent} derivation that is fired when a scene object is
|
||||||
|
* clicked or menu item selected.
|
||||||
|
*/
|
||||||
|
public class SceneObjectActionEvent extends ActionEvent
|
||||||
|
{
|
||||||
|
public SceneObjectActionEvent (Object source, int id, String action,
|
||||||
|
int modifiers, SceneObject scobj)
|
||||||
|
{
|
||||||
|
super(source, id, action, modifiers);
|
||||||
|
_scobj = scobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the scene object that was the source of this action.
|
||||||
|
*/
|
||||||
|
public SceneObject getSceneObject ()
|
||||||
|
{
|
||||||
|
return _scobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SceneObject _scobj;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user