void FalagardCheckButton::setSelectImage(const RenderableImage* image) { if (image) { d_selectImage = *image; d_selectImage.setRect(Rect(0, 0, getAbsoluteWidth(), getAbsoluteHeight())); } requestRedraw(); }
void FalagardCheckButton::setCustomImageryAutoSized(bool setting) { // if we are enabling auto-sizing, scale images for current size if (setting && setting != d_autoscaleImages) { Rect area(0, 0, getAbsoluteWidth(), getAbsoluteHeight()); d_selectImage.setRect(area); requestRedraw(); } PushButton::setCustomImageryAutoSized( setting ); }
void PushButton::setDisabledImage(const RenderableImage* image) { if (image) { d_useDisabledImage = true; d_disabledImage = *image; d_disabledImage.setRect(Rect(0, 0, getAbsoluteWidth(), getAbsoluteHeight())); } else { d_useDisabledImage = false; } requestRedraw(); }
void PushButton::setCustomImageryAutoSized(bool setting) { // if we are enabling auto-sizing, scale images for current size if (setting && setting != d_autoscaleImages) { Rect area(0, 0, getAbsoluteWidth(), getAbsoluteHeight()); d_normalImage.setRect(area); d_hoverImage.setRect(area); d_pushedImage.setRect(area); d_disabledImage.setRect(area); requestRedraw(); } d_autoscaleImages = setting; }
void FalagardSuperProgress::populateRenderCache() { // FalagardStaticImage::populateRenderCache(); if( d_curPos == d_progress ) d_rectProgress = Rect( 0, 0, getAbsoluteWidth() * d_progress, getAbsoluteHeight() ); // 不管是不是有效果,都要画这一步得 d_BackImage.setColours( getCurColor() ); d_BackImage.setRect( d_rectProgress ); d_BackImage.draw( d_renderCache ); if( d_curPos != d_progress ) { d_BackImage.setColours( d_EffectColor ); d_BackImage.setRect( d_rectEffect ); d_BackImage.draw( d_renderCache ); } }
void PushButton::onSized(WindowEventArgs& e) { // default processing ButtonBase::onSized(e); // scale images if required. if (d_autoscaleImages) { Rect area(0, 0, getAbsoluteWidth(), getAbsoluteHeight()); d_normalImage.setRect(area); d_hoverImage.setRect(area); d_pushedImage.setRect(area); d_disabledImage.setRect(area); e.handled = true; } }
void FalagardPaoPao::updateSelfSize() { FalagardSelfFitWindow::updateSelfSize(); const WidgetLookFeel& wlf = WidgetLookManager::getSingleton().getWidgetLook(d_lookName); if( wlf.isNamedAreaDefined( "TextArea" ) ) { const Rect rectBorder(wlf.getNamedArea("TextArea").getArea().getPixelRect(*this)); Rect wndArea(getAbsoluteRect()); Size size(getAbsoluteSize()); size.d_width += wndArea.getWidth() - rectBorder.getWidth(); size.d_height += wndArea.getHeight() - rectBorder.getHeight(); setSize(Absolute, size); } if( d_ArrowImage.getImage() ) { Size size = d_ArrowImage.getImage()->getSize(); Rect area( getAbsoluteWidth() / 2 - size.d_width / 2, getAbsoluteHeight() - size.d_height, getAbsoluteWidth() / 2 + size.d_width / 2, getAbsoluteHeight() ); d_ArrowImage.setRect( area ); } }
void FalagardSuperProgress::updateSelf(float elapsed) { if( d_curPos != d_progress ) // 说明需要更新了 { float fMoveLength = elapsed * d_MoveSpeed; if( d_curPos > d_progress ) // 如果比当前得值,就说名是再减 { d_curPos -= fMoveLength; if( d_curPos < d_progress ) d_curPos = d_progress; } else { d_curPos += fMoveLength; if( d_curPos > d_progress ) d_curPos = d_progress; } if( d_curPos < d_progress ) { d_rectEffect = Rect( getAbsoluteWidth() * d_curPos, 0, getAbsoluteWidth() * d_progress, getAbsoluteHeight() ); d_rectProgress = Rect( 0, 0, getAbsoluteWidth() * d_progress, getAbsoluteHeight() ); } else { d_rectEffect = Rect( getAbsoluteWidth() * d_progress, 0, getAbsoluteWidth() * d_curPos, getAbsoluteHeight() ); d_rectProgress = Rect( 0, 0, getAbsoluteWidth() * d_curPos, getAbsoluteHeight() ); } if( d_curPos < 0 ) d_curPos = 0; if( d_curPos > 1 ) d_curPos = 1; requestRedraw(); d_needsRedraw = true; } }