Use wxOverlay::IsNative() rather than wxHAS_NATIVE_OVERLAY
This commit is contained in:
parent
38a7861391
commit
b401dfbdac
@ -15,10 +15,6 @@
|
||||
#include "wx/dc.h"
|
||||
#include "wx/overlay.h"
|
||||
|
||||
#ifdef wxHAS_NATIVE_OVERLAY
|
||||
#define wxHAS_CARET_USING_OVERLAYS
|
||||
#endif
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxCaret;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxCaretTimer : public wxTimer
|
||||
@ -75,17 +71,13 @@ private:
|
||||
// GTK specific initialization
|
||||
void InitGeneric();
|
||||
|
||||
#ifdef wxHAS_CARET_USING_OVERLAYS
|
||||
// the overlay for displaying the caret
|
||||
wxOverlay m_overlay;
|
||||
#else
|
||||
// the bitmap holding the part of window hidden by the caret when it was
|
||||
// at (m_xOld, m_yOld)
|
||||
wxBitmap m_bmpUnderCaret;
|
||||
int m_xOld,
|
||||
m_yOld;
|
||||
#endif
|
||||
|
||||
wxCaretTimer m_timer;
|
||||
bool m_blinkedOut, // true => caret hidden right now
|
||||
m_hasFocus; // true => our window has focus
|
||||
|
@ -144,14 +144,9 @@ public:
|
||||
// Attributes
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef wxHAS_NATIVE_OVERLAY
|
||||
// backing store is not used when native overlays are
|
||||
void SetBackingBitmap(wxBitmap* WXUNUSED(bitmap)) { }
|
||||
#else
|
||||
// For efficiency, tell wxGenericDragImage to use a bitmap that's already
|
||||
// created (e.g. from last drag)
|
||||
void SetBackingBitmap(wxBitmap* bitmap) { m_pBackingBitmap = bitmap; }
|
||||
#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY
|
||||
|
||||
// Operations
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@ -234,19 +229,13 @@ protected:
|
||||
bool m_isShown;
|
||||
wxWindow* m_window;
|
||||
wxDC* m_windowDC;
|
||||
|
||||
#ifdef wxHAS_NATIVE_OVERLAY
|
||||
wxOverlay m_overlay;
|
||||
wxDCOverlay* m_dcOverlay;
|
||||
#else
|
||||
// Stores the window contents while we're dragging the image around
|
||||
wxBitmap m_backingBitmap;
|
||||
wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap
|
||||
// (pass to wxGenericDragImage as an efficiency measure)
|
||||
// A temporary bitmap for repairing/redrawing
|
||||
wxBitmap m_repairBitmap;
|
||||
#endif // !wxHAS_NATIVE_OVERLAY
|
||||
|
||||
wxRect m_boundingRect;
|
||||
bool m_fullScreen;
|
||||
|
||||
|
@ -97,12 +97,10 @@ void wxCaret::InitGeneric()
|
||||
{
|
||||
m_hasFocus = true;
|
||||
m_blinkedOut = true;
|
||||
#ifndef wxHAS_CARET_USING_OVERLAYS
|
||||
m_xOld =
|
||||
m_yOld = -1;
|
||||
if (m_width && m_height)
|
||||
if (!m_overlay.IsNative() && m_width && m_height)
|
||||
m_bmpUnderCaret.Create(m_width, m_height);
|
||||
#endif
|
||||
}
|
||||
|
||||
wxCaret::~wxCaret()
|
||||
@ -141,9 +139,12 @@ void wxCaret::DoHide()
|
||||
|
||||
void wxCaret::DoMove()
|
||||
{
|
||||
#ifdef wxHAS_CARET_USING_OVERLAYS
|
||||
m_overlay.Reset();
|
||||
#endif
|
||||
if (m_overlay.IsNative())
|
||||
{
|
||||
m_overlay.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( IsVisible() )
|
||||
{
|
||||
if ( !m_blinkedOut )
|
||||
@ -168,15 +169,17 @@ void wxCaret::DoSize()
|
||||
m_countVisible = 0;
|
||||
DoHide();
|
||||
}
|
||||
#ifdef wxHAS_CARET_USING_OVERLAYS
|
||||
m_overlay.Reset();
|
||||
#else
|
||||
// Change bitmap size
|
||||
if (m_width && m_height)
|
||||
m_bmpUnderCaret = wxBitmap(m_width, m_height);
|
||||
|
||||
if (m_overlay.IsNative())
|
||||
m_overlay.Reset();
|
||||
else
|
||||
m_bmpUnderCaret = wxBitmap();
|
||||
#endif
|
||||
{
|
||||
// Change bitmap size
|
||||
m_bmpUnderCaret.UnRef();
|
||||
if (m_width && m_height)
|
||||
m_bmpUnderCaret.Create(m_width, m_height);
|
||||
}
|
||||
|
||||
if (countVisible > 0)
|
||||
{
|
||||
m_countVisible = countVisible;
|
||||
@ -229,18 +232,17 @@ void wxCaret::Blink()
|
||||
void wxCaret::Refresh()
|
||||
{
|
||||
wxClientDC dcWin(GetWindow());
|
||||
// this is the new code, switch to 0 if this gives problems
|
||||
#ifdef wxHAS_CARET_USING_OVERLAYS
|
||||
wxDCOverlay dcOverlay( m_overlay, &dcWin, m_x, m_y, m_width , m_height );
|
||||
if ( m_blinkedOut )
|
||||
if (m_overlay.IsNative())
|
||||
{
|
||||
dcOverlay.Clear();
|
||||
wxDCOverlay dcOverlay(m_overlay, &dcWin, m_x, m_y, m_width, m_height);
|
||||
if (m_blinkedOut)
|
||||
dcOverlay.Clear();
|
||||
else
|
||||
DoDraw(&dcWin, GetWindow());
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DoDraw( &dcWin, GetWindow() );
|
||||
}
|
||||
#else
|
||||
|
||||
wxMemoryDC dcMem;
|
||||
dcMem.SelectObject(m_bmpUnderCaret);
|
||||
if ( m_blinkedOut )
|
||||
@ -268,7 +270,6 @@ void wxCaret::Refresh()
|
||||
// and draw the caret there
|
||||
DoDraw(&dcWin, GetWindow());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxCaret::DoDraw(wxDC *dc, wxWindow* win)
|
||||
|
@ -65,11 +65,7 @@ void wxGenericDragImage::Init()
|
||||
m_windowDC = NULL;
|
||||
m_window = NULL;
|
||||
m_fullScreen = false;
|
||||
#ifdef wxHAS_NATIVE_OVERLAY
|
||||
m_dcOverlay = NULL;
|
||||
#else
|
||||
m_pBackingBitmap = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Attributes
|
||||
@ -227,12 +223,13 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef wxHAS_NATIVE_OVERLAY
|
||||
wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap);
|
||||
if (!m_overlay.IsNative())
|
||||
{
|
||||
wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap);
|
||||
|
||||
if (!backing->IsOk() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y))
|
||||
(*backing) = wxBitmap(clientSize.x, clientSize.y);
|
||||
#endif // !wxHAS_NATIVE_OVERLAY
|
||||
if (!backing->IsOk() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y))
|
||||
(*backing) = wxBitmap(clientSize.x, clientSize.y);
|
||||
}
|
||||
|
||||
if (!m_fullScreen)
|
||||
{
|
||||
@ -295,17 +292,15 @@ bool wxGenericDragImage::EndDrag()
|
||||
|
||||
if (m_windowDC)
|
||||
{
|
||||
#ifdef wxHAS_NATIVE_OVERLAY
|
||||
m_overlay.Reset();
|
||||
#else
|
||||
m_windowDC->DestroyClippingRegion();
|
||||
#endif
|
||||
if (m_overlay.IsNative())
|
||||
m_overlay.Reset();
|
||||
else
|
||||
m_windowDC->DestroyClippingRegion();
|
||||
|
||||
wxDELETE(m_windowDC);
|
||||
}
|
||||
|
||||
#ifndef wxHAS_NATIVE_OVERLAY
|
||||
m_repairBitmap = wxNullBitmap;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -347,16 +342,17 @@ bool wxGenericDragImage::Show()
|
||||
// This is where we restore the backing bitmap, in case
|
||||
// something has changed on the window.
|
||||
|
||||
#ifndef wxHAS_NATIVE_OVERLAY
|
||||
wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap);
|
||||
wxMemoryDC memDC;
|
||||
memDC.SelectObject(* backing);
|
||||
if (!m_overlay.IsNative())
|
||||
{
|
||||
wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap);
|
||||
wxMemoryDC memDC;
|
||||
memDC.SelectObject(* backing);
|
||||
|
||||
UpdateBackingFromWindow(* m_windowDC, memDC, m_boundingRect, wxRect(0, 0, m_boundingRect.width, m_boundingRect.height));
|
||||
UpdateBackingFromWindow(* m_windowDC, memDC, m_boundingRect, wxRect(0, 0, m_boundingRect.width, m_boundingRect.height));
|
||||
|
||||
//memDC.Blit(0, 0, m_boundingRect.width, m_boundingRect.height, m_windowDC, m_boundingRect.x, m_boundingRect.y);
|
||||
memDC.SelectObject(wxNullBitmap);
|
||||
#endif // !wxHAS_NATIVE_OVERLAY
|
||||
//memDC.Blit(0, 0, m_boundingRect.width, m_boundingRect.height, m_windowDC, m_boundingRect.x, m_boundingRect.y);
|
||||
memDC.SelectObject(wxNullBitmap);
|
||||
}
|
||||
|
||||
RedrawImage(m_position - m_offset, m_position - m_offset, false, true);
|
||||
}
|
||||
@ -399,15 +395,17 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos,
|
||||
if (!m_windowDC)
|
||||
return false;
|
||||
|
||||
#ifdef wxHAS_NATIVE_OVERLAY
|
||||
wxUnusedVar(oldPos);
|
||||
if (m_overlay.IsNative())
|
||||
{
|
||||
wxDCOverlay dcoverlay( m_overlay, (wxWindowDC*) m_windowDC ) ;
|
||||
if ( eraseOld )
|
||||
dcoverlay.Clear() ;
|
||||
if (drawNew)
|
||||
DoDrawImage(*m_windowDC, newPos);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxDCOverlay dcoverlay( m_overlay, (wxWindowDC*) m_windowDC ) ;
|
||||
if ( eraseOld )
|
||||
dcoverlay.Clear() ;
|
||||
if (drawNew)
|
||||
DoDrawImage(*m_windowDC, newPos);
|
||||
#else // !wxHAS_NATIVE_OVERLAY
|
||||
wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap);
|
||||
if (!backing->IsOk())
|
||||
return false;
|
||||
@ -473,7 +471,6 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos,
|
||||
|
||||
memDCTemp.SelectObject(wxNullBitmap);
|
||||
memDC.SelectObject(wxNullBitmap);
|
||||
#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user