本文整理汇总了C++中CGumpEditorDoc类的典型用法代码示例。如果您正苦于以下问题:C++ CGumpEditorDoc类的具体用法?C++ CGumpEditorDoc怎么用?C++ CGumpEditorDoc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGumpEditorDoc类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateData
void CGumpSliderPropertyPage::ApplyValues()
{
if (GetSafeHwnd() && GetEntity())
{
UpdateData();
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
CGumpSlider* pSlider= dynamic_cast<CGumpSlider*>(GetEntity()); ASSERT(pSlider);
if (!pSlider) return;
int iTrackID = GfxAtoX(m_strTrackID);
int iThumbID = GfxAtoX(m_strThumbID);
CGumpPtr pTrack, pThumb, pGump;
pSlider->GetGump(pTrack, pThumb);
if (pTrack->GetGumpID() != iTrackID && (pGump = pDoc->GetGump(iTrackID)))
{
pSlider->SetGump(CGumpSlider::TRACK, pGump);
}
if (pThumb->GetGumpID() != iThumbID && (pGump = pDoc->GetGump(iThumbID)))
{
pSlider->SetGump(CGumpSlider::THUMB, pGump);
}
pSlider->SetRange(m_iMin, m_iMax);
pSlider->SetPos(m_iPos);
pSlider->SetVertical(m_bVertical);
Redraw();
}
}
示例2: UpdateData
void CGumpScrollbarPropertyPage::ApplyValues()
{
if (GetSafeHwnd() && GetEntity())
{
UpdateData();
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
CGumpScrollbar* pScrollbar = dynamic_cast<CGumpScrollbar*>(GetEntity()); ASSERT(pScrollbar);
if (!pScrollbar) return;
CGumpPtr pGump;
int iGumpID1 = -1, iGumpID2 = -1;
for (int i = 0; i < NUM_PART; i++) {
iGumpID1 = GfxAtoX(m_strGumpID[i]);
iGumpID2 = pScrollbar->GetGumpID(CGumpScrollbar::PART(i));
if (iGumpID1 != iGumpID2 && (pGump = pDoc->GetGump(iGumpID1)))
pScrollbar->SetGump(CGumpScrollbar::PART(i), pGump);
}
pScrollbar->SetRange(m_iMin, m_iMax);
pScrollbar->SetPos(m_iPos);
pScrollbar->SetVertical(m_bVertical);
pScrollbar->SetUseArrowButton(m_bUseArrow);
Redraw();
}
}
示例3: GfxGetGumpDocument
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);
}
示例4: GfxGetGumpDocument
void CGumpPicture::Draw( CDC* dc, CRect rect )
{
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
ASSERT(pDoc);
if (m_eType == RECTANGLE)
{
CBrush brush(pDoc->GetHueColor(GetHueId()));
dc->FillRect(rect, &brush);
}
else
if (m_eType == FRAME)
{
CBrush brush(pDoc->GetHueColor(GetHueId()));
dc->FrameRect(rect, &brush);
}
else
if (m_eType == GUMP && m_pGump)
{
m_pGump->DrawGump(dc, rect, GetZoom());
}
else
{
CGumpEntity::Draw(dc,rect);
}
//dc->SelectStockObject( ANSI_VAR_FONT );
}
示例5: dc
void CGumpStaticPropertyPage::OnPaint()
{
CPaintDC dc(this);
CString strId;
int i = m_cbFont.GetCurSel();
m_cbFont.GetLBText(i, strId);
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
CFont* pOldFont = dc.SelectObject(pDoc->GetFont(GetFontId()));
COLORREF crOld = dc.SetTextColor(m_btnColor.GetColor());
dc.SetBkMode(TRANSPARENT);
CRect rect;
GetDlgItem(IDC_TEXT_STATIC)->GetWindowRect(rect);
ScreenToClient(rect);
rect.DeflateRect(5,0,0,5);
UINT nFormat[] = { DT_LEFT, DT_CENTER, DT_RIGHT };
UINT format = DT_VCENTER | nFormat[m_iTextAlign];
CString strText = m_strText;
if (!m_bMultiLine) {
format |= DT_SINGLELINE;
}
else {
// '\\n' -> '\r\n'
strText = GfxFormatText(strText);
}
dc.DrawText(strText, rect, format);
dc.SelectObject(pOldFont);
dc.SetTextColor(crOld);
}
示例6: UpdateData
void CGumpCheckboxPropertyPage::ApplyValues()
{
if (GetSafeHwnd() && GetEntity())
{
UpdateData();
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
ASSERT(pDoc);
CGumpCheckbox* pCheckbox = (CGumpCheckbox*)GetEntity();
pCheckbox->SetCheck(m_bChecked);
int iNormalID =GfxAtoX(m_strNormalID);
int iCheckedID =GfxAtoX(m_strCheckedID);
CGumpPtr pNormal, pChecked, pPressed, pGump;
pCheckbox->GetGump(pNormal, pChecked);
if (pNormal->GetGumpID() != iNormalID
&& (pGump = pDoc->GetGump(iNormalID)))
{
pCheckbox->SetGump(CGumpCheckbox::NORMAL, pGump);
m_btnTest.SetGump(CHoverButton::NORMAL, pGump);
}
if (pChecked->GetGumpID() != iCheckedID
&& (pGump = pDoc->GetGump(iCheckedID)))
{
pCheckbox->SetGump(CGumpCheckbox::CHECKED, pGump);
m_btnTest.SetGump(CHoverButton::PRESSED, pGump);
}
Redraw();
}
}
示例7: GfxGetGumpDocument
BOOL CGumpStaticPropertyPage::OnInitDialog()
{
CDiagramPropertyPage::OnInitDialog();
m_btnColor.SetStyle(TRUE);
m_btnColor.SetTrackSelection(TRUE);
m_btnColor.SetDefaultText("");
CGumpEditorDoc* pDoc = GfxGetGumpDocument(); ASSERT(pDoc);
using namespace std;
CString strId;
for (vector<nConfig::font_info>::iterator iter=nConfig::fonts.begin(); iter != nConfig::fonts.end(); iter++)
{
if (!pDoc->GetFont(iter->id)) continue;
strId.Format("%d", iter->id);
m_cbFont.AddString(strId);
}
if (LB_ERR != m_cbFont.SetCurSel(3))
{
m_cbFont.GetLBText(m_cbFont.GetCurSel(), strId);
}
m_btnColor.SetFontId(GetFontId());
return TRUE;
}
示例8: GfxGetGumpDocument
void CDialogEditorDemoView::OnSettings()
{
#if 0
CGumpEditorDoc* pDoc = GfxGetGumpDocument(); ASSERT(pDoc);
CDialogSettings dlg;
dlg.m_width = m_editor.GetVirtualSize().cx;
dlg.m_height = m_editor.GetVirtualSize().cy;
dlg.m_gridWidth = m_editor.GetGridSize().cx;
dlg.m_gridHeight = m_editor.GetGridSize().cy;
m_editor.GetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom );
dlg.m_strName = pDoc->GetName();
dlg.m_iAlpha = pDoc->GetAlpha();
dlg.m_iFlags = pDoc->GetFlags();
pDoc->GetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed);
if( dlg.DoModal() == IDOK )
{
m_editor.SetGridSize( CSize( dlg.m_gridWidth, dlg.m_gridHeight ) );
m_editor.SetVirtualSize( CSize( dlg.m_width, dlg.m_height ) );
m_editor.SetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom );
pDoc->SetName(dlg.m_strName);
pDoc->SetAlpha(dlg.m_iAlpha);
pDoc->SetFlags(dlg.m_iFlags);
pDoc->SetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed);
m_editor.RedrawWindow();
}
#endif
}
示例9: GetGumpDocument
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
#if 1
CGumpEditorDoc* pDoc = GetGumpDocument();
if (pDoc) {
CView* pView = pDoc->FindView(RUNTIME_CLASS(CGumpEditorView));
if (pView && pView->OnCmdMsg(nID,nCode,pExtra,pHandlerInfo)) return TRUE;
}
#endif
return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
示例10: GfxGetGumpDocument
void CGumpStatic::Draw( CDC* dc, CRect rect )
{
dc->SelectObject( CStdGrfx::dialogBrush() );
dc->SelectObject( CStdGrfx::dialogPen() );
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
ASSERT(pDoc);
//dc->Rectangle( rect );
//LOGFONT lf;
//CFont font;
//GetFont( lf );
//// MS Sans Serif will not scale below 8 pts
//if( GetZoom() < 1 )
// lstrcpy( lf.lfFaceName, _T( "Arial" ) );
//
//font.CreateFontIndirect( &lf );
CFont* pFont = pDoc->GetFont(m_fontId);
CFont* pOld = dc->SelectObject(pFont);
CString strText = GetTitle();
UINT align[] = { TA_LEFT, DT_CENTER, TA_RIGHT };
UINT format = DT_TOP | align[m_textAlign];
if (IsMultiLine()) {
strText = GfxFormatText(strText);
}
else {
format |= DT_SINGLELINE;
}
int oldMode = dc->SetBkMode( TRANSPARENT );
COLORREF color = pDoc->GetHueColor(m_hueId, m_fontId);
COLORREF oldColor = dc->SetTextColor(color);
dc->DrawText( strText, rect, format);
dc->SetBkMode(oldMode);
dc->SetTextColor(oldColor);
dc->SelectStockObject( ANSI_VAR_FONT );
dc->SelectStockObject( BLACK_PEN );
dc->SelectStockObject( WHITE_BRUSH );
}
示例11: UpdateData
void CGumpBorderPropertyPage::ApplyValues()
{
if (GetSafeHwnd() && GetEntity())
{
UpdateData();
CGumpBorder* pBorder = (CGumpBorder*)GetEntity();
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
int iGumpID = GfxAtoX(m_strGumpID);
if (pBorder->GetGumpID() != iGumpID) {
CGumpPtr pGump = pDoc->GetGump(iGumpID);
if (!pGump) return;
pBorder->SetGump(pGump);
}
Redraw();
}
}
示例12: UpdateData
void CGumpButtonPropertyPage::ApplyValues()
{
if( GetSafeHwnd() && GetEntity() )
{
UpdateData();
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
CGumpButton* pButton = (CGumpButton*)GetEntity();
int iNormalID =GfxAtoX(m_strNormalID);
int iHoverID =GfxAtoX(m_strHoverID);
int iPressedID=GfxAtoX(m_strPressedID);
CGumpPtr pNormal, pHover, pPressed, pGump;
pButton->GetGump(pNormal, pHover, pPressed);
if (pNormal->GetGumpID() != iNormalID
&& (pGump = pDoc->LoadGump(iNormalID)))
{
pButton->SetGump(CGumpButton::NORMAL, pGump);
m_btnTest.SetGump(CHoverButton::NORMAL, pGump);
}
if (pHover->GetGumpID() != iHoverID
&& (pGump = pDoc->LoadGump(iHoverID)))
{
pButton->SetGump(CGumpButton::HOVER, pGump);
m_btnTest.SetGump(CHoverButton::HOVER, pGump);
}
if (pPressed->GetGumpID() != iPressedID
&& (pGump = pDoc->LoadGump(iPressedID)))
{
pButton->SetGump(CGumpButton::PRESSED, pGump);
m_btnTest.SetGump(CHoverButton::PRESSED, pGump);
}
Redraw();
}
}
示例13: GetRect
BOOL CGumpButton::FromString( XML::Node* node )
{
if (!CGumpEntity::FromString(node)) return FALSE;
int normal, over, pressed;;
XML::Node* gump_node = node->findNode("gump");
if (gump_node) {
gump_node->lookupAttribute("normal", normal);
gump_node->lookupAttribute("over", over);
gump_node->lookupAttribute("pressed", pressed);
}
CSize size = GetRect().Size();
SetConstraints(size,size);
CGumpEditorDoc* pDoc = GfxGetGumpDocument(); ASSERT(pDoc);
m_pGump[NORMAL] = pDoc->LoadGump(normal);
m_pGump[HOVER] = pDoc->LoadGump(over);
m_pGump[PRESSED] = pDoc->LoadGump(pressed);
return TRUE;
}