]> git.saurik.com Git - wxWidgets.git/blob - src/x11/dcscreen.cpp
Fix wxStaticBitmap best size calculation in wxMSW.
[wxWidgets.git] / src / x11 / dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/x11/dcscreen.cpp
3 // Purpose: wxScreenDC class
4 // Author: Julian Smart, Robert Roebling
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // for compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #include "wx/dcscreen.h"
16 #include "wx/x11/dcscreen.h"
17
18 #ifndef WX_PRECOMP
19 #include "wx/app.h"
20 #include "wx/utils.h"
21 #include "wx/window.h"
22 #include "wx/frame.h"
23 #endif
24
25 #include "wx/fontutil.h"
26
27 #include "wx/x11/private.h"
28
29 //-----------------------------------------------------------------------------
30 // wxScreenDC
31 //-----------------------------------------------------------------------------
32
33 IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl,wxPaintDCImpl)
34
35 wxScreenDCImpl::wxScreenDCImpl( wxDC* owner )
36 : wxPaintDCImpl( owner )
37 {
38 m_ok = false;
39
40 m_display = (WXDisplay *) wxGlobalDisplay();
41
42 int screen = DefaultScreen( (Display*) m_display );
43 m_cmap = (WXColormap) DefaultColormap( (Display*) m_display, screen );
44
45 m_x11window = (WXWindow) RootWindow( (Display*) m_display, screen );
46
47 m_isScreenDC = true;
48
49 #if wxUSE_UNICODE
50 m_context = wxTheApp->GetPangoContext();
51 m_fontdesc = wxNORMAL_FONT->GetNativeFontInfo()->description;
52 #endif
53
54 SetUpDC();
55
56 XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
57 XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, IncludeInferiors );
58 XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, IncludeInferiors );
59 XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, IncludeInferiors );
60 }
61
62 wxScreenDCImpl::~wxScreenDCImpl()
63 {
64 XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
65 XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, ClipByChildren );
66 XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, ClipByChildren );
67 XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, ClipByChildren );
68 }
69
70 void wxScreenDCImpl::DoGetSize(int *width, int *height) const
71 {
72 wxDisplaySize(width, height);
73 }