• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CanUndo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CanUndo函数的典型用法代码示例。如果您正苦于以下问题:C++ CanUndo函数的具体用法?C++ CanUndo怎么用?C++ CanUndo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CanUndo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: VERIFY

void CPropTreeItemFileEdit::OnContextMenu(CWnd *pWnd, CPoint point)
{

	CMenu FloatingMenu;
	VERIFY(FloatingMenu.LoadMenu(IDR_ME_EDIT_MENU));
	CMenu *pPopupMenu = FloatingMenu.GetSubMenu(0);

	if (CanUndo()) {
		pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_ENABLED);
	} else {
		pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	DWORD dwSel = GetSel();

	if (HIWORD(dwSel) != LOWORD(dwSel)) {
		pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_ENABLED);
		pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_ENABLED);
		pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_ENABLED);
	} else {
		pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
		pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:27,代码来源:PropTreeItemFileEdit.cpp


示例2: Undo

// Undo the last command
void PaintModel::Undo() {
	if (CanUndo()) {
		mRedoStack.push(mUndoStack.top());
		mUndoStack.top()->Undo(shared_from_this());
		mUndoStack.pop();
	}
}
开发者ID:connor-k,项目名称:ProPaint,代码行数:8,代码来源:PaintModel.cpp


示例3: BBAssertDebug

    void BatchCommand::Undo()
    {
        BBAssertDebug(CanUndo());

        for (RestorableCommandCollection::reverse_iterator it = restorableCommands.rbegin(); it != restorableCommands.rend(); ++it)
            (*it)->Undo();
    }
开发者ID:Darkttd,项目名称:Bibim,代码行数:7,代码来源:BatchCommand.cpp


示例4: Undo

void wxTextCtrl::Undo()
{
    if (CanUndo())
    {
        ::SendMessage(GetBuddyHwnd(), EM_UNDO, 0, 0);
    }
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:7,代码来源:textctrlce.cpp


示例5: switch

void CColorEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// TODO: Add your message handler code here and/or call default
	switch (nChar)
	{
	case 0x01:// Ctrl-A => handle SELECT_ALL
		SetSel(0, -1);
		return;
	case 0x03:// Ctrl-C => handle WM_COPY
		Copy();
		return;
	case 0x16:// Ctrl-V => handle WM_PASTE
		Paste();
		return;
	case 0x18:// Ctrl-X => handle WM_CUT
		Cut();
		return;
	case 0x1A:// Ctrl-Z => handle ID_EDIT_UNDO (EM_UNDO)
		if(CanUndo())
			Undo();
		return;
	}

	CEdit::OnChar(nChar, nRepCnt, nFlags);
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:25,代码来源:ColorEdit.cpp


示例6: wxCHECK_RET

void wxTextEntry::Undo()
{
    wxCHECK_RET( GetTextPeer(), "Must create the control first" );

    if (CanUndo())
        GetTextPeer()->Undo() ;
}
开发者ID:chromylei,项目名称:third_party,代码行数:7,代码来源:textentry_osx.cpp


示例7: CheckState

bool UTransBuffer::Undo()
{
	CheckState();

	if (!CanUndo())
	{
		UndoDelegate.Broadcast(FUndoSessionContext(), false);

		return false;
	}

	// Apply the undo changes.
	GIsTransacting = true;
	{
		FTransaction& Transaction = UndoBuffer[ UndoBuffer.Num() - ++UndoCount ];
		UE_LOG(LogEditorTransaction, Log,  TEXT("Undo %s"), *Transaction.GetTitle().ToString() );

		BeforeRedoUndoDelegate.Broadcast(Transaction.GetContext());
		Transaction.Apply();
		UndoDelegate.Broadcast(Transaction.GetContext(), true);
	}
	GIsTransacting = false;

	CheckState();

	return true;
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:27,代码来源:EditorTransaction.cpp


示例8: Undo

void CHistory::Undo()
{
	if (CanUndo())
	{
		m_commands[m_nextCommandIndex - 1]->Unexecute(); // может выбросить исключение
		--m_nextCommandIndex;
	}
}
开发者ID:Andrey540,项目名称:faststart_Egoshin_Andrey,代码行数:8,代码来源:History.cpp


示例9:

BString
UndoContext::UndoLabel() const
{
	if (CanUndo())
		return ((Action*)fHistory->ItemAt(fAt - 1))->Label();
	else
		return "";
}
开发者ID:Admixior,项目名称:ResourceEdit,代码行数:8,代码来源:UndoContext.cpp


示例10: Undo

void wxTextCtrl::Undo()
{
    if (CanUndo())
    {
        if (m_bIsMLE)
            ::WinSendMsg(GetHwnd(), MLM_UNDO, 0, 0);
        // Simple entryfields cannot be undone
    }
} // end of wxTextCtrl::Undo
开发者ID:EdgarTx,项目名称:wx,代码行数:9,代码来源:textctrl.cpp


示例11: InternalRollBack

bool History::InternalRollBack(void)
{
	if(!CanUndo())return false;
	Undoable *u;
	m_curpos--;
	u = *m_curpos;
	u->RollBack();
	return true;
}
开发者ID:Blokkendoos,项目名称:heekscad,代码行数:9,代码来源:History.cpp


示例12: Undo

void wxComboBox::Undo()
{
    if (CanUndo())
    {
        HWND hEditWnd = (HWND) GetEditHWND() ;
        if ( hEditWnd )
            ::SendMessage(hEditWnd, EM_UNDO, 0, 0);
    }
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:9,代码来源:combobox.cpp


示例13: Redo

void wxComboBox::Redo()
{
    if (CanUndo())
    {
        // Same as Undo, since Undo undoes the undo, i.e. a redo.
        HWND hEditWnd = (HWND) GetEditHWND() ;
        if ( hEditWnd )
            ::SendMessage(hEditWnd, EM_UNDO, 0, 0);
    }
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:10,代码来源:combobox.cpp


示例14: Assert

void SnapshotManager::Undo()
{
  Assert(CanUndo());

  if (m_snapshots.size() > 1)
  {
    m_snapshots.pop_back();
  }

  SetStateToSnapshot(*(m_snapshots.rbegin()));
}
开发者ID:jason-amju,项目名称:amju-scp,代码行数:11,代码来源:PoolSnapshot.cpp


示例15:

bool	cActionManager::Undo()
{ 
	if (CanUndo())
	{
		cAction* action = mUndoList.front();
		RemoveTopAction(UNDO);
		action->Accept(cUndoActionVisitor::Global());
		AddAction(REDO, action);
		return true;
	}
	return false;
}
开发者ID:eriser,项目名称:wired,代码行数:12,代码来源:cActionManager.cpp


示例16: CUICommandNode

void CUICommandHistory::UICommandAction(CommandType type)
{
	CUICommandNode* pOldNode;
	CUICommandNode* pNewNode;

	if(type == cmdRedo)
	{
		if(!CanRedo())
			return;

		pOldNode = m_lstCommandNodes.GetAt(m_lstCommandNodes.FindIndex(m_nCommandIndex));
		pNewNode = new CUICommandNode(pOldNode->m_pBefore, pOldNode->m_pAfter, pOldNode->m_ActionType);
		m_nCommandIndex++;
	}
	else
	{
		if(!CanUndo())
			return;

		m_nCommandIndex--;
		pOldNode = m_lstCommandNodes.GetAt(m_lstCommandNodes.FindIndex(m_nCommandIndex));
		ActionType action;
		switch(pOldNode->m_ActionType)
		{
		case actionAdd:
			action = actionDelete;
			break;
		case actionModify:
			action = actionModify;
			break;
		case actionDelete:
			action = actionAdd;
			break;
		}
		pNewNode = new CUICommandNode(pOldNode->m_pAfter, pOldNode->m_pBefore, action);
	}

	switch(pNewNode->m_ActionType)
	{
	case actionAdd:
		ActionAdd(pNewNode->m_pAfter);
		break;
	case actionModify:
		ActionModify(pNewNode->m_pAfter);
		break;
	case actionDelete:
		ActionDelete(pNewNode->m_pBefore);
		break;
	}

	delete pNewNode;
}
开发者ID:DayDayUpCQ,项目名称:misc,代码行数:52,代码来源:UICommandHistory.cpp


示例17: CheckBoundsUndoIfFails

//-----------------------------------------------------------------------------
// The display code is the only part of the program that knows how wide a
// rung will be when it's displayed; so this is the only convenient place to
// warn the user and undo their changes if they created something too wide.
// This is not very clean.
//-----------------------------------------------------------------------------
static BOOL CheckBoundsUndoIfFails(int gx, int gy)
{
    if(gx >= DISPLAY_MATRIX_X_SIZE || gx < 0 ||
       gy >= DISPLAY_MATRIX_Y_SIZE || gy < 0)
    {
        if(CanUndo()) {
            UndoUndo();
            Error(_("Too many elements in subcircuit!"));
            return TRUE;
        }
    }
    return FALSE;
}
开发者ID:chihyang,项目名称:ldmicro,代码行数:19,代码来源:draw.cpp


示例18: GetUndoContext

FUndoSessionContext UTransBuffer::GetUndoContext( bool bCheckWhetherUndoPossible )
{
	FUndoSessionContext Context;
	FText Title;
	if( bCheckWhetherUndoPossible && !CanUndo( &Title ) )
	{
		Context.Title = Title;
		return Context;
	}

	const FTransaction* Transaction = &UndoBuffer[ UndoBuffer.Num() - (UndoCount + 1) ];
	return Transaction->GetContext();
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:13,代码来源:EditorTransaction.cpp


示例19: Undo

void CEditWnd::Undo()
{
	if (!CanUndo()) return;
	CPoint ptCursorPos;
	if (m_pTextBuffer->Undo(ptCursorPos))
	{
		ASSERT_VALIDTEXTPOS(ptCursorPos);
		SetAnchor(ptCursorPos);
		SetSelection(ptCursorPos, ptCursorPos);
		SetCursorPos(ptCursorPos);
		EnsureVisible(ptCursorPos);
	}
}
开发者ID:kosfango,项目名称:fips,代码行数:13,代码来源:EditWnd.cpp


示例20: Undo

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *exp - 
//-----------------------------------------------------------------------------
void CExpression::Undo( void )
{
	if ( !CanUndo() )
		return;

	Assert( m_nUndoCurrent < undo.Size() );

	CExpUndoInfo *u = undo[ m_nUndoCurrent++ ];
	Assert( u );
	
	memcpy( setting, u->setting, GLOBAL_STUDIO_FLEX_CONTROL_COUNT * sizeof( float ) );
	memcpy( weight, u->weight, GLOBAL_STUDIO_FLEX_CONTROL_COUNT * sizeof( float ) );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:17,代码来源:expression.cpp



注:本文中的CanUndo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Cancel函数代码示例发布时间:2022-05-30
下一篇:
C++ CanSeek函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap