void InternalWindow::getTitlebarBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const { if(getDrawDecorations() && getDrawTitlebar() && getDrawnBorder()->getType().isDerivedFrom(WindowBorder::getClassType())) { dynamic_pointer_cast<WindowBorder>(getDrawnBorder())->getTitlebarBounds(0, 0, getSize().x(), getSize().y(), TopLeft, BottomRight); } else { TopLeft.setValues(0,0); BottomRight.setValues(0,0); } }
bool Component::isContained(const Pnt2f& p, bool TestAgainstClipBounds) const { if(!getVisible()) { return false; } Pnt2f PointInCompSpace(DrawingSurfaceToComponent(p,this)); Border* DrawnBorder(getDrawnBorder()); Pnt2f TopLeft, BottomRight; if(TestAgainstClipBounds && getClipping()) { TopLeft = getClipTopLeft(); BottomRight = getClipBottomRight(); } else { TopLeft.setValues(0,0); BottomRight = Pnt2f(getSize()); } if(DrawnBorder == NULL) { return isContainedBounds(PointInCompSpace, TopLeft, BottomRight); } else { return isContainedBounds(PointInCompSpace, TopLeft, BottomRight) && DrawnBorder->isContained(PointInCompSpace,0,0,getSize().x(),getSize().y()); } }
Vec2f ToolTip::calculatePreferredSize(void) const { if(getFont() == NULL) { return getPreferredSize(); } Real32 Top(0),Bottom(0),Left(0),Right(0); if(getDrawnBorder() != NULL) { getDrawnBorder()->getInsets(Left, Right, Top, Bottom); } Pnt2f TextTopLeft, TextBottomRight; getFont()->getBounds(getText(), TextTopLeft, TextBottomRight); return TextBottomRight - TextTopLeft + Vec2f(Left+Right+2, Top+Bottom+2); }
void Component::draw(Graphics* const TheGraphics, Real32 Opacity) const { //If not visible then don't draw if (!getVisible()) return; //Grab the initial transformation GLdouble InitMat[16]; glGetDoublev(GL_MODELVIEW_MATRIX, InitMat); //Translate to my position glTranslatef(getPosition().x(), getPosition().y(), 0); if(setupClipping(TheGraphics)) { //Activate My Border Drawing constraints Border* DrawnBorder = getDrawnBorder(); if(DrawnBorder != NULL) { DrawnBorder->activateInternalDrawConstraints(TheGraphics,0,0,getSize().x(),getSize().y()); } //Draw My Background drawBackground(TheGraphics, getDrawnBackground(), Opacity); //Draw Internal drawInternal(TheGraphics, Opacity); //Make sure the clipping is reset setupClipping(TheGraphics); //Draw My Foreground drawForeground(TheGraphics, getDrawnForeground(), Opacity); //Draw all parts that should not be clipped against drawUnclipped(TheGraphics, Opacity); } //Reset the transformation glLoadMatrixd(InitMat); }
void Component::drawUnclipped(Graphics* const TheGraphics, Real32 Opacity) const { //Draw Border drawBorder(TheGraphics, getDrawnBorder(), Opacity); }