当前位置: 首页>>代码示例>>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;未经允许,请勿转载。