1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786
|
unit UFlash8CL;
interface
uses Flash8,UFont;
const
distance=1;
angleInDegrees=45;
coul1=$808080;
highlightAlpha=0.8;
coul2=$646464;
shadowAlpha=0.9;
blurX=5;
blurY=5;
strength=5;
quality=3;
typ='inner';
type
TLabel=Class(TextField)
Private
first:Boolean;
FLeft,FTop,FWidth,FHeight:number;
Function GetCaption:string;
Function getLeft:number;
Function getTop:number;
Function getwidth:number;
Function getHeight:number;
procedure SetLeft(value:number);
procedure SetTop(value:number);
procedure SetWidth(value:number);
procedure SetHeight(value:number);
procedure SetCaption(value:string);
Public
Font:Tfont;
constructor Create(parent:movieclip);
property Left:number read getLeft write SetLeft;
property Top:number read getTop write SetTop;
property width:number read getWidth write SetWidth;
property height:number read getHeight write SetHeight;
property caption:string read getCaption write setCaption;
end;
{*********
**Edit****
**********}
TEdit=Class(TextField)
Private
first:Boolean;
Function getText:string;
Function getLeft:number;
Function getTop:number;
Function getwidth:number;
Function getHeight:number;
procedure SetLeft(value:number);
procedure SetTop(value:number);
procedure SetWidth(value:number);
procedure SetHeight(value:number);
procedure SetText(value:string);
procedure onChanged(Ed:TEdit);override;
Public
Font:Tfont;
constructor Create(parent:movieclip);
procedure onChange;virtual;
property Left:number read GetLeft write SetLeft;
property Top:number read GetTop write SetTop;
property width:number read GetWidth write SetWidth;
property height:number read GetHeight write SetHeight;
property texte:string read getText write setText;
end;
{*********
**Button**
**********}
TButton=class(movieclip)
private
click,First:Boolean;
skin1,skin2:movieclip;
w,h:number;
bevel1,bevel2:BevelFilter;
myfilterArray:TArray;
Title:TextField;
Function getLeft:number;
Function getTop:number;
Function getwidth:number;
Function getHeight:number;
Function getCaption:String;
procedure skin;
procedure SetCaption(value:string);
procedure SetLeft(value:number);
procedure SetTop(value:number);
procedure SetWidth(value:number);
procedure SetHeight(value:number);
procedure onPress;override;
procedure onMouseUp;override;
public
Font:Tfont;
procedure onClick;virtual;
constructor create(parent:movieclip);
property Caption:string read GetCaption write SetCaption;
property Left:number read GetLeft write SetLeft;
property Top:number read GetTop write SetTop;
property width:number read GetWidth write SetWidth;
property height:number read GetHeight write SetHeight;
end;
{***********
**StringGrid*
************}
TCell=class(TEdit)
procedure onChanged(Cell:TEdit);
end;
TStringGrid=class(movieclip)
private
Function getLeft:number;
Function getTop:number;
Function getwidth:number;
Function getHeight:number;
procedure SetLeft(value:number);
procedure SetTop(value:number);
procedure SetWidth(value:number);
procedure SetHeight(value:number);
public
colcount,rowcount:integer;
Cells:array[0..200,0..200] of TCell;
constructor Create(parent:MovieClip);
procedure Init(colcnt,rowcnt,width,height:integer);
procedure onChange;virtual;
procedure Font(Fname:string;Fsize:number;Fbold,Fitalic:boolean;algn:string);
property Left:number read GetLeft write SetLeft;
property Top:number read GetTop write SetTop;
property width:number read GetWidth write SetWidth;
property height:number read GetHeight write SetHeight;
end;
{***********
**TrackBar**
************}
TTrackcur=class(MovieClip)
private
autorisation:boolean;
public
xmin,xmax:number;
orientation:string;
xmouse,ymouse,trackmin,trackmax:number;
xcur,ycur:Integer;
downcur:Boolean;
Procedure dessin;
constructor Create(AOWNER:Movieclip;trmin,trmax:number);
procedure onPress;override;
procedure onMouseMove;override;
procedure onMouseUp;override;
procedure onRollOver;override;
procedure onRollOut;override;
end;
TTrackBar=Class(movieClip)
private
w,h:integer;
position:number;
cur: TTrackcur;
function GetLeft:number;
function Gettop:number;
function Getwidth:number;
function Getheight:number;
function Getcolor:number;
procedure Setleft(value:number);
procedure SetTop(value:number);
procedure SetWidth(value:number);
procedure SetHeight(value:number);
procedure Setcolor(value:number);
public
constructor Create(parent:movieclip);
procedure onChange;virtual;
property Left:number read GetLeft write SetLeft;
property Top:number read GetTop write SetTop;
property width:number read GetWidth write SetWidth;
property height:number read GetHeight write SetHeight;
property color:number read GetColor write SetColor;
end;
function arrondi(n:number):integer;
implementation
function arrondi(n:number):integer;
begin
if n-trunc(n)<0.5 then result:=trunc(n) else result:=trunc(n)+1;
end;
Constructor TLabel.Create(parent:movieclip);
begin
Inherited Create(Parent,'',parent.getNextHighestDepth(),0,0,100,100);
Font:=TFont.Create;
with Font do
begin
name:='arial';
size:=14;
end;
first:=true;
end;
procedure TLabel.Setleft(value:number);
begin
_x:=value;
end;
Function TLabel.GetLeft:number;
begin
result:=_x;
end;
procedure TLabel.SetTop(value:number);
begin
_y:=value;
end;
Function TLabel.GetTop:number;
begin
result:=_y;
end;
procedure TLabel.SetWidth(value:number);
begin
_width:=value;
end;
Function TLabel.GetWidth:number;
begin
result:=_width;
end;
procedure TLabel.SetHeight(value:number);
begin
_height:=value;
end;
Function TLabel.GetHeight:number;
begin
result:=_height;
end;
procedure TLabel.SetCaption(value:string);
begin
if first then
begin
setNewTextFormat(Font.FTextFormat);
first:=false;
end;
text:=value;
end;
Function TLabel.GetCaption:string;
begin
result:=text;
end;
{*********
**Edit****
**********}
Constructor TEdit.Create(parent:movieclip);
begin
Inherited Create(Parent,'',parent.getNextHighestDepth(),0,0,100,100);
type:='input';
Font:=TFont.Create;
with Font do
begin
name:='arial';
size:=14;
end;
first:=true;
end;
Procedure TEdit.onChanged(Ed:TEdit);
begin
onchange;
end;
procedure TEdit.Setleft(value:number);
begin
_x:=value;
end;
Function TEdit.GetLeft:number;
begin
result:=_x;
end;
procedure TEdit.SetTop(value:number);
begin
_y:=value;
end;
Function TEdit.GetTop:number;
begin
result:=_y;
end;
procedure TEdit.SetWidth(value:number);
begin
_width:=value;
end;
Function TEdit.GetWidth:number;
begin
result:=_width;
end;
procedure TEdit.SetHeight(value:number);
begin
_height:=value;
end;
Function TEdit.GetHeight:number;
begin
result:=_height;
end;
procedure TEdit.SetText(value:string);
begin
if first then
begin
setNewTextFormat(Font.FTextFormat);
first:=false;
end;
text:=value;
end;
Function TEdit.getText:string;
begin
result:= text;
end;
Procedure TEdit.onChange;
begin
end;
{*********
**Button**
**********}
constructor TButton.Create(parent:movieclip);
begin
inherited Create(parent,'button',movieclip(parent).getNextHighestDepth());
w:=90;
h:=30;
left:=10;
top:=10;
myfilterArray:=TArray.Create();
Font:=TFont.Create;
with Font do
begin
name:='arial';
size:=14;
align:='center';
end;
skin1:=movieclip.create(self,'',1);
skin2:=movieclip.create(self,'',2);
with skin1 do
begin
bevel1:=BevelFilter.create(distance,angleInDegrees,coul1,highlightAlpha,coul2,shadowAlpha,blurX,blurY,strength,quality,typ);
myfilterArray.Push(bevel1);
filters := myfilterArray;
BeginFill($F0F0F0);
lineto(w,0);
lineto(w,h);
lineto(0,h);
end;
with skin2 do
begin
bevel2:=BevelFilter.create(distance,angleInDegrees,coul2,highlightAlpha,coul1,shadowAlpha,blurX,blurY,strength,quality,typ);
myfilterArray.Push(bevel2);
filters := myfilterArray;
BeginFill($F0F0F0);
lineto(w,0);
lineto(w,h);
lineto(0,h);
end;
First:=true;
click:=false;
skin;
Title:=TextField.Create(self,'',getNextHighestDepth(),0,0,w,h);
with Font do
begin
name:='arial';
size:=20;
end;
end;
procedure TButton.skin;
begin
if not click then
begin
skin1._visible:=true;
skin2._visible:=false;
end else
begin
skin1._visible:=false;
skin2._visible:=true;
end;
end;
procedure TButton.SetCaption(Value: string);
begin
with title do
begin
if first then
begin
setNewTextFormat(Font.FTextFormat);
first:=false;
end;
text:=value;
end;
end;
Function TButton.GetCaption:string;
begin
result:=title.text;
end;
procedure TButton.onClick;
begin
end;
procedure TButton.onPress;
begin
click:=true;
skin;
onClick;
end;
procedure TButton.onMouseUp;
begin
click:=false;
skin;
end;
procedure TButton.Setleft(value:number);
begin
_x:=value;
end;
procedure TButton.SetTop(value:number);
begin
_y:=value;
end;
procedure TButton.SetWidth(value:number);
begin
_xscale:=100*value/w;
_yscale:=_xscale;
end;
procedure TButton.SetHeight(value:number);
begin
_yscale:=100*value/h;
end;
Function TButton.GetLeft:number;
begin
result:=_x;
end;
Function TButton.GetTop:number;
begin
result:=_y;
end;
Function TButton.GetWidth:number;
begin
result:=_width;
end;
Function TButton.GetHeight:number;
begin
result:=_height;
end;
{***********
**TrackBar** un commencement... en construction événement onMouseWheel.....
************} // essai pour l'instant
constructor TTrackbar.Create(parent:movieclip);
begin
inherited Create(parent,'Trackbar',movieclip(parent).getNextHighestDepth());
w:=100;
h:=20;
left:=10;
top:=10;
color:=clred;
lineto(w,0);
lineto(w,h);
lineto(0,h);
beginFill($C0C0C0);
moveto(w/15,h/4);
lineto(w-w/15,h/4);
lineto(w-w/15,h/4+2);
lineto(w/15,h/4+2);
lineto(w/15,h/4);
cur:=TTrackcur.Create(self,0,100);
with cur do
begin
_x:=w/15;
_y:=h/4;
end;
end;
procedure TTrackbar.Setleft(value:number);
begin
_x:=value;
end;
procedure TTrackbar.SetTop(value:number);
begin
_y:=value;
end;
procedure TTrackbar.SetWidth(value:number);
begin
_xscale:=100*value/w;
_yscale:=_xscale;
end;
procedure TTrackbar.SetHeight(value:number);
begin
_yscale:=100*value/h;
end;
procedure TTrackbar.Setcolor(value:number);
begin
opaqueBackground:=value;
end;
procedure TTrackbar.onChange;
begin
end;
Function TTrackbar.Getcolor:number;
begin
result:=opaqueBackground;
end;
Function TTrackbar.GetWidth:number;
begin
result:=_width;
end;
Function TTrackbar.Getheight:number;
begin
result:=_height;
end;
Function TTrackbar.GetLeft:number;
begin
result:=_x;
end;
Function TTrackbar.GetTop:number;
begin
result:=_y;
end;
procedure TTrackcur.onPress;
begin
downcur:=true;
xmouse:=_xmouse;
ymouse:=_ymouse;
end;
procedure TTrackcur.onMouseMove;
var tr:TTrackbar;
begin
if autorisation then
begin
tr:= TTrackbar(_parent);
if downcur then
if orientation='horizontal' then
begin
_x:= _x + _xmouse -xmouse;
if _x<tr.w/15 then _x:=tr.w/15;
if _x>tr.w-tr.w/15 then _x:=tr.w-tr.w/15;
tr.position:=arrondi((_x-tr.w/15)*(trackmax-trackmin)/(tr.w-2*tr.w/15)+trackmin);
end
else if orientation='vertical' then //non réalisé
begin
_y:= _y +_ymouse -ymouse;
end;
tr.onChange;
end;
end;
procedure TTrackcur.onMouseUp;
begin
downcur:=false;
end;
procedure TTrackcur.onRollOver;
begin
autorisation:=true;
end;
procedure TTrackcur.onRollOut;
begin
autorisation:=false;
end;
constructor TTrackcur.create(AOWNER:Movieclip;trmin,trmax:number);
var matrix: Flash8.Matrix;
begin
inherited Create(AOWNER,'cur',AOWNER.getNextHighestDepth);
autorisation:=false;
downcur:=false;
xmouse:=0;
ymouse:=0;
matrix := Flash8.Matrix.Create();
matrix.createBox(1,1,0,10,14);
linestyle(1,$87B6B7);
beginGradientFill('linear',[$008080,clwhite],[100,100],[0,14],matrix);
moveto(-2,-2);
lineto(2,-2);
lineto(2,0);
lineto(0,4);
lineto(-2,0);
lineto(-2,-2);
downcur:=false;
xmouse:=0;
ymouse:=0;
trackmin:=trmin;
trackmax:=trmax;
end;
Procedure TTrackcur.dessin;
begin
end;
{***********
**StringGrid*
************}
procedure TCell.onChanged(Cell:TEdit);
begin
TStringgrid(_parent).onChange;
end;
constructor TStringGrid.Create(parent:movieclip);
begin
Inherited Create(Parent,'StringGrid',parent.getNextHighestDepth());
left:=10;
top:=100;
opaquebackground:=$cecece;
end;
procedure TStringGrid.Setleft(value:number);
begin
_x:=value;
end;
Function TStringGrid.GetLeft:number;
begin
result:=_x;
end;
procedure TStringGrid.SetTop(value:number);
begin
_y:=value;
end;
Function TStringGrid.GetTop:number;
begin
result:=_y;
end;
procedure TStringGrid.SetWidth(value:number);
begin
_width:=value;
end;
Function TStringGrid.GetWidth:number;
begin
result:=_width;
end;
procedure TStringGrid.SetHeight(value:number);
begin
_height:=value;
end;
Function TStringGrid.GetHeight:number;
begin
result:=_height;
end;
procedure TStringgrid.Init(colcnt,rowcnt,width,height:integer);
var i,j:integer;
espace:number;
begin
colcount:=colcnt;
rowcount:=rowcnt;
espace:=width/200;
for i:=0 to colcount-1 do
for j:=0 to rowcount-1 do
begin
cells[i,j]:=TEdit.Create(self);
cells[i,j].background:=true;
cells[i,j].width:=(width-(colcount+1)*espace)/colcount;
cells[i,j].height:=(height-(rowcount+1)*espace)/rowcount;
cells[i,j].left:=espace*(i+1)+i*cells[i,j].width;
cells[i,j].top:=espace*(j+1)+j*cells[i,j].height;;
cells[i,j].border:=true;
cells[i,j].text:='';
end;
linestyle(1,0);
moveto(0,0);
lineto(width,0);
lineto(width,height);
lineto(0,height);
lineto(0,0);
end;
procedure TStringgrid.Font(Fname:string;Fsize:number;Fbold,Fitalic:boolean;algn:string);
var i,j:integer;
begin
for i:=0 to colcount-1 do
for j:=0 to rowcount-1 do
begin
with cells[i,j].font do
begin
name:=Fname;
size:=Fsize;
bold:=FBold;
italic:=Fitalic;
align:=algn;
end;
cells[i,j].texte:='';
end;
end;
procedure TStringgrid.onChange;
begin
end;
end. |
Partager