本文整理汇总了C++中wxGlobalDisplay函数的典型用法代码示例。如果您正苦于以下问题:C++ wxGlobalDisplay函数的具体用法?C++ wxGlobalDisplay怎么用?C++ wxGlobalDisplay使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxGlobalDisplay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XMapWindow
void wxTopLevelWindowX11::Restore()
{
// This is the way to deiconify the window, according to the X FAQ
if (m_iconized && X11GetMainWindow())
{
XMapWindow(wxGlobalDisplay(), (Window) X11GetMainWindow());
m_iconized = false;
}
}
示例2: wxGetMousePosition
void wxGetMousePosition( int* x, int* y )
{
#if wxUSE_NANOX
// TODO
*x = 0;
*y = 0;
#else
XMotionEvent xev;
Window root, child;
XQueryPointer(wxGlobalDisplay(),
DefaultRootWindow(wxGlobalDisplay()),
&root, &child,
&(xev.x_root), &(xev.y_root),
&(xev.x), &(xev.y),
&(xev.state));
*x = xev.x_root;
*y = xev.y_root;
#endif
};
示例3: wxGlobalDisplay
void wxWindowX11::DoClientToScreen(int *x, int *y) const
{
Display *display = wxGlobalDisplay();
Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display));
Window thisWindow = (Window) m_clientWindow;
Window childWindow;
int xx = *x;
int yy = *y;
XTranslateCoordinates(display, thisWindow, rootWindow, xx, yy, x, y, &childWindow);
}
示例4: XStoreName
void wxTopLevelWindowX11::SetTitle(const wxString& title)
{
m_title = title;
if (X11GetMainWindow())
{
#if wxUSE_UNICODE
// I wonder of e.g. Metacity takes UTF-8 here
XStoreName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title.ToAscii() );
XSetIconName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title.ToAscii() );
#else
XStoreName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title);
XSetIconName(wxGlobalDisplay(), (Window) X11GetMainWindow(),
(const char*) title);
#endif
}
}
示例5: wxGlobalDisplay
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
{
// get X protocol version
Display *display = wxGlobalDisplay();
if (display)
{
if ( verMaj )
*verMaj = ProtocolVersion (display);
if ( verMin )
*verMin = ProtocolRevision (display);
}
return wxPORT_X11;
}
示例6: FreeColour
void wxColourRefData::AllocColour( WXColormap cmap )
{
if (m_hasPixel && (m_colormap == cmap))
return;
FreeColour();
#if !wxUSE_NANOX
if ((wxTheApp->m_visualInfo->m_visualType == GrayScale) ||
(wxTheApp->m_visualInfo->m_visualType == PseudoColor))
{
m_hasPixel = XAllocColor( wxGlobalDisplay(), (Colormap) cmap, &m_color );
int idx = m_color.pixel;
colMapAllocCounter[ idx ] = colMapAllocCounter[ idx ] + 1;
}
else
#endif
{
m_hasPixel = XAllocColor( wxGlobalDisplay(), (Colormap) cmap, &m_color );
}
m_colormap = cmap;
}
示例7: wxGlobalDisplay
// Wait for an appropriate window to be created.
// If exactMatch is FALSE, a substring match is OK.
// If windowName is empty, then wait for the next overrideRedirect window.
bool wxReparenter::WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toReparent,
const wxString& windowName,
bool exactMatch)
{
sm_newParent = newParent;
sm_toReparent = toReparent;
sm_exactMatch = exactMatch;
sm_name = windowName;
Display* display = wxGlobalDisplay();
XSelectInput(display,
RootWindowOfScreen(DefaultScreenOfDisplay(display)),
SubstructureNotifyMask);
if (!WM_STATE)
WM_STATE = XInternAtom(display, "WM_STATE", False);
#ifdef __WXDEBUG__
if (!windowName.IsEmpty())
wxLogDebug(_T("Waiting for window %s"), windowName.c_str());
#endif
sm_done = FALSE;
wxEventLoop eventLoop;
while (!sm_done)
{
if (eventLoop.Pending())
{
XEvent xevent;
XNextEvent(display, & xevent);
if (!wxTheApp->ProcessXEvent((WXEvent*) & xevent))
{
// Do the local event processing
ProcessXEvent((WXEvent*) & xevent);
}
}
else
{
#if wxUSE_TIMER
wxTimer::NotifyTimers();
wxTheApp->ProcessIdle();
#endif
}
}
return TRUE;
}
示例8: wxASSERT_MSG
void wxWindowX11::DoCaptureMouse()
{
if ((g_captureWindow != NULL) && (g_captureWindow != this))
{
wxASSERT_MSG(FALSE, wxT("Trying to capture before mouse released."));
// Core dump now
int *tmp = NULL;
(*tmp) = 1;
return;
}
if (m_winCaptured)
return;
Window xwindow = (Window) m_clientWindow;
wxCHECK_RET( xwindow, wxT("invalid window") );
g_captureWindow = (wxWindow*) this;
if (xwindow)
{
int res = XGrabPointer(wxGlobalDisplay(), xwindow,
FALSE,
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
GrabModeAsync,
GrabModeAsync,
None,
None, /* cursor */ // TODO: This may need to be set to the cursor of this window
CurrentTime );
if (res != GrabSuccess)
{
wxString msg;
msg.Printf(wxT("Failed to grab pointer for window %s"), this->GetClassInfo()->GetClassName());
wxLogDebug(msg);
if (res == GrabNotViewable)
wxLogDebug( wxT("This is not a viewable window - perhaps not shown yet?") );
g_captureWindow = NULL;
return;
}
m_winCaptured = TRUE;
}
}
示例9: wxCHECK_MSG
bool wxClipboard::AddData( wxDataObject *data )
{
wxCHECK_MSG( data, false, "data is invalid" );
wxCHECK_MSG( m_open, false, "clipboard not open" );
m_data.Append( data );
Display* xdisplay = wxGlobalDisplay();
Widget xwidget = (Widget)wxTheApp->GetTopLevelRealizedWidget();
Window xwindow = XtWindow( xwidget );
wxXmString label( wxTheApp->GetAppDisplayName() );
Time timestamp = XtLastTimestampProcessed( xdisplay );
long itemId;
int retval;
while( ( retval = XmClipboardStartCopy( xdisplay, xwindow, label(),
timestamp, xwidget,
wxClipboardCallback,
&itemId ) )
== XmClipboardLocked );
if( retval != XmClipboardSuccess )
return false;
size_t count = data->GetFormatCount( wxDataObject::Get );
wxDataFormatScopedArray dfarr(count);
data->GetAllFormats( dfarr.get(), wxDataObject::Get );
for( size_t i = 0; i < count; ++i )
{
size_t size = data->GetDataSize( dfarr[i] );
long data_id;
wxString id = dfarr[i].GetId();
while( ( retval = XmClipboardCopy( xdisplay, xwindow, itemId,
id.char_str(),
NULL, size, i, &data_id ) )
== XmClipboardLocked );
m_idToObject.Append( new wxDataIdToDataObject( data, data_id, size ) );
}
while( XmClipboardEndCopy( xdisplay, xwindow, itemId )
== XmClipboardLocked );
return true;
}
示例10: XGetWindowAttributes
// Get size *available for subwindows* i.e. excluding menu bar etc.
void wxWindowX11::DoGetClientSize(int *x, int *y) const
{
Window window = (Window) m_mainWindow;
if (window)
{
XWindowAttributes attr;
Status status = XGetWindowAttributes( wxGlobalDisplay(), window, &attr );
wxASSERT(status);
if (status)
{
*x = attr.width ;
*y = attr.height ;
}
}
}
示例11: wxGlobalDisplay
bool wxColour::FromString(const wxString& name)
{
Display *dpy = wxGlobalDisplay();
WXColormap colormap = wxTheApp->GetMainColormap( dpy );
XColor xcol;
if ( XParseColor( dpy, (Colormap)colormap, name.mbc_str(), &xcol ) )
{
UnRef();
m_refData = new wxColourRefData;
M_COLDATA->m_colormap = colormap;
M_COLDATA->m_color = xcol;
return true;
}
return wxColourBase::FromString(name);
}
示例12: wxCHECK_RET
// Get total size
void wxWindowX11::DoGetSize(int *x, int *y) const
{
Window xwindow = (Window) m_mainWindow;
wxCHECK_RET( xwindow, wxT("invalid window") );
//XSync(wxGlobalDisplay(), False);
XWindowAttributes attr;
Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr );
wxASSERT(status);
if (status)
{
*x = attr.width /* + 2*m_borderSize */ ;
*y = attr.height /* + 2*m_borderSize */ ;
}
}
示例13: XUngrabPointer
void wxWindowX11::DoReleaseMouse()
{
g_captureWindow = NULL;
if ( !m_winCaptured )
return;
Window xwindow = (Window) m_clientWindow;
if (xwindow)
{
XUngrabPointer( wxGlobalDisplay(), CurrentTime );
}
// wxLogDebug( "Ungrabbed pointer in %s", GetName().c_str() );
m_winCaptured = FALSE;
}
示例14: wxGlobalDisplay
PangoContext* wxApp::GetPangoContext()
{
static PangoContext *s_pangoContext = NULL;
if ( !s_pangoContext )
{
Display *dpy = wxGlobalDisplay();
int xscreen = DefaultScreen(dpy);
s_pangoContext = pango_xft_get_context(dpy, xscreen);
if (!PANGO_IS_CONTEXT(s_pangoContext))
{
wxLogError( wxT("No pango context.") );
}
}
return s_pangoContext;
}
示例15: wxGlobalDisplay
/* static */
wxColour wxColour::CreateByName(const wxString& name)
{
wxColour col;
Display *dpy = wxGlobalDisplay();
WXColormap colormap = wxTheApp->GetMainColormap( dpy );
XColor xcol;
if ( XParseColor( dpy, (Colormap)colormap, name.mb_str(), &xcol ) )
{
col.m_red = xcol.red & 0xff;
col.m_green = xcol.green & 0xff;
col.m_blue = xcol.blue & 0xff;
col.m_isInit = true;
col.m_pixel = -1;
}
return col;
}