void CUIEditorView::updateCurrentWindowStatusText(void) { if (m_pSelectedWindow) { CHAR szText[MAX_PATH] = {0}; CEGUI::Rect rect = m_pSelectedWindow->getRect(CEGUI::Absolute); sprintf(szText, "当前窗口:%s 位置:(%d,%d) 大小:(%d,%d)",m_pSelectedWindow->getName().c_str(), (INT)rect.getPosition().d_x,(INT)rect.getPosition().d_y, (INT)rect.getWidth(), (INT)rect.getHeight()); ((CMainFrame*)AfxGetMainWnd())->SetStatusText(2,szText); sprintf(szText, "当前窗口类型:%s",m_pSelectedWindow->getWidgetType().c_str()); ((CMainFrame*)AfxGetMainWnd())->SetStatusText(3,szText); } }
//只改变大小,不改变位置 void CUIEditorView::sizingWindow(CPoint point,INT type,CEGUI::Window* pWin/* = NULL*/) { CEGUI::Window* pWindow = pWin ? pWin : m_pSelectedWindow; if (pWindow) { CEGUI::Window* pParent = pWindow; CEGUI::Size pt(0,0); if (pWindow->getParent() == CEGUI::System::getSingleton().getGUISheet()) { CEGUI::Point pos = pWindow->getPixelRect().getPosition(); pt = CEGUI::Size(point.x - pos.d_x, point.y - pos.d_y); } else { while (pParent && pParent->getParent() != CEGUI::System::getSingleton().getGUISheet()) { pParent = pParent->getParent(); } CEGUI::Rect rectWindow = pWindow->getPixelRect(); pt = CEGUI::Size(point.x -rectWindow.getPosition().d_x ,point.y -rectWindow.getPosition().d_y); } pWindow->setClippedByParent(true); if(type == 0) { pWindow->setHeight(CEGUI::Absolute,pt.d_height); } else if (type == 1) { pWindow->setWidth(CEGUI::Absolute,pt.d_width); } else { pWindow->setSize(CEGUI::Absolute, pt); } } }
void draw(CEGUI::GeometryBuffer& buffer, const CEGUI::Rect& targetRect, float alpha, const CEGUI::Rect* clipper) const { using namespace CEGUI; if (d_selected && d_selectBrush != 0) d_selectBrush->draw(buffer, targetRect, clipper, getModulateAlphaColourRect(d_selectCols, alpha)); if (!d_renderedStringValid) parseTextString(); d_formattedRenderedString->format(targetRect.getSize()); const ColourRect final_colours( getModulateAlphaColourRect(ColourRect(0xFFFFFFFF), alpha)); d_formattedRenderedString->draw(buffer, targetRect.getPosition(), &final_colours, clipper); }