]> git.saurik.com Git - wxWidgets.git/blame - src/x11/dcmemory.cpp
Make status bar grip move to the left in RTL.
[wxWidgets.git] / src / x11 / dcmemory.cpp
CommitLineData
83df96d6 1/////////////////////////////////////////////////////////////////////////////
de6185e2 2// Name: src/x11/dcmemory.cpp
83df96d6
JS
3// Purpose: wxMemoryDC class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
de6185e2 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
de6185e2
WS
12// for compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
83df96d6 15#include "wx/dcmemory.h"
de6185e2
WS
16
17#ifndef WX_PRECOMP
18 #include "wx/utils.h"
9eddec69 19 #include "wx/settings.h"
de6185e2
WS
20#endif
21
7266b672 22#include "wx/x11/private.h"
83df96d6 23
3cd0b8c5 24IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
83df96d6 25
432efcb0
RD
26wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
27 : wxWindowDC()
83df96d6 28{
de6185e2
WS
29 m_ok = false;
30
3cd0b8c5
RR
31 m_display = (WXDisplay *) wxGlobalDisplay();
32
33 int screen = DefaultScreen( wxGlobalDisplay() );
34 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
432efcb0
RD
35
36 if ( bitmap.IsOk() )
37 SelectObject(bitmap);
3cd0b8c5 38}
83df96d6 39
3cd0b8c5
RR
40wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
41 : wxWindowDC()
83df96d6 42{
de6185e2 43 m_ok = false;
3cd0b8c5
RR
44
45 m_display = (WXDisplay *) wxGlobalDisplay();
de6185e2 46
3cd0b8c5
RR
47 int screen = DefaultScreen( wxGlobalDisplay() );
48 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
49}
83df96d6 50
3cd0b8c5 51wxMemoryDC::~wxMemoryDC()
83df96d6 52{
3cd0b8c5 53}
83df96d6
JS
54
55void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
56{
3cd0b8c5 57 Destroy();
de6185e2 58
3cd0b8c5
RR
59 m_selected = bitmap;
60 if (m_selected.Ok())
83df96d6 61 {
3cd0b8c5
RR
62 if (m_selected.GetPixmap())
63 {
64 m_window = (WXWindow) m_selected.GetPixmap();
65 }
66 else
67 {
6799385e 68 m_window = m_selected.GetBitmap();
3cd0b8c5
RR
69 }
70
de6185e2 71 m_isMemDC = true;
3cd0b8c5
RR
72
73 SetUpDC();
83df96d6
JS
74 }
75 else
76 {
de6185e2 77 m_ok = false;
3cd0b8c5
RR
78 m_window = NULL;
79 }
80}
83df96d6
JS
81
82void wxMemoryDC::DoGetSize( int *width, int *height ) const
83{
3cd0b8c5 84 if (m_selected.Ok())
83df96d6 85 {
3cd0b8c5
RR
86 if (width) (*width) = m_selected.GetWidth();
87 if (height) (*height) = m_selected.GetHeight();
83df96d6
JS
88 }
89 else
90 {
91 if (width) (*width) = 0;
92 if (height) (*height) = 0;
3cd0b8c5
RR
93 }
94}