Public Member Functions | |
TileFrame (const TGWindow *p) | |
virtual | ~TileFrame () |
TGFrame * | GetFrame () const |
void | SetCanvas (TGCanvas *canvas) |
void | HandleMouseWheel (Event_t *event) |
Private Attributes | |
TGCompositeFrame * | fFrame |
TGCanvas * | fCanvas |
Definition at line 519 of file guitest.C.
TileFrame::TileFrame | ( | const TGWindow * | p | ) |
Definition at line 537 of file guitest.C.
00538 { 00539 // Create tile view container. Used to show colormap. 00540 00541 fFrame = new TGCompositeFrame(p, 10, 10, kHorizontalFrame, 00542 TGFrame::GetWhitePixel()); 00543 fFrame->Connect("ProcessedEvent(Event_t*)", "TileFrame", this, 00544 "HandleMouseWheel(Event_t*)"); 00545 fCanvas = 0; 00546 fFrame->SetLayoutManager(new TGTileLayout(fFrame, 8)); 00547 00548 gVirtualX->GrabButton(fFrame->GetId(), kAnyButton, kAnyModifier, 00549 kButtonPressMask | kButtonReleaseMask | 00550 kPointerMotionMask, kNone, kNone); 00551 }
virtual TileFrame::~TileFrame | ( | ) | [inline, virtual] |
TGFrame* TileFrame::GetFrame | ( | ) | const [inline] |
Definition at line 531 of file guitest.C.
Referenced by TestMainFrame::TestMainFrame().
00531 { return fFrame; }
void TileFrame::SetCanvas | ( | TGCanvas * | canvas | ) | [inline] |
Definition at line 533 of file guitest.C.
Referenced by TestMainFrame::TestMainFrame().
00533 { fCanvas = canvas; }
void TileFrame::HandleMouseWheel | ( | Event_t * | event | ) |
Definition at line 553 of file guitest.C.
00554 { 00555 // Handle mouse wheel to scroll. 00556 00557 if (event->fType != kButtonPress && event->fType != kButtonRelease) 00558 return; 00559 00560 Int_t page = 0; 00561 if (event->fCode == kButton4 || event->fCode == kButton5) { 00562 if (!fCanvas) return; 00563 if (fCanvas->GetContainer()->GetHeight()) 00564 page = Int_t(Float_t(fCanvas->GetViewPort()->GetHeight() * 00565 fCanvas->GetViewPort()->GetHeight()) / 00566 fCanvas->GetContainer()->GetHeight()); 00567 } 00568 00569 if (event->fCode == kButton4) { 00570 //scroll up 00571 Int_t newpos = fCanvas->GetVsbPosition() - page; 00572 if (newpos < 0) newpos = 0; 00573 fCanvas->SetVsbPosition(newpos); 00574 } 00575 if (event->fCode == kButton5) { 00576 // scroll down 00577 Int_t newpos = fCanvas->GetVsbPosition() + page; 00578 fCanvas->SetVsbPosition(newpos); 00579 } 00580 }
TGCompositeFrame* TileFrame::fFrame [private] |
TGCanvas* TileFrame::fCanvas [private] |
Definition at line 525 of file guitest.C.
Referenced by HandleMouseWheel(), SetCanvas(), and TileFrame().