-
Notifications
You must be signed in to change notification settings - Fork 6
v06 solitaire controllers ColumnController.scs
George Heineman edited this page Feb 8, 2018
·
1 revision
// no name. Can be overriden by extensions
ColumnDesignate : {
box [""]
}
ColumnController : {
λname. {letbox NameParameter = {name} in {
λdp. {letbox ColumnMousePressed = {dp} in {
λdc. {letbox ColumnMouseClicked = {dc} in {
λdr. {letbox ColumnMouseReleased = {dr} in {
λcn. {letbox ColumnDesignate = {cn} in {
box ["=======" NameParameter "/" ColumnDesignate "ColumnController.java=======
package " NameParameter ";
import java.awt.event.MouseEvent;
import ks.common.model.*;
import ks.common.view.*;
import ks.common.controller.*;
public class " ColumnDesignate "ColumnController extends SolitaireReleasedAdapter {
protected " NameParameter " theGame;
/** The ColumnView being controlled */
protected ColumnView src;
public " ColumnDesignate "ColumnController(" NameParameter " theGame, ColumnView src) {
super(theGame);
this.theGame = theGame;
this.src = src;
}
public void mouseClicked(MouseEvent me) {
"
ColumnMouseClicked
"
}
public void mousePressed(MouseEvent me) {
Container c = theGame.getContainer();
// Another Safety Check
Widget w = c.getActiveDraggingObject();
if (w != Container.getNothingBeingDragged()) {
System.err.println(\"mousePressed: Unexpectedly encountered a Dragging Object during a Mouse press.\");
return;
}
// should we ignore this
boolean me_ignore = true;
Widget me_widget = null;
"
// must both define me_ignore to false and set me_widget to valid widget
ColumnMousePressed
"
if (me_ignore) {
return;
}
// We tell the container what item is being dragged (and where in the Widget it was clicked)...
c.setActiveDraggingObject(me_widget, me);
// and where it came from
c.setDragSource(src);
c.repaint();
}
public void mouseReleased(MouseEvent me) {
Container c = theGame.getContainer();
// Safety Check
Widget w = c.getActiveDraggingObject();
if (w == Container.getNothingBeingDragged()) {
return;
}
"
ColumnMouseReleased
// must be hard-coded until fixed properly.
"=======+" NameParameter "/ColumnController.java=======
// try auto moves: HACK: Should remove from common class designate
((" NameParameter ")theGame).tryAutoMoves();
// release the dragging object (this will reset container's dragSource).
c.releaseDraggingObject();
c.repaint();
}
}"]
}}
}}
}}
}}
}}
}