Beispiel #1
0
 /**
  * Saves the PageNavigator in the GUI objects stack
  */
 function preFilter()
 {
     // Show / hide text
     if (!$this->currentPage || !$this->pageNumber) {
         $this->showText(false);
     }
     // Auto show fast next / last
     if ($this->arrowFirst->hasLink() || $this->arrowLast->hasLink()) {
         $this->showLast();
     }
     if ($this->arrowFastNext->hasLink() || $this->arrowFastPrev->hasLink()) {
         $this->showFastNext();
     }
     // Arrow styles
     if ($this->arrowNext->hasLink()) {
         $this->arrowNext->setSubStyle($this->arrowNextStyle);
     }
     if ($this->arrowPrev->hasLink()) {
         $this->arrowPrev->setSubStyle($this->arrowPrevStyle);
     }
     if ($this->arrowNext->hasLink() && $this->arrowFastNext->hasLink()) {
         $this->arrowFastNext->setSubStyle($this->arrowFastNextStyle);
     } else {
         $this->arrowFastNext->setManialink(null);
     }
     if ($this->arrowPrev->hasLink() && $this->arrowFastPrev->hasLink()) {
         $this->arrowFastPrev->setSubStyle($this->arrowFastPrevStyle);
     } else {
         $this->arrowFastPrev->setManialink(null);
     }
     if ($this->arrowNext->hasLink() && $this->arrowLast->hasLink()) {
         $this->arrowLast->setSubStyle($this->arrowLastStyle);
     } else {
         $this->arrowLast->setManialink(null);
     }
     if ($this->arrowPrev->hasLink() && $this->arrowFirst->hasLink()) {
         $this->arrowFirst->setSubStyle($this->arrowFirstStyle);
     } else {
         $this->arrowFirst->setManialink(null);
     }
     // Text
     $this->text->setStyle(\ManiaLib\Gui\Elements\Label::TextValueSmall);
     $this->text->setText($this->currentPage . ' / ' . $this->pageNumber);
     // Positioning in relation to the center of the containing frame
     $this->text->setAlign("center", "center2");
     $this->text->setPosZ(1);
     $this->textBg->setSubStyle(\ManiaLib\Gui\Elements\Bgs1::BgPager);
     $this->textBg->setAlign('center', 'center');
     $this->textBg->setPosZ(0.5);
     $this->arrowNext->setValign("center");
     $this->arrowFastNext->setValign("center");
     $this->arrowLast->setValign("center");
     $this->arrowNext->setPosition($this->text->getSizeX() / 2 + 1, 0, 1);
     $this->arrowFastNext->setPosition($this->arrowNext->getPosX() + $this->arrowNext->getSizeX(), 0, 1);
     $this->arrowLast->setPosition($this->arrowNext->getPosX() + (int) $this->showFastNext * $this->arrowFastNext->getSizeX() + $this->arrowNext->getSizeX(), 0, 1);
     $this->arrowPrev->setAlign("right", "center");
     $this->arrowFastPrev->setAlign("right", "center");
     $this->arrowFirst->setAlign("right", "center");
     $this->arrowPrev->setPosition(-($this->text->getSizeX() / 2) - 1, 0, 1);
     $this->arrowFastPrev->setPosition($this->arrowPrev->getPosX() - $this->arrowPrev->getSizeX(), 0, 1);
     $this->arrowFirst->setPosition($this->arrowPrev->getPosX() - (int) $this->showFastNext * $this->arrowFastPrev->getSizeX() - $this->arrowPrev->getSizeX(), 0, 1);
     // Save the gui
     if ($this->showText) {
         $this->add($this->textBg);
         $this->add($this->text);
     }
     $this->add($this->arrowNext);
     $this->add($this->arrowPrev);
     if ($this->showLast) {
         $this->add($this->arrowFirst);
         $this->add($this->arrowLast);
     }
     if ($this->showFastNext) {
         $this->add($this->arrowFastNext);
         $this->add($this->arrowFastPrev);
     }
 }