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


C++ CanPaste函數代碼示例

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


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

示例1: PasteText

void CPWL_Edit::PasteText() {
  if (!CanPaste())
    return;

  CFX_WideString swClipboard;
  if (IFX_SystemHandler* pSH = GetSystemHandler())
    swClipboard = pSH->GetClipboardText(GetAttachedHWnd());

  if (m_pFillerNotify) {
    FX_BOOL bRC = TRUE;
    FX_BOOL bExit = FALSE;
    CFX_WideString strChangeEx;
    int nSelStart = 0;
    int nSelEnd = 0;
    GetSel(nSelStart, nSelEnd);
    m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swClipboard,
                                       strChangeEx, nSelStart, nSelEnd, TRUE,
                                       bRC, bExit, 0);
    if (!bRC)
      return;
    if (bExit)
      return;
  }

  if (swClipboard.GetLength() > 0) {
    Clear();
    InsertText(swClipboard.c_str());
  }
}
開發者ID:primiano,項目名稱:pdfium-merge,代碼行數:29,代碼來源:PWL_Edit.cpp

示例2: switch

void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
{
    if ( event.GetModifiers() == wxMOD_CONTROL )
    {
        switch( event.GetKeyCode() )
        {
            case 'A':
                SelectAll();
                return;
            case 'C':
                if ( CanCopy() )
                    Copy() ;
                return;
            case 'V':
                if ( CanPaste() )
                    Paste() ;
                return;
            case 'X':
                if ( CanCut() )
                    Cut() ;
                return;
            default:
                break;
        }
    }
    // no, we didn't process it
    event.Skip();
}
開發者ID:CustomCardsOnline,項目名稱:wxWidgets,代碼行數:28,代碼來源:textctrl_osx.cpp

示例3: Paste

void wxTextCtrl::Paste()
{
    if (CanPaste())
    {
        ::SendMessage(GetBuddyHwnd(), WM_PASTE, 0, 0L);
    }
}
開發者ID:ACanadianKernel,項目名稱:pcsx2,代碼行數:7,代碼來源:textctrlce.cpp

示例4: wxCHECK_RET

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

    if (CanPaste())
        GetTextPeer()->Paste() ;
}
開發者ID:chromylei,項目名稱:third_party,代碼行數:7,代碼來源:textentry_osx.cpp

示例5: Paste

void wxTextCtrl::Paste()
{
    if (CanPaste())
    {
        HWND                        hWnd = GetHwnd();

        ::WinSendMsg(hWnd, EM_PASTE, 0, 0);
    }
} // end of wxTextCtrl::Paste
開發者ID:EdgarTx,項目名稱:wx,代碼行數:9,代碼來源:textctrl.cpp

示例6: switch

 bool NativeTextfieldWin::IsCommandIdEnabled(int command_id) const
 {
     switch(command_id)
     {
     case IDS_APP_UNDO:       return !textfield_->read_only() && !!CanUndo();
     case IDS_APP_CUT:        return !textfield_->read_only() &&
                                  !textfield_->IsPassword() && !!CanCut();
     case IDS_APP_COPY:       return !!CanCopy() && !textfield_->IsPassword();
     case IDS_APP_PASTE:      return !textfield_->read_only() && !!CanPaste();
     case IDS_APP_SELECT_ALL: return !!CanSelectAll();
     default:                 NOTREACHED();
         return false;
     }
 }
開發者ID:abyvaltsev,項目名稱:putty-nd3.x,代碼行數:14,代碼來源:native_textfield_win.cpp

示例7: GetSel

void CRichEditCtrlX::OnContextMenu(CWnd* pWnd, CPoint point)
{
	long iSelStart, iSelEnd;
	GetSel(iSelStart, iSelEnd);
	int iTextLen = GetWindowTextLength();

	// Context menu of standard edit control
	// 
	// Undo
	// ----
	// Cut
	// Copy
	// Paste
	// Delete
	// ------
	// Select All

	bool bReadOnly = (GetStyle() & ES_READONLY);

	CMenu menu;
	menu.CreatePopupMenu();
	if (!bReadOnly){
		menu.AppendMenu(MF_STRING, MP_UNDO, GetResString(IDS_UNDO));
		menu.AppendMenu(MF_SEPARATOR);
	}
	if (!bReadOnly)
		menu.AppendMenu(MF_STRING, MP_CUT, GetResString(IDS_CUT));
	menu.AppendMenu(MF_STRING, MP_COPYSELECTED, GetResString(IDS_COPY));
	if (!bReadOnly){
		menu.AppendMenu(MF_STRING, MP_PASTE, GetResString(IDS_PASTE));
		menu.AppendMenu(MF_STRING, MP_REMOVESELECTED, GetResString(IDS_DELETESELECTED));
	}
	menu.AppendMenu(MF_SEPARATOR);
	menu.AppendMenu(MF_STRING, MP_SELECTALL, GetResString(IDS_SELECTALL));

	menu.EnableMenuItem(MP_UNDO, CanUndo() ? MF_ENABLED : MF_GRAYED);
	menu.EnableMenuItem(MP_CUT, iSelEnd > iSelStart ? MF_ENABLED : MF_GRAYED);
	menu.EnableMenuItem(MP_COPYSELECTED, iSelEnd > iSelStart ? MF_ENABLED : MF_GRAYED);
	menu.EnableMenuItem(MP_PASTE, CanPaste() ? MF_ENABLED : MF_GRAYED);
	menu.EnableMenuItem(MP_REMOVESELECTED, iSelEnd > iSelStart ? MF_ENABLED : MF_GRAYED);
	menu.EnableMenuItem(MP_SELECTALL, iTextLen > 0 ? MF_ENABLED : MF_GRAYED);

	if (point.x == -1 && point.y == -1)
	{
		point.x = 16;
		point.y = 32;
		ClientToScreen(&point);
	}
	menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
開發者ID:BackupTheBerlios,項目名稱:nextemf,代碼行數:50,代碼來源:RichEditCtrlX.cpp

示例8: Paste

void wxTextCtrl::Paste()
{
    if (CanPaste())
    {
        wxClipboardTextEvent evt(wxEVT_TEXT_PASTE, GetId());
        evt.SetEventObject(this);
        if (!GetEventHandler()->ProcessEvent(evt))
        {
            wxTextEntry::Paste();

            // TODO: eventually we should add setting the default style again
            SendTextUpdatedEvent();
        }
    }
}
開發者ID:CustomCardsOnline,項目名稱:wxWidgets,代碼行數:15,代碼來源:textctrl_osx.cpp

示例9: ASSERT

///	report clipboard content availability. This function checks whole clipboard 
///	content. It may return false if some objects cannot be pasted. i.e. events
///	cannot be pasted as children of state machine object
///	\param	pParentName - name of object to paste
///	\return	true if whole clipboard content cannot be pasted for passed parent
bool CStateMachineClipboard::CanPastePartially( IHashString *pParentName ) const
{
	ASSERT( pParentName != NULL );
	if( !CanPaste() )
	{
		return false;
	}
	static const DWORD hash_CQHState = CHashString( _T("CQHState") ).GetUniqueID();
	if( hash_CQHState != GetComponentType( pParentName ).GetUniqueID() )
	{
		IXMLArchive *pArchive = GetClipboardDataArchive();
		ASSERT( pArchive != NULL );

		CStateMachineClipboardPreprocessor preprocessor;
		VERIFY( preprocessor.Prepare( pParentName, pArchive ) );
		pArchive->Close();
		return preprocessor.HasTopLevelEvents();
	}
	return false;
}
開發者ID:klhurley,項目名稱:ElementalEngine2,代碼行數:25,代碼來源:StateMachineClipboard.cpp

示例10: ZeroMemory

void CLeftView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	char cStr[64];
	ZeroMemory( cStr, sizeof(cStr) );
	CMenu menu;
	CFoulerDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	menu.CreatePopupMenu();
	CListCtrl& refCtrl = GetListCtrl();
	int iCount = refCtrl.GetSelectedCount();
	if( iCount > 0 )
	{
		wsprintf( cStr, "%d items have been selected", iCount );
		menu.AppendMenu( MF_STRING, NULL, cStr );
		menu.AppendMenu( MF_STRING, ID_EDIT_COPY, "Copy" );
	}
	if( CanPaste() ) menu.AppendMenu( MF_STRING, ID_EDIT_PASTE, "Paste" );
	SetForegroundWindow();
	menu.TrackPopupMenu( TPM_LEFTALIGN, point.x, point.y, this, NULL );
}
開發者ID:WisemanLim,項目名稱:femos,代碼行數:20,代碼來源:LeftView.cpp

示例11: Paste

///	\brief	paste objects from clipboard
///	\param	pParentName - name of the state machine or single state to paste
///	\param	object - list with created objects
///	\return	true if objects were pasted from the clipboard
bool CStateMachineClipboard::Paste( IHashString *pParentName, vector<ObjectInfo> &objects ) const
{
	if( !CanPaste() )
	{
		return false;
	}

	IXMLArchive *pArchive = GetClipboardDataArchive();
	if( pArchive == NULL )
	{
		return false;
	}

	if( !IsValidArchive( pArchive ))
	{
		pArchive->Close();
		return false;
	}

	CStateMachineClipboardPreprocessor preprocessor;
	if( !preprocessor.Prepare( pParentName, pArchive ) )
	{
		pArchive->Close();
		return false;
	}

	IXMLArchive *pTransformedArchive = TransformXMLArchive( pArchive, preprocessor );
	if( pTransformedArchive == NULL )
	{
		pArchive->Close();
		return false;
	}

#ifdef _DEBUG
	DumpStream( pTransformedArchive, _T("c:\\stateMachine.transformed.xml") );
#endif

	bool res = CreateObjects( pParentName, pTransformedArchive, objects );
	pTransformedArchive->Close();
	return res;
}
開發者ID:klhurley,項目名稱:ElementalEngine2,代碼行數:45,代碼來源:StateMachineClipboard.cpp

示例12: SetFocus

void CMuleTextCtrl::OnRightDown( wxMouseEvent& evt )
{
	// If this control doesn't have focus, then set it
	if ( FindFocus() != this )
		SetFocus();

	wxMenu popup_menu;
	
	popup_menu.Append( CMTCE_Cut, _("Cut") );
	popup_menu.Append( CMTCE_Copy, _("Copy") );
	popup_menu.Append( CMTCE_Paste, _("Paste") );
	popup_menu.Append( CMTCE_Clear, _("Clear") );
	
	popup_menu.AppendSeparator();
	
	popup_menu.Append( CMTCE_SelAll, _("Select All") );


	// wxMenu will automatically enable/disable the Cut and Copy items,
	// however, were are a little more pricky about the Paste item than they
	// are, so we enable/disable it on our own, depending on whenever or not
	// there's actually something to paste
	bool canpaste = false;
	if ( CanPaste() ) {
		if ( wxTheClipboard->Open() ) {
			if ( wxTheClipboard->IsSupported( wxDF_TEXT ) ) {
				wxTextDataObject data;
	 			wxTheClipboard->GetData( data );

				canpaste = (data.GetTextLength() > 0);
			}
			wxTheClipboard->Close();
		}
	}


	popup_menu.Enable( CMTCE_Paste,		canpaste );
	popup_menu.Enable( CMTCE_Clear,		IsEditable() && !GetValue().IsEmpty() );

	PopupMenu( &popup_menu, evt.GetX(), evt.GetY() );
}
開發者ID:dreamerc,項目名稱:amule,代碼行數:41,代碼來源:MuleTextCtrl.cpp

示例13: SetFocus

void CMyRichEdit::OnRButtonDown(UINT nFlags, CPoint point) 
{
	//設置為焦點
	SetFocus();
	//創建一個彈出式菜單
	CMenu popmenu;
	popmenu.CreatePopupMenu();
	//添加菜單項目
	popmenu.AppendMenu(0, ID_RICH_UNDO, _T("撤消(&U)"));
	popmenu.AppendMenu(0, MF_SEPARATOR);
	popmenu.AppendMenu(0, ID_RICH_CUT, _T("剪切(&T)"));
	popmenu.AppendMenu(0, ID_RICH_COPY, _T("複製(&T)"));
	popmenu.AppendMenu(0, ID_RICH_PASTE, _T("粘貼(&P)"));
	popmenu.AppendMenu(0, ID_RICH_CLEAR, _T("刪除(&D)"));
	popmenu.AppendMenu(0, MF_SEPARATOR);
	popmenu.AppendMenu(0, ID_RICH_SELECTALL, _T("全選(&A)"));
	popmenu.AppendMenu(0, MF_SEPARATOR);
	popmenu.AppendMenu(0, ID_RICH_SETFONT, _T("設置字體(&F)"));

	//初始化菜單項
	UINT nUndo=(CanUndo() ? 0 : MF_GRAYED );
	popmenu.EnableMenuItem(ID_RICH_UNDO, MF_BYCOMMAND|nUndo);

	UINT nSel=((GetSelectionType()!=SEL_EMPTY) ? 0 : MF_GRAYED) ;
	popmenu.EnableMenuItem(ID_RICH_CUT, MF_BYCOMMAND|nSel);
	popmenu.EnableMenuItem(ID_RICH_COPY, MF_BYCOMMAND|nSel);
	popmenu.EnableMenuItem(ID_RICH_CLEAR, MF_BYCOMMAND|nSel);
	
	UINT nPaste=(CanPaste() ? 0 : MF_GRAYED) ;
	popmenu.EnableMenuItem(ID_RICH_PASTE, MF_BYCOMMAND|nPaste);

	//顯示菜單
	CPoint pt;
	GetCursorPos(&pt);
	popmenu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this);
	popmenu.DestroyMenu();
	CRichEditCtrl::OnRButtonDown(nFlags, point);
}
開發者ID:janker007,項目名稱:cocoshun,代碼行數:38,代碼來源:MyRichEdit.cpp

示例14: SetFocus

void CTWScriptEdit::OnRButtonDown(UINT nFlags, CPoint point) 
{
	//設置為焦點
	SetFocus();
	//創建一個彈出式菜單
	CMenu popmenu;
	popmenu.CreatePopupMenu();
	//添加菜單項目
	popmenu.AppendMenu(0, ID_RICH_UNDO, "&Undo");
	popmenu.AppendMenu(0, MF_SEPARATOR);
	popmenu.AppendMenu(0, ID_RICH_CUT, "&Cut");
	popmenu.AppendMenu(0, ID_RICH_COPY, "C&opy");
	popmenu.AppendMenu(0, ID_RICH_PASTE, "&Paste");
	popmenu.AppendMenu(0, ID_RICH_CLEAR, "C&lear");
	popmenu.AppendMenu(0, MF_SEPARATOR);
	popmenu.AppendMenu(0, ID_RICH_SELECTALL, "Select &All");
	popmenu.AppendMenu(0, MF_SEPARATOR);
	popmenu.AppendMenu(0, ID_RICH_SETFONT, "Select &Font");

	//初始化菜單項
	UINT nUndo=(CanUndo() ? 0 : MF_GRAYED );
	popmenu.EnableMenuItem(ID_RICH_UNDO, MF_BYCOMMAND|nUndo);

	UINT nSel=((GetSelectionType()!=SEL_EMPTY) ? 0 : MF_GRAYED) ;
	popmenu.EnableMenuItem(ID_RICH_CUT, MF_BYCOMMAND|nSel);
	popmenu.EnableMenuItem(ID_RICH_COPY, MF_BYCOMMAND|nSel);
	popmenu.EnableMenuItem(ID_RICH_CLEAR, MF_BYCOMMAND|nSel);

	UINT nPaste=(CanPaste() ? 0 : MF_GRAYED) ;
	popmenu.EnableMenuItem(ID_RICH_PASTE, MF_BYCOMMAND|nPaste);

	//顯示菜單
	CPoint pt;
	GetCursorPos(&pt);
	popmenu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this);
	popmenu.DestroyMenu();
	CRichEditCtrl::OnRButtonDown(nFlags, point);
}
開發者ID:gitrider,項目名稱:wxsj2,代碼行數:38,代碼來源:TWScriptEdit.cpp

示例15: _ENABLE

void FB_Frame::OnMenuOpen ( wxMenuEvent& event )
{
    if ( event.GetMenu() == m_EditMenu )
    {
        FB_STC * stc = 0;
        if( m_Code_areaTab != 0 )
            stc = reinterpret_cast<FB_STC *>( m_Code_areaTab->GetCurrentPage() );

        #define _ENABLE( id, func ) m_EditMenu->Enable( id, ( stc != 0 ) ? stc -> func : false )
            _ENABLE( wxID_UNDO,                 CanUndo() );
            _ENABLE( wxID_REDO,                 CanRedo() );
            _ENABLE( wxID_COPY,                 HasSelection() );
            _ENABLE( wxID_CUT,                  HasSelection() );
            _ENABLE( wxID_PASTE,                CanPaste() );
            _ENABLE( wxID_SELECTALL,            GetLength() );
            _ENABLE( fbideID_SelectLine,        GetLength() );
            _ENABLE( fbideID_CommentBlock,      CanComment() );
            _ENABLE( fbideID_UncommentBlock,    CanComment() );
        #undef _ENABLE
        m_EditMenu->Enable(wxID_JUSTIFY_RIGHT,    ( stc ) ? true : false );
        m_EditMenu->Enable(wxID_JUSTIFY_LEFT,     ( stc ) ? true : false );
    }
}
開發者ID:bihai,項目名稱:fbide,代碼行數:23,代碼來源:fb_frame.cpp


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