void CGumpBorder::SetGump(CGumpPtr pGump, bool bUpdateRect) { // ASSERT(pGump); for (int i = 0; i < NUM_PART; i++) { m_pGumpB[i] = NULL; m_sizeGumpB[i].SetSize(0,0); } if (!pGump) return; int iGumpID = pGump->GetGumpID(); int iWidth = 0, iHeight = 0; CGumpEditorDoc* pDoc = GfxGetGumpDocument(); m_pGumpB[LT] = pGump; m_sizeGumpB[LT] = pGump->GetDimensions(); for (int i = 1; i < NUM_PART; i++) { m_pGumpB[i] = pDoc->LoadGump(iGumpID+i); if (!m_pGumpB[i]) continue; m_sizeGumpB[i] = m_pGumpB[i]->GetDimensions(); if (i < LC) iWidth += m_sizeGumpB[i].cx; if (i % LC == 0) iHeight += m_sizeGumpB[i].cy; } if (!bUpdateRect) return; CRect rect = GetRect(); SetRect(rect.left,rect.top,rect.left+iWidth,rect.top+iHeight); }
void CGumpButton::SetGump(STATE state, CGumpPtr pGump) { //ASSERT(pGump); m_pGump[state] = pGump; if (NORMAL==state && pGump) { CRect rect = GetRect(); CSize size = pGump->GetDimensions(); SetConstraints(size,size); SetRect(rect.left,rect.top,rect.left+size.cx,rect.top+size.cy); } }