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(); }
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; } } }