Exemplo n.º 1
0
Layer* AbstractWindow::getDrawnForeground(void) const
{
	if(getDrawDecorations())
    {
        if(getEnabled())
        {
            if(getFocused())
            {
                return getFocusedForeground();
            }
            else if(_MouseInComponentLastMouse)
            {
                return getRolloverForeground();
            }
            else
            {
                return getForeground();
            }
        }
        else
        {
            return getDisabledForeground();
        }
    }
    else
	{
		return NULL;
	}
}
Exemplo n.º 2
0
Border* AbstractWindow::getDrawnBorder(void) const
{
    if(getDrawDecorations())
    {
        if(getEnabled())
        {
            if(getFocused())
            {
                return getFocusedBorder();
            }
            else if(_MouseInComponentLastMouse)
            {
                return getRolloverBorder();
            }
            else
            {
                return getBorder();
            }
        }
        else
        {
            return getDisabledBorder();
        }
    }
    else
    {
        return NULL;
    }
}
Exemplo n.º 3
0
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);
    }
}
Exemplo n.º 4
0
void InternalWindow::drawInternal(Graphics* const TheGraphics, Real32 Opacity) const
{
    Inherited::drawInternal(TheGraphics, Opacity);

    //If I have an active TitleBar then draw it
    if(getDrawDecorations() && getDrawTitlebar() && getTitlebar() != NULL)
    {
        getTitlebar()->draw(TheGraphics, Opacity*getOpacity());
    }

    //If I have a MenuBar then Draw it
    if(getMenuBar() != NULL)
    {
        getMenuBar()->draw(TheGraphics, Opacity*getOpacity());
    }
}
Exemplo n.º 5
0
void InternalWindow::updateLayout(void)
{
    //If I have a MenuBar Update it's layout
    if(getMenuBar() != NULL)
    {
        Pnt2f MenuTopLeft, MenuBottomRight;
        getMenuBar()->updateLayout();
        getMenuBarBounds(MenuTopLeft, MenuBottomRight);
        getMenuBar()->setPosition(MenuTopLeft);
        getMenuBar()->setSize(Vec2f( MenuBottomRight.x() - MenuTopLeft.x(), getMenuBar()->getPreferredSize().y()));
    }

    //If I have a Titlebar then update it's layout
    if(getDrawDecorations() && getDrawTitlebar() && getTitlebar() != NULL)
    {
        Pnt2f TitlebarTopLeft, TitlebarBottomRight;
        getTitlebarBounds(TitlebarTopLeft, TitlebarBottomRight);
        getTitlebar()->setPosition(TitlebarTopLeft);
        getTitlebar()->setSize(Vec2f( TitlebarBottomRight.x() - TitlebarTopLeft.x(), getTitlebar()->getPreferredSize().y()));
    }

    ComponentContainer::updateLayout();
}
Exemplo n.º 6
0
InternalWindow::WindowArea InternalWindow::getCursurArea(const Pnt2f& DrawingSurfaceLocation) const
{
    Pnt2f LocationInWindow(DrawingSurfaceToComponent(DrawingSurfaceLocation, this));
    if(LocationInWindow.x() < 0 ||
       LocationInWindow.x() > getSize().x() ||
       LocationInWindow.y() < 0 ||
       LocationInWindow.y() > getSize().y())
    {
        return WINDOW_OUTSIDE;
    }
    else
    {
        if(getDrawDecorations())
        {
            Pnt2f TitlebarTopLeft, TitlebarBottomRight;
            getTitlebarBounds(TitlebarTopLeft, TitlebarBottomRight);
            //Borders
            if(LocationInWindow.x() < getResizeModifyCursorWidth() || 
               LocationInWindow.y() < getResizeModifyCursorWidth() ||
               LocationInWindow.x() > (getSize().x() - getResizeModifyCursorWidth()) || 
               LocationInWindow.y() > (getSize().y() - getResizeModifyCursorWidth()))
            {
                //Top Left
                if(LocationInWindow.x() >= 0 &&
                   LocationInWindow.x() < getResizeModifyCursorWidth() &&
                   LocationInWindow.y() >= 0 &&
                   LocationInWindow.y() < getResizeModifyCursorWidth())
                {
                    return WINDOW_TOP_LEFT_BORDER;
                }
                //Bottom Right
                else if(LocationInWindow.x() >= getSize().x() - getResizeModifyCursorWidth() &&
                        LocationInWindow.x() < getSize().x() &&
                        LocationInWindow.y() >= getSize().y() - getResizeModifyCursorWidth() &&
                        LocationInWindow.y() < getSize().y())
                {
                    return WINDOW_BOTTOM_RIGHT_BORDER;
                }
                //Top Right
                else if(LocationInWindow.x() >= getSize().x() - getResizeModifyCursorWidth() &&
                        LocationInWindow.x() < getSize().x() &&
                        LocationInWindow.y() >= 0 &&
                        LocationInWindow.y() < getResizeModifyCursorWidth())
                {
                    return WINDOW_TOP_RIGHT_BORDER;
                }
                //Bottom Left
                else if(LocationInWindow.x() >= 0 &&
                        LocationInWindow.x() < getResizeModifyCursorWidth() &&
                        LocationInWindow.y() >= getSize().y() - getResizeModifyCursorWidth() &&
                        LocationInWindow.y() < getSize().y())
                {
                    return WINDOW_BOTTOM_LEFT_BORDER;
                }
                //Left
                else if(LocationInWindow.x() >= 0 &&
                        LocationInWindow.x() < getResizeModifyCursorWidth() &&
                        LocationInWindow.y() >= getResizeModifyCursorWidth() &&
                        LocationInWindow.y() < getSize().y() - getResizeModifyCursorWidth())
                {
                    return WINDOW_LEFT_BORDER;
                }
                //Right
                else if(LocationInWindow.x() >= getSize().x() - getResizeModifyCursorWidth() &&
                        LocationInWindow.x() < getSize().x() &&
                        LocationInWindow.y() >= getResizeModifyCursorWidth() &&
                        LocationInWindow.y() < getSize().y() - getResizeModifyCursorWidth())
                {
                    return WINDOW_RIGHT_BORDER;
                }
                //Top
                else if(LocationInWindow.x() >= getResizeModifyCursorWidth() &&
                        LocationInWindow.x() < getSize().x() - getResizeModifyCursorWidth() &&
                        LocationInWindow.y() >= 0 &&
                        LocationInWindow.y() < getResizeModifyCursorWidth())
                {
                    return WINDOW_TOP_BORDER;
                }
                //Bottom
                else if(
                        (LocationInWindow.x() >= getResizeModifyCursorWidth() &&
                         LocationInWindow.x() < getSize().x() - getResizeModifyCursorWidth() &&
                         LocationInWindow.y() >= getSize().y() - getResizeModifyCursorWidth() &&
                         LocationInWindow.y() < getSize().y()))
                {
                    return WINDOW_BOTTOM_BORDER;
                }
            }
            //Title bar
            else if(getDrawTitlebar() && isContainedBounds(LocationInWindow, TitlebarTopLeft, TitlebarBottomRight))
            {
                return WINDOW_TITLE_BAR;
            }
            //Main Panel
            else
            {
                return WINDOW_MAIN_PANEL;
            }
        }
        else
        {
            return WINDOW_MAIN_PANEL;
        }
    }
}