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); }
int CHoverButton::GetGumpID(STATE state) { CGumpPtr pDib = GetGump(state); if (pDib) return pDib->GetGumpID(); return -1; }
long CGumpEditorView::AddControl(WPARAM wParam, LPARAM lParam) { // Creates a new control on the screen, caught from the // drop event from the toolbar control UINT nType = wParam; CPoint point(lParam>>16,lParam&0xffff); CGumpPtr pGump = GetDocument()->GetSelectedGump(); if (!pGump) return 0; CGumpControlTypeDlg dlg; if (IDOK != dlg.DoModal()) return 0; int controlType = dlg.GetControlType(); CDiagramEntity* obj=NULL; if (controlType==dlg.PICTURE) { obj = new CGumpPicture(pGump); } else if (controlType==dlg.BORDER) { obj = new CGumpBorder(pGump); } else if (controlType==dlg.PAPERDOLL) { obj = new CGumpPaperdoll(pGump); } else if (controlType==dlg.BUTTON) { CGumpPtr pGump2 = GetDocument()->FindGump(pGump->GetGumpID()+1,pGump->GetWidth(),pGump->GetHeight()); obj = new CGumpButton(pGump,pGump,pGump2 ? pGump2 : pGump); } else if (controlType==dlg.CHECKBOX) { CGumpPtr pGump2 = GetDocument()->FindGump(pGump->GetGumpID()+1,pGump->GetWidth(),pGump->GetHeight()); obj = new CGumpCheckbox(pGump, pGump2); } else if (controlType==dlg.RADIO) { CGumpPtr pGump2 = GetDocument()->FindGump(pGump->GetGumpID()+1,pGump->GetWidth(),pGump->GetHeight()); obj = new CGumpRadio(pGump, pGump2); } if (!obj) return 0; CSize size = obj->GetRect().Size(); CRect rect(point,point+size); m_editor.AdjustRect(rect); obj->SetRect(rect); m_editor.UnselectAll(); m_editor.SelectObject( obj, TRUE); m_editor.AddObject( obj ); return 0; }
CGumpPicture::CGumpPicture(CGumpPtr pGump) { SetGump(pGump); SetTitle("Picture"); SetType("picture"); CString strName; strName.Format("picture_%x", pGump ? pGump->GetGumpID() : 0); SetName(strName); AddPropertyPage( &m_page ); }
CGumpBorder::CGumpBorder(CGumpPtr pGump) : CGumpPicture(NULL) { SetGump(pGump); SetTitle("border"); SetType("border"); CString strName; strName.Format("border_%x", pGump ? pGump->GetGumpID() : 0); SetName(strName); //AddPropertyPage( &m_page ); }
CGumpButton::CGumpButton(CGumpPtr pNormal, CGumpPtr pHover, CGumpPtr pPressed) { //ASSERT(pNormal); SetGump(pNormal, pHover, pPressed); SetTitle("button"); SetType("button"); CString strName; strName.Format("button_%x", pNormal ? pNormal->GetGumpID() : 0); SetName(strName); AddPropertyPage( &m_page ); }
CGumpRadio::CGumpRadio(CGumpPtr pNormal, CGumpPtr pChecked, int iGroupID, bool bCheck) : CGumpCheckbox(pNormal,pChecked,bCheck) { // SetGump(pNormal, pChecked); SetTitle("radio"); SetType("radio"); CString strName; strName.Format("radio_%x", pNormal ? pNormal->GetGumpID() : 0); SetName(strName); SetGroupID(iGroupID); AddPropertyPage( &m_page ); }
CGumpPicture::CGumpPicture(CGumpPtr pGump, TYPE eType, DWORD hueId) { SetGump(pGump); SetTitle("Picture"); SetType("picture"); CString strName; strName.Format("picture_%x", pGump ? pGump->GetGumpID() : 0); SetName(strName); SetPictureType(eType); SetHueId(hueId); AddPropertyPage( &m_page ); }