Public Member Functions | |
TestSliders (const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h) | |
virtual | ~TestSliders () |
void | CloseWindow () |
void | DoText (const char *text) |
void | DoSlider (Int_t pos=0) |
Private Attributes | |
TGTransientFrame * | fMain |
TGVerticalFrame * | fVframe1 |
TGVerticalFrame * | fVframe2 |
TGLayoutHints * | fBly |
TGLayoutHints * | fBfly1 |
TGHSlider * | fHslider1 |
TGHSlider * | fHslider2 |
TGVSlider * | fVslider1 |
TGDoubleVSlider * | fVslider2 |
TGTextEntry * | fTeh1 |
TGTextEntry * | fTev1 |
TGTextEntry * | fTeh2 |
TGTextEntry * | fTev2 |
TGTextBuffer * | fTbh1 |
TGTextBuffer * | fTbv1 |
TGTextBuffer * | fTbh2 |
TGTextBuffer * | fTbv2 |
Definition at line 341 of file guitest.C.
TestSliders::TestSliders | ( | const TGWindow * | p, | |
const TGWindow * | main, | |||
UInt_t | w, | |||
UInt_t | h | |||
) |
Definition at line 1593 of file guitest.C.
01595 { 01596 // Dialog used to test the different supported sliders. 01597 01598 fMain = new TGTransientFrame(p, main, w, h); 01599 fMain->Connect("CloseWindow()", "TestSliders", this, "CloseWindow()"); 01600 fMain->DontCallClose(); // to avoid double deletions. 01601 01602 // use hierarchical cleaning 01603 fMain->SetCleanup(kDeepCleanup); 01604 01605 fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame); 01606 01607 fVframe1 = new TGVerticalFrame(fMain, 0, 0, 0); 01608 01609 fTeh1 = new TGTextEntry(fVframe1, fTbh1 = new TGTextBuffer(10), HId1); 01610 fTev1 = new TGTextEntry(fVframe1, fTbv1 = new TGTextBuffer(10), VId1); 01611 fTbh1->AddText(0, "0"); 01612 fTbv1->AddText(0, "0"); 01613 01614 fTeh1->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)"); 01615 fTev1->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)"); 01616 01617 fHslider1 = new TGHSlider(fVframe1, 100, kSlider1 | kScaleBoth, HSId1); 01618 fHslider1->Connect("PositionChanged(Int_t)", "TestSliders", this, "DoSlider(Int_t)"); 01619 fHslider1->SetRange(0,50); 01620 01621 fVslider1 = new TGVSlider(fVframe1, 100, kSlider2 | kScaleBoth, VSId1); 01622 fVslider1->Connect("PositionChanged(Int_t)", "TestSliders", this, "DoSlider(Int_t)"); 01623 fVslider1->SetRange(0,8); 01624 01625 fVframe1->Resize(100, 100); 01626 01627 fVframe2 = new TGVerticalFrame(fMain, 0, 0, 0); 01628 fTeh2 = new TGTextEntry(fVframe2, fTbh2 = new TGTextBuffer(10), HId2); 01629 fTev2 = new TGTextEntry(fVframe2, fTbv2 = new TGTextBuffer(10), VId2); 01630 fTbh2->AddText(0, "0"); 01631 fTbv2->AddText(0, "0"); 01632 01633 fTeh2->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)"); 01634 fTev2->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)"); 01635 01636 fHslider2 = new TGHSlider(fVframe2, 150, kSlider2 | kScaleBoth, HSId2); 01637 fHslider2->Connect("PositionChanged(Int_t)", "TestSliders", this, "DoSlider(Int_t)"); 01638 fHslider2->SetRange(0,3); 01639 01640 fVslider2 = new TGDoubleVSlider(fVframe2, 100, kDoubleScaleBoth, VSId2); 01641 01642 fVslider2->SetRange(-10,10); 01643 fVslider2->Connect("PositionChanged()", "TestSliders", this, "DoSlider()"); 01644 fVframe2->Resize(100, 100); 01645 01646 //--- layout for buttons: top align, equally expand horizontally 01647 fBly = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 3, 0); 01648 01649 //--- layout for the frame: place at bottom, right aligned 01650 fBfly1 = new TGLayoutHints(kLHintsTop | kLHintsRight, 20, 10, 15, 0); 01651 01652 fVframe1->AddFrame(fHslider1, fBly); 01653 fVframe1->AddFrame(fVslider1, fBly); 01654 fVframe1->AddFrame(fTeh1, fBly); 01655 fVframe1->AddFrame(fTev1, fBly); 01656 01657 fVframe2->AddFrame(fHslider2, fBly); 01658 fVframe2->AddFrame(fVslider2, fBly); 01659 fVframe2->AddFrame(fTeh2, fBly); 01660 fVframe2->AddFrame(fTev2, fBly); 01661 01662 fMain->AddFrame(fVframe2, fBfly1); 01663 fMain->AddFrame(fVframe1, fBfly1); 01664 01665 fMain->SetWindowName("Slider Test"); 01666 TGDimension size = fMain->GetDefaultSize(); 01667 fMain->Resize(size); 01668 01669 fMain->SetWMSize(size.fWidth, size.fHeight); 01670 fMain->SetWMSizeHints(size.fWidth, size.fHeight, size.fWidth, size.fHeight, 0, 0); 01671 fMain->SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize | 01672 kMWMDecorMinimize | kMWMDecorMenu, 01673 kMWMFuncAll | kMWMFuncResize | kMWMFuncMaximize | 01674 kMWMFuncMinimize, 01675 kMWMInputModeless); 01676 01677 // position relative to the parent's window 01678 fMain->CenterOnParent(); 01679 01680 fMain->MapSubwindows(); 01681 fMain->MapWindow(); 01682 01683 gClient->WaitFor(fMain); 01684 }
TestSliders::~TestSliders | ( | ) | [virtual] |
void TestSliders::CloseWindow | ( | ) |
void TestSliders::DoText | ( | const char * | text | ) |
Definition at line 1700 of file guitest.C.
01701 { 01702 // Handle text entry widgets. 01703 01704 TGTextEntry *te = (TGTextEntry *) gTQSender; 01705 Int_t id = te->WidgetId(); 01706 01707 switch (id) { 01708 case HId1: 01709 fHslider1->SetPosition(atoi(fTbh1->GetString())); 01710 break; 01711 case VId1: 01712 fVslider1->SetPosition(atoi(fTbv1->GetString())); 01713 break; 01714 case HId2: 01715 fHslider2->SetPosition(atoi(fTbh2->GetString())); 01716 break; 01717 case VId2: 01718 fVslider2->SetPosition(atoi(fTbv2->GetString()), 01719 atoi(fTbv2->GetString())+2); 01720 break; 01721 default: 01722 break; 01723 } 01724 }
void TestSliders::DoSlider | ( | Int_t | pos = 0 |
) |
Definition at line 1726 of file guitest.C.
01727 { 01728 // Handle slider widgets. 01729 01730 Int_t id; 01731 TGFrame *frm = (TGFrame *) gTQSender; 01732 if (frm->IsA()->InheritsFrom(TGSlider::Class())) { 01733 TGSlider *sl = (TGSlider*) frm; 01734 id = sl->WidgetId(); 01735 } else { 01736 TGDoubleSlider *sd = (TGDoubleSlider *) frm; 01737 id = sd->WidgetId(); 01738 } 01739 01740 char buf[32]; 01741 sprintf(buf, "%d", pos); 01742 01743 #ifdef CINT_FIXED 01744 switch (id) { 01745 case HSId1: 01746 #else 01747 if (id == HSId1) { 01748 #endif 01749 fTbh1->Clear(); 01750 fTbh1->AddText(0, buf); 01751 // Re-align the cursor with the characters. 01752 fTeh1->SetCursorPosition(fTeh1->GetCursorPosition()); 01753 fTeh1->Deselect(); 01754 gClient->NeedRedraw(fTeh1); 01755 #ifdef CINT_FIXED 01756 break; 01757 case VSId1: 01758 #else 01759 } 01760 else if (id == VSId1) { 01761 #endif 01762 fTbv1->Clear(); 01763 fTbv1->AddText(0, buf); 01764 fTev1->SetCursorPosition(fTev1->GetCursorPosition()); 01765 fTev1->Deselect(); 01766 gClient->NeedRedraw(fTev1); 01767 #ifdef CINT_FIXED 01768 break; 01769 case HSId2: 01770 #else 01771 } 01772 else if (id == HSId2) { 01773 #endif 01774 fTbh2->Clear(); 01775 fTbh2->AddText(0, buf); 01776 fTeh2->SetCursorPosition(fTeh2->GetCursorPosition()); 01777 fTeh2->Deselect(); 01778 gClient->NeedRedraw(fTeh2); 01779 #ifdef CINT_FIXED 01780 break; 01781 case VSId2: 01782 #else 01783 } 01784 else if (id == VSId2) { 01785 #endif 01786 sprintf(buf, "%f", fVslider2->GetMinPosition()); 01787 fTbv2->Clear(); 01788 fTbv2->AddText(0, buf); 01789 fTev2->SetCursorPosition(fTev2->GetCursorPosition()); 01790 fTev2->Deselect(); 01791 gClient->NeedRedraw(fTev2); 01792 #ifdef CINT_FIXED 01793 break; 01794 default: 01795 break; 01796 #endif 01797 } 01798 }
TGTransientFrame* TestSliders::fMain [private] |
TGVerticalFrame* TestSliders::fVframe1 [private] |
TGVerticalFrame * TestSliders::fVframe2 [private] |
TGLayoutHints* TestSliders::fBly [private] |
TGLayoutHints * TestSliders::fBfly1 [private] |
TGHSlider* TestSliders::fHslider1 [private] |
TGHSlider * TestSliders::fHslider2 [private] |
TGVSlider* TestSliders::fVslider1 [private] |
TGDoubleVSlider* TestSliders::fVslider2 [private] |
TGTextEntry* TestSliders::fTeh1 [private] |
TGTextEntry * TestSliders::fTev1 [private] |
TGTextEntry * TestSliders::fTeh2 [private] |
TGTextEntry * TestSliders::fTev2 [private] |
TGTextBuffer* TestSliders::fTbh1 [private] |
TGTextBuffer * TestSliders::fTbv1 [private] |
TGTextBuffer * TestSliders::fTbh2 [private] |
TGTextBuffer * TestSliders::fTbv2 [private] |