home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ring.yamanashi.ac.jp/pub/pc/freem/action/
/
action.zip
/
baku100.zip
/
baku100
/
Kernel
/
PanelChar.tonyu
< prev
next >
Wrap
Text File
|
2005-09-06
|
3KB
|
123 lines
extends PlainChar;
constructor PanelChar (x,y,w,h) {
super(x,y);
//print ("panelchar : w "+w+" h "+h);
width=0;
height=0;
if (w+0>0 && h+0>0) resize(w,h);
else if (!designMode()) resize(100,50);
angle=0;
alpha=255;
scaleX=1;
col=$clWhite;
font="élér éoû╛Æ⌐";
}
/*function useScreenXY(s) {
_useScr=s;
}*/
function drawFrame() {
//print ("panelchard : w "+width+" h "+height);
panel.fillRect(0,0,width,height,panel.getTransParentColor());
panel.drawLine(1 ,1 ,width-2, 1,$clWhite);
panel.drawLine(width-2,1 ,width-2,height-2,$clWhite);
panel.drawLine(width-2,height-2, 1,height-2,$clWhite);
panel.drawLine(1 ,height-2, 1, 1,$clWhite);
}
function onGenerate() {
if (width+0>0 && height+0>0) resize(width,height);
else resize(99,98);
if (text) setText();
else if (designMode()) drawFrame();
}
function getWidth() {
return width*scaleX;
}
function getHeight() {
if (!scaleY) return height*scaleX;
return height*scaleY;
}
function onChangeAttr (an,v,reason) {
//print ("changed "+an+"="+v+"//"+reason);
if (designMode()) {
if (text) setText();
if (reason && (an=="width" || an=="height")) {
resize(width,height);
drawFrame();
}
}
}
function setFont(f,b,i,u){
if (f) font=f;
bold=b;
italic=i;
underLine=u;
super.setFont(f,b,i,u);
}
function setText(t,c,sz) {
if (t) text=t;
if (c) col=c;
if (sz) size=sz;
setFont(font,bold,italic,underLine);
resize( textWidth(text,size),textHeight(text,size) ) ;
panel.clear();
panel.drawText(0,0,text,col,size);
}
function setDefaultProperties(xx,yy) {
super.setDefaultProperties(xx,yy);
changeAttr("width","50");
changeAttr("height","50");
width=50;height=50;
resize(width,height);
if (designMode()) drawFrame();
changeAttr("angle","0");
changeAttr("alpha","255");
changeAttr("col","$clWhite");
changeAttr("size","12");
}
function resize(w,h) {
width=w;
height=h;
// if (!panel || w > panel.width || h > panel.height) {
if (panel is Panel) panel.resize(w,h);
else panel=new Panel(w,h);
// }
}
function load(fn) {
panel.load(fn);
width=panel.width;
height=panel.height;
}
function save(fn,sx,sy,dx,dy) {
panel.save(fn,sx,sy,dx,dy);
}
function drawFocus() {
var w,h,xx,yy;
xx=x;yy=y;
w=getWidth()/2;h=getHeight()/2;
drawSprite(xx-w,yy-h,0);
drawSprite(xx+w,yy-h,0);
drawSprite(xx+w,yy+h,0);
drawSprite(xx-w,yy+h,0);
}
function draw() {
var sx,sy;
super.draw();
panel.angle=trunc(angle);
panel.alpha=alpha;
panel.zOrder=zOrder;
panel.target=this;
if (!scaleY) panel.stretchDraw(x,y,width*scaleX,height*scaleX);
else panel.stretchDraw(x,y,width*scaleX,height*scaleY);
}