Changeset 1896 in Sophya for trunk/SophyaPI/PI/Tests/pist.cc
- Timestamp:
- Feb 7, 2002, 7:22:56 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Tests/pist.cc
r1854 r1896 48 48 int sx=10, int sy=10, int px=0, int py=0); 49 49 virtual ~StringPosDrawWdg(); 50 51 // Traitement des evenements 52 // virtual void Resize(); 53 virtual void Draw(PIGraphic* g, int x0, int y0, int dx, int dy); 54 55 protected: 56 }; 57 58 // ---- Declaration de la classe CompStringDrawWdg -------- 59 class CompStringDrawWdg : public StringDrawWdg 60 { 61 public: 62 // Les methodes ... 63 64 CompStringDrawWdg(PIContainerGen *par, char *nom, 65 int sx=10, int sy=10, int px=0, int py=0); 66 virtual ~CompStringDrawWdg(); 50 67 51 68 // Traitement des evenements … … 419 436 420 437 /* ........................................................... */ 438 /* Classe CompStringDrawWdg (Implementation des methodes) */ 439 /* ........................................................... */ 440 441 /* --Methode-- */ 442 CompStringDrawWdg::CompStringDrawWdg(PIContainerGen *par, char *nom, 443 int sx, int sy, int px, int py) 444 : StringDrawWdg(par, nom, sx, sy, px, py) 445 446 { 447 } 448 449 /* --Methode-- */ 450 CompStringDrawWdg::~CompStringDrawWdg() 451 { 452 } 453 454 455 /* --Methode-- */ 456 void CompStringDrawWdg::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/) 457 { 458 PIFontAtt att[4] = { PI_RomanFont, PI_BoldFont, PI_ItalicFont, PI_BoldItalicFont}; 459 PIFontSize fsz[5] = { PI_TinySizeFont, PI_SmallSizeFont, PI_NormalSizeFont, 460 PI_BigSizeFont, PI_HugeSizeFont }; 461 PIFontName fn[4] = { PI_CourierFont, PI_HelveticaFont, 462 PI_TimesFont, PI_SymbolFont}; 463 char * fnstr[4] = { "Courier-Font", "Helvetica-Font", 464 "Times-Font", "Symbol-Font"}; 465 char * attstr[4] = { "RomanFont" , "BoldFont", "ItalicFont", "BoldItalicFont"}; 466 char * fszstr[5] = { "TinySizeFont", "SmallSizeFont", "NormalSizeFont", 467 "BigSizeFont", "HugeSizeFont" }; 468 469 if (g->kind() != PI_PSFileGraphics ) EraseWindow(); 470 471 472 int ia=0, js=0; 473 int k; 474 for(k=0; k<4; k++) 475 if (att[k] == mFAtt) {ia = k; break; } 476 for(k=0; k<5; k++) 477 if (fsz[k] == mFSize) {js = k; break; } 478 479 if ((mFSize != mSFSize) || (mFAtt != mSFAtt)) 480 for(k=0; k<10; k++) 481 mSL[k] = mSH[k] = 0; 482 PIFont f(14, PI_DefaultFont, mFAtt); 483 g->SelFont(f); 484 g->SelForeground(PI_Black); 485 g->SelLine(PI_ThinLine); 486 487 g->DrawString(20,24,"StringDraw"); 488 g->DrawString(XSize()/5,24,attstr[ia]); 489 g->DrawString(XSize()/3,24,fszstr[js]); 490 491 492 PIFont fx(14,fn[2]); 493 fx.SetFontSz(mFSize); 494 fx.SetFontAtt(mFAtt); 495 g->SelFont(fx); 496 int fh,fa,fd; 497 fh = fx.GetFontHeight(fa, fd); 498 cout << " FontSize= " << f.GetFontSize() << " FontHeight= " << fh << endl; 499 500 g->DrawCompString(XSize()/2,40,"10","-34",NULL); 501 g->DrawCompString(XSize()/2+60,40,"10","+78",NULL); 502 g->DrawCompString(XSize()/2+120,40, "10", NULL, "a"); 503 504 int xpos, ypos; 505 char *s, *su, *sd; 506 507 // --------------- Vertical Top ----------------- 508 509 xpos = 30; ypos = 75; 510 s = "HLeftVTop"; 511 su = "824"; 512 sd = "ij"; 513 g->SelForeground(PI_Red); 514 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 515 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 516 g->SelForeground(PI_Black); 517 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalTop); 518 519 xpos = XSize()/2; ypos = 75; 520 s = "HCenVTop"; 521 su = "76843"; 522 sd = "abc"; 523 g->SelForeground(PI_Red); 524 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 525 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 526 g->SelForeground(PI_Black); 527 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalTop); 528 529 xpos = XSize()-30; ypos = 75; 530 s = "HRigVTop"; 531 su = "76843"; 532 sd = "abc"; 533 g->SelForeground(PI_Red); 534 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 535 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 536 g->SelForeground(PI_Black); 537 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalTop); 538 539 // --------------- Vertical Center ----------------- 540 xpos = 30; ypos = 150; 541 s = "HLeftVCen"; 542 su = "32987"; 543 sd = NULL; 544 g->SelForeground(PI_Red); 545 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 546 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 547 g->SelForeground(PI_Black); 548 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalCenter); 549 550 xpos = XSize()/2; ypos = 150; 551 s = "HCenVCen"; 552 su = "32987"; 553 sd = "klm"; 554 g->SelForeground(PI_Red); 555 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 556 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 557 g->SelForeground(PI_Black); 558 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalCenter); 559 560 xpos = XSize()-30; ypos = 150; 561 s = "HRigVCen"; 562 su = "2"; 563 sd = "alpha"; 564 g->SelForeground(PI_Red); 565 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 566 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 567 g->SelForeground(PI_Black); 568 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalCenter); 569 570 // --------------- Vertical BaseLine ----------------- 571 xpos = 30; ypos = 250; 572 s = "HLeftVBas"; 573 su = "3"; 574 sd = "beta"; 575 g->SelForeground(PI_Red); 576 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 577 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 578 g->SelForeground(PI_Black); 579 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalBaseLine); 580 581 xpos = XSize()/2; ypos = 250; 582 s = "HCenVBas"; 583 su = "gamma"; 584 sd = "44"; 585 g->SelForeground(PI_Red); 586 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 587 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 588 g->SelForeground(PI_Black); 589 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalBaseLine); 590 591 xpos = XSize()-30; ypos = 250; 592 s = "HRigVBas"; 593 su = "55"; 594 sd = "alpha"; 595 g->SelForeground(PI_Red); 596 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 597 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 598 g->SelForeground(PI_Black); 599 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalBaseLine); 600 601 // --------------- Vertical Bottom ----------------- 602 xpos = 30; ypos = 325; 603 s = "HLeftVBot"; 604 su = "abc"; 605 sd = "6"; 606 g->SelForeground(PI_Red); 607 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 608 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 609 g->SelForeground(PI_Black); 610 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalLeft|PI_VerticalBottom); 611 612 xpos = XSize()/2; ypos = 325; 613 s = "HCentVBot"; 614 su = NULL; 615 sd = "lm"; 616 g->SelForeground(PI_Red); 617 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 618 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 619 g->SelForeground(PI_Black); 620 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalCenter|PI_VerticalBottom); 621 622 xpos = XSize()-30; ypos = 325; 623 s = "HLeftVBot"; 624 su = NULL; 625 sd = NULL; 626 g->SelForeground(PI_Red); 627 g->DrawLine(xpos-50, ypos, xpos+50, ypos); 628 g->DrawLine(xpos, ypos-10, xpos, ypos+10); 629 g->SelForeground(PI_Black); 630 g->DrawCompString(xpos, ypos, s, su, sd, PI_HorizontalRight|PI_VerticalBottom); 631 632 return; 633 } 634 635 /* ........................................................... */ 421 636 /* Classe PITApp */ 422 637 /* ........................................................... */ … … 447 662 m[0]->AppendItem("StringDrawWdg", 10101); 448 663 m[0]->AppendItem("StringPosDrawWdg", 10102); 664 m[0]->AppendItem("CompStringDrawWdg", 10103); 449 665 m[0]->AppendItem("->eps", 10111); 450 666 m[0]->AppendItem("->ps", 10112); … … 521 737 wp->SetAutoDelChilds(true); 522 738 StringPosDrawWdg* exb = new StringPosDrawWdg(wp, "sposdrawwdg", 600, 400, 0, 0); 739 exb->SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_elastic); 740 wp->SetUserData(exb); 741 wp->Show(); 742 } 743 break; 744 745 case 10103: // Creation d'un StringPosDrawWdg 746 { 747 nbwin++; 748 sprintf(strg, "Creation CompStringDrawWdg \n Fenetre No %d ", nbwin); 749 sprintf(strg,"CompStringDrawWdg - %d", nbwin); 750 PIWindow* wp = new PIWindow(this, strg, PIWK_normal, 600, 400, 150, 150); 751 wp->SetAutoDelChilds(true); 752 CompStringDrawWdg* exb = new CompStringDrawWdg(wp, "compposdrawwdg", 600, 400, 0, 0); 523 753 exb->SetBinding(PIBK_fixed,PIBK_elastic,PIBK_elastic,PIBK_elastic); 524 754 wp->SetUserData(exb);
Note:
See TracChangeset
for help on using the changeset viewer.