本文整理汇总了C++中wxDataFormat::GetId方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDataFormat::GetId方法的具体用法?C++ wxDataFormat::GetId怎么用?C++ wxDataFormat::GetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDataFormat
的用法示例。
在下文中一共展示了wxDataFormat::GetId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxGetClipboardFormatName
bool wxGetClipboardFormatName(const wxDataFormat& dataFormat, char *formatName,
int maxCount)
{
wxStrlcpy( formatName, dataFormat.GetId().c_str(), maxCount );
return true;
}
示例2: IsSupported
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
{
wxLogTrace(TRACE_CLIPBOARD, wxT("Checking if format %s is available"),
dataFormat.GetId().c_str());
if ( m_data )
return m_data->IsSupported( dataFormat );
return wxDataObject::IsFormatInPasteboard( m_pasteboard, dataFormat );
}
示例3: GTKOnSelectionReceived
void wxClipboard::GTKOnSelectionReceived(const GtkSelectionData& sel)
{
wxCHECK_RET( m_receivedData, wxT("should be inside GetData()") );
const wxDataFormat format(gtk_selection_data_get_target(const_cast<GtkSelectionData*>(&sel)));
wxLogTrace(TRACE_CLIPBOARD, wxT("Received selection %s"),
format.GetId().c_str());
if ( !m_receivedData->IsSupportedFormat(format, wxDataObject::Set) )
return;
m_receivedData->SetData(format,
gtk_selection_data_get_length(const_cast<GtkSelectionData*>(&sel)),
gtk_selection_data_get_data(const_cast<GtkSelectionData*>(&sel)));
m_formatSupported = true;
}
示例4: IsSupported
bool wxClipboard::IsSupported( const wxDataFormat& format )
{
/* reentrance problems */
if (m_waiting) return FALSE;
/* store requested format to be asked for by callbacks */
m_targetRequested = format;
wxLogTrace( TRACE_CLIPBOARD,
wxT("wxClipboard:IsSupported: requested format: %s"),
format.GetId().c_str() );
wxCHECK_MSG( m_targetRequested, FALSE, wxT("invalid clipboard format") );
m_formatSupported = FALSE;
/* perform query. this will set m_formatSupported to
TRUE if m_targetRequested is supported.
also, we have to wait for the "answer" from the
clipboard owner which is an asynchronous process.
therefore we set m_waiting = TRUE here and wait
until the callback "targets_selection_received"
sets it to FALSE */
m_waiting = TRUE;
gtk_selection_convert( m_targetsWidget,
m_usePrimary ? (GdkAtom)GDK_SELECTION_PRIMARY
: g_clipboardAtom,
g_targetsAtom,
(guint32) GDK_CURRENT_TIME );
while (m_waiting) gtk_main_iteration();
#if defined(__WXGTK20__) && wxUSE_UNICODE
if (!m_formatSupported && format == wxDataFormat(wxDF_UNICODETEXT))
{
// Another try with plain STRING format
extern GdkAtom g_altTextAtom;
return IsSupported(g_altTextAtom);
}
#endif
return m_formatSupported;
}
示例5: IsSupported
bool wxClipboard::IsSupported(const wxDataFormat& format)
{
Display* xdisplay = wxGlobalDisplay();
Window xwindow = XtWindow( (Widget)wxTheApp->GetTopLevelRealizedWidget() );
bool isSupported = false;
int retval, count;
unsigned long max_name_length;
wxString id = format.GetId();
while( ( retval = XmClipboardLock( xdisplay, xwindow ) )
== XmClipboardLocked );
if( retval != XmClipboardSuccess )
return false;
if( XmClipboardInquireCount( xdisplay, xwindow, &count, &max_name_length )
== XmClipboardSuccess )
{
wxCharBuffer buf( max_name_length + 1 );
unsigned long copied;
for( int i = 0; i < count; ++i )
{
if( XmClipboardInquireFormat( xdisplay, xwindow, i + 1,
(XtPointer)buf.data(),
max_name_length, &copied )
!= XmClipboardSuccess )
continue;
buf.data()[copied] = '\0';
if( buf == id )
{
isSupported = true;
break;
}
}
}
XmClipboardUnlock( xdisplay, xwindow, False );
return isSupported;
}
示例6: IsSupported
bool wxClipboard::IsSupported( const wxDataFormat& format )
{
/* reentrance problems */
if (m_waiting) return false;
/* store requested format to be asked for by callbacks */
m_targetRequested = format;
#if 0
wxLogTrace( TRACE_CLIPBOARD,
wxT("wxClipboard:IsSupported: requested format: %s"),
format.GetId().c_str() );
#endif
wxCHECK_MSG( m_targetRequested, false, wxT("invalid clipboard format") );
m_formatSupported = false;
/* perform query. this will set m_formatSupported to
true if m_targetRequested is supported.
also, we have to wait for the "answer" from the
clipboard owner which is an asynchronous process.
therefore we set m_waiting = true here and wait
until the callback "targets_selection_received"
sets it to false */
m_waiting = true;
#if 0
gtk_selection_convert( m_targetsWidget,
m_usePrimary ? (GdkAtom)GDK_SELECTION_PRIMARY
: g_clipboardAtom,
g_targetsAtom,
(guint32) GDK_CURRENT_TIME );
while (m_waiting) gtk_main_iteration();
#endif
if (!m_formatSupported) return false;
return true;
}
示例7: DoIsSupported
bool wxClipboard::DoIsSupported(const wxDataFormat& format)
{
wxCHECK_MSG( format, false, wxT("invalid clipboard format") );
wxLogTrace(TRACE_CLIPBOARD, wxT("Checking if format %s is available"),
format.GetId().c_str());
// these variables will be used by our GTKOnTargetReceived()
m_targetRequested = format;
m_formatSupported = false;
// block until m_formatSupported is set from targets_selection_received
// callback
{
wxClipboardSync sync(*this);
gtk_selection_convert( m_targetsWidget,
GTKGetClipboardAtom(),
g_targetsAtom,
(guint32) GDK_CURRENT_TIME );
}
return m_formatSupported;
}