A Rich UI shadow widget creates a shadow effect for the widgets that are children of a Div, FloatLeft, or FloatRight widget.
package client; import org.eclipse.edt.rui.widgets.Div; import org.eclipse.edt.rui.widgets.Shadow; import org.eclipse.edt.rui.widgets.TextLabel; handler MyHandler type RUIHandler{initialUI =[myShadow]} myTextLabel TextLabel{text = "Text with a Shadow"}; myShadow Shadow{x = 20, y = 20, width = 100, div = new Div{padding = 5, backgroundColor = "salmon", children =[myTextLabel]}}; end
package client; import org.eclipse.edt.rui.widgets.Box; import org.eclipse.edt.rui.widgets.Div; import org.eclipse.edt.rui.widgets.Shadow; import org.eclipse.edt.rui.widgets.TextField; import eglx.ui.rui.Widget; handler MyHandler type RUIHandler{initialUI =[myBox, shadow, myOtherBox]} const OTHERBOXX INT = 30; const OTHERBOXY INT = 50; myTextField TextField{ text = "What a drag!", width = 120, backgroundColor = "white", onStartDrag = start, onDrag = drag, onDropOnTarget = drop}; myBox Box { children = [ myTextField{} ]}; shadow Shadow { zIndex = 2, position = "absolute", visibility="hidden", div = new Div { } }; myOtherBox Box {position = "absolute", zIndex = 1, x = OTHERBOXX, y = OTHERBOXY, width = 200, height = 200, backgroundColor = "blue"}; dx, dy int; function start(myWidget Widget in, x int in, y int in) returns(boolean) dx = x - myWidget.x; dy = y - myWidget.y; myTextField.position = "static"; shadow.div.children = [ myTextField ]; shadow.visibility = "visible"; return(true); end function drag(myWidget Widget in, drop Widget in, x int in, y int in) shadow.x = x - dx; shadow.y = y - dy; end function drop(widget Widget in, drop Widget in, x int in, y int in) shadow.visibility = "hidden"; myTextField.position = "relative"; myTextField.x = shadow.x - OTHERBOXX; myTextField.y = shadow.y - OTHERBOXY; myOtherBox.children = [ myTextField ]; end end
package client; import org.eclipse.edt.rui.widgets.Box; import org.eclipse.edt.rui.widgets.Div; import org.eclipse.edt.rui.widgets.Shadow; import org.eclipse.edt.rui.widgets.TextField; import eglx.ui.rui.Widget; handler MyHandler type RUIHandler{ initialUI =[shadow, myBox, myOtherBox1, myOtherBox2]} myTextField TextField{ text="What a drag!", width=120, backgroundColor="white", onMouseOver::=mouseOver, onMouseOut::=mouseOut, onStartDrag=start, onDrag=drag, onDropOnTarget=drop }; myBox Box { children=[ myTextField{} ]}; shadow Shadow { zIndex=2, position="absolute", visibility="hidden", div=new Div { } }; myOtherBox1 Box { padding=10, margin=10, width=200, height=200, backgroundColor="lightblue", borderColor="black", borderWidth=2, borderStyle="solid" }; myOtherBox2 Box { padding=10, margin=10, width=200, height=200, backgroundColor="lightyellow", borderColor="black", borderWidth=2, borderStyle="solid" }; dx, dy int; function mouseOver(e Event in) myTextField.cursor = "move"; end function mouseOut(e Event in) myTextField.cursor = ""; end function start(myWidget Widget in, x int in, y int in) returns(boolean) dx = x - myWidget.x; dy = y - myWidget.y; myTextField.position="static"; shadow.div.children=[ myTextField ]; shadow.visibility="visible"; return(true); end function drag(myWidget Widget in, drop Widget in, x int in, y int in) shadow.x=x - dx; shadow.y=y - dy; if (inside(x, y, myOtherBox1)) myOtherBox1.backgroundColor = "lightgreen"; else myOtherBox1.backgroundColor = "lightblue"; end if (inside(x, y, myOtherBox2)) myOtherBox2.backgroundColor = "lightgreen"; else myOtherBox2.backgroundColor = "lightyellow"; end end function drop(widget Widget in, drop Widget in, x int in, y int in) shadow.visibility="hidden"; myTextField.position="static"; if (inside(x, y, myOtherBox1)) myOtherBox1.children=[ myTextField ]; end if (inside(x, y, myOtherBox2)) myOtherBox2.children=[ myTextField ]; end end function inside(x int in, y int in, widget Widget in) returns(boolean) return (x>=widget.x && x<=widget.pixelWidth + widget.x && y>=widget.y && y<=widget.pixelHeight + widget.y); end end
The main property of the shadow widget is div, which takes a widget of type Div.
Other supported fields and functions are described in the following topics in the EGL Programmer’s Guide: “Rich UI widget fields” and ”Rich UI widget functions.”
import org.eclipse.edt.rui.widgets.Shadow;