當前位置: 首頁>>代碼示例>>C++>>正文


C++ CanUndo函數代碼示例

本文整理匯總了C++中CanUndo函數的典型用法代碼示例。如果您正苦於以下問題:C++ CanUndo函數的具體用法?C++ CanUndo怎麽用?C++ CanUndo使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CanUndo函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的CanUndo函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。