mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-23 06:33:59 +08:00
added wxWindow::IsDoubleBuffered() and improve wxBufferedDC (patch 1565330)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -569,6 +569,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/common/ctrlsub.cpp
|
||||
src/common/datacmn.cpp
|
||||
src/common/dcbase.cpp
|
||||
src/common/dcbufcmn.cpp
|
||||
src/common/dlgcmn.cpp
|
||||
src/common/dndcmn.cpp
|
||||
src/common/dobjcmn.cpp
|
||||
|
||||
@@ -76,6 +76,7 @@ All (GUI):
|
||||
consistency with wxRichTextCtrl.
|
||||
- wxRichTextCtrl: fixed range out-by-one bug to be consistent with wxTextCtrl API,
|
||||
fixed some attribute bugs and added wxRichTextStyleComboCtrl.
|
||||
- Added wxWindow::IsDoubleBuffered()
|
||||
|
||||
wxMSW:
|
||||
|
||||
|
||||
@@ -1495,6 +1495,19 @@ to the dialog via validators.
|
||||
Resets the cached best size value so it will be recalculated the next time it is needed.
|
||||
|
||||
|
||||
\membersection{wxWindow::IsDoubleBuffered}\label{wxwindowisdoublebuffered}
|
||||
|
||||
\constfunc{virtual bool}{IsDoubleBuffered}{\void}
|
||||
|
||||
Returns \true if the window contents is double-buffered by the system, i.e. if
|
||||
any drawing done on the window is really done on a temporary backing surface
|
||||
and transferred to the screen all at once later.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxBufferedDC}{wxbuffereddc}
|
||||
|
||||
|
||||
\membersection{wxWindow::IsEnabled}\label{wxwindowisenabled}
|
||||
|
||||
\constfunc{virtual bool}{IsEnabled}{\void}
|
||||
|
||||
@@ -199,6 +199,8 @@ public:
|
||||
virtual bool Close( bool force = false );
|
||||
virtual bool Show( bool show = true );
|
||||
virtual bool Enable( bool enable = true );
|
||||
|
||||
virtual bool IsDoubleBuffered() const { return true; }
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_WINDOW_H__
|
||||
|
||||
@@ -434,9 +434,6 @@ protected:
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif
|
||||
|
||||
// Used by OnPaints of derived classes
|
||||
wxBitmap& GetBufferBitmap(const wxSize& sz) const;
|
||||
|
||||
// This is used when m_text is hidden (readonly).
|
||||
wxString m_valueString;
|
||||
|
||||
|
||||
+15
-14
@@ -134,11 +134,6 @@ public:
|
||||
|
||||
virtual ~wxDCBase() { }
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
wxDEPRECATED( virtual void BeginDrawing() );
|
||||
wxDEPRECATED( virtual void EndDrawing() );
|
||||
#endif // WXWIN_COMPATIBILITY_2_6
|
||||
|
||||
// graphic primitives
|
||||
// ------------------
|
||||
|
||||
@@ -387,6 +382,12 @@ public:
|
||||
virtual void StartPage() { }
|
||||
virtual void EndPage() { }
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
wxDEPRECATED( void BeginDrawing() );
|
||||
wxDEPRECATED( void EndDrawing() );
|
||||
#endif // WXWIN_COMPATIBILITY_2_6
|
||||
|
||||
|
||||
// set objects to use for drawing
|
||||
// ------------------------------
|
||||
|
||||
@@ -503,20 +504,20 @@ public:
|
||||
// accessors and setters
|
||||
// ---------------------
|
||||
|
||||
int GetBackgroundMode() const { return m_backgroundMode; }
|
||||
const wxBrush& GetBackground() const { return m_backgroundBrush; }
|
||||
const wxBrush& GetBrush() const { return m_brush; }
|
||||
const wxFont& GetFont() const { return m_font; }
|
||||
const wxPen& GetPen() const { return m_pen; }
|
||||
virtual int GetBackgroundMode() const { return m_backgroundMode; }
|
||||
virtual const wxBrush& GetBackground() const { return m_backgroundBrush; }
|
||||
virtual const wxBrush& GetBrush() const { return m_brush; }
|
||||
virtual const wxFont& GetFont() const { return m_font; }
|
||||
virtual const wxPen& GetPen() const { return m_pen; }
|
||||
|
||||
const wxColour& GetTextForeground() const { return m_textForegroundColour; }
|
||||
const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
|
||||
virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; }
|
||||
virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
|
||||
virtual void SetTextForeground(const wxColour& colour)
|
||||
{ m_textForegroundColour = colour; }
|
||||
virtual void SetTextBackground(const wxColour& colour)
|
||||
{ m_textBackgroundColour = colour; }
|
||||
|
||||
int GetMapMode() const { return m_mappingMode; }
|
||||
virtual int GetMapMode() const { return m_mappingMode; }
|
||||
virtual void SetMapMode(int mode) = 0;
|
||||
|
||||
virtual void GetUserScale(double *x, double *y) const
|
||||
@@ -553,7 +554,7 @@ public:
|
||||
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0;
|
||||
|
||||
int GetLogicalFunction() const { return m_logicalFunction; }
|
||||
virtual int GetLogicalFunction() const { return m_logicalFunction; }
|
||||
virtual void SetLogicalFunction(int function) = 0;
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_4
|
||||
|
||||
+557
-55
File diff suppressed because it is too large
Load Diff
@@ -109,6 +109,8 @@ public:
|
||||
|
||||
void OnInternalIdle();
|
||||
|
||||
virtual bool IsDoubleBuffered() const { return true; }
|
||||
|
||||
protected:
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen(int *x, int *y) const;
|
||||
|
||||
@@ -94,6 +94,8 @@ public:
|
||||
|
||||
virtual void ComputeScaleAndOrigin();
|
||||
|
||||
virtual GdkWindow* GetGDKWindow() const { return NULL; }
|
||||
|
||||
protected:
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
@@ -99,6 +99,8 @@ public:
|
||||
virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
|
||||
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
||||
|
||||
virtual GdkWindow* GetGDKWindow() const { return m_window; }
|
||||
|
||||
// protected:
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
@@ -124,6 +124,7 @@ public:
|
||||
|
||||
// currently wxGTK2-only
|
||||
void SetDoubleBuffered(bool on);
|
||||
virtual bool IsDoubleBuffered() const;
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
|
||||
virtual void ComputeScaleAndOrigin();
|
||||
|
||||
virtual GdkWindow* GetGDKWindow() const { return NULL; }
|
||||
|
||||
wxCoord XDEV2LOG(wxCoord x) const
|
||||
{
|
||||
wxCoord new_x = x - m_deviceOriginX;
|
||||
|
||||
@@ -100,6 +100,8 @@ public:
|
||||
virtual wxSize GetPPI() const;
|
||||
virtual int GetDepth() const;
|
||||
|
||||
virtual GdkWindow* GetGDKWindow() const { return m_window; }
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@ public:
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
virtual bool IsDoubleBuffered() const { return false; }
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ public:
|
||||
|
||||
bool AcceptsFocus() const;
|
||||
|
||||
virtual bool IsDoubleBuffered() const { return true; }
|
||||
|
||||
public:
|
||||
static long MacRemoveBordersFromStyle( long style ) ;
|
||||
|
||||
|
||||
@@ -126,6 +126,10 @@
|
||||
#define WS_EX_LAYOUTRTL 0x00400000
|
||||
#endif
|
||||
|
||||
#ifndef WS_EX_COMPOSITED
|
||||
#define WS_EX_COMPOSITED 0x02000000L
|
||||
#endif
|
||||
|
||||
#ifndef WS_EX_LAYERED
|
||||
#define WS_EX_LAYERED 0x00080000
|
||||
#endif
|
||||
|
||||
@@ -420,6 +420,9 @@ public:
|
||||
// check if mouse is in the window
|
||||
bool IsMouseInWindow() const;
|
||||
|
||||
// check if a native double-buffering applies for this window
|
||||
virtual bool IsDoubleBuffered() const;
|
||||
|
||||
// synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false
|
||||
void GenerateMouseLeave();
|
||||
|
||||
|
||||
@@ -287,9 +287,6 @@ private:
|
||||
// the selection bg colour
|
||||
wxColour m_colBgSel;
|
||||
|
||||
// double buffer
|
||||
wxBitmap* m_doubleBuffer;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS(wxVListBox)
|
||||
DECLARE_ABSTRACT_CLASS(wxVListBox)
|
||||
|
||||
@@ -725,6 +725,9 @@ public:
|
||||
// adjust DC for drawing on this window
|
||||
virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { }
|
||||
|
||||
// return true if the window contents is double buffered by the system
|
||||
virtual bool IsDoubleBuffered() const { return false; }
|
||||
|
||||
// the update region of the window contains the areas which must be
|
||||
// repainted by the program
|
||||
const wxRegion& GetUpdateRegion() const { return m_updateRegion; }
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "wx/timer.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dcbuffer.h"
|
||||
#include "wx/tooltip.h"
|
||||
|
||||
#include "wx/combo.h"
|
||||
@@ -610,9 +609,6 @@ END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl)
|
||||
|
||||
// Have global double buffer - should be enough for multiple combos
|
||||
static wxBitmap* gs_doubleBuffer = (wxBitmap*) NULL;
|
||||
|
||||
void wxComboCtrlBase::Init()
|
||||
{
|
||||
m_winPopup = (wxWindow *)NULL;
|
||||
@@ -737,9 +733,6 @@ wxComboCtrlBase::~wxComboCtrlBase()
|
||||
if ( HasCapture() )
|
||||
ReleaseMouse();
|
||||
|
||||
delete gs_doubleBuffer;
|
||||
gs_doubleBuffer = (wxBitmap*) NULL;
|
||||
|
||||
#if INSTALL_TOPLEV_HANDLER
|
||||
delete ((wxComboFrameEventHandler*)m_toplevEvtHandler);
|
||||
m_toplevEvtHandler = (wxEvtHandler*) NULL;
|
||||
@@ -1238,19 +1231,6 @@ void wxComboCtrlBase::RecalcAndRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap& wxComboCtrlBase::GetBufferBitmap( const wxSize& sz ) const
|
||||
{
|
||||
// If size is larger, recalculate double buffer bitmap
|
||||
if ( !gs_doubleBuffer ||
|
||||
sz.x > gs_doubleBuffer->GetWidth() ||
|
||||
sz.y > gs_doubleBuffer->GetHeight() )
|
||||
{
|
||||
delete gs_doubleBuffer;
|
||||
gs_doubleBuffer = new wxBitmap(sz.x+25,sz.y);
|
||||
}
|
||||
return *gs_doubleBuffer;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// miscellaneous event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/dcbufcmn.cpp
|
||||
// Purpose: Buffered DC implementation
|
||||
// Author: Ron Lee, Jaakko Salli
|
||||
// Modified by:
|
||||
// Created: Sep-20-2006
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#endif
|
||||
|
||||
#include "wx/dcbuffer.h"
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// wxSharedDCBufferManager
|
||||
// Helper class to free shared buffer when the app exists.
|
||||
// ============================================================================
|
||||
|
||||
class wxSharedDCBufferManager
|
||||
{
|
||||
friend class wxBufferedDC;
|
||||
public:
|
||||
|
||||
wxSharedDCBufferManager()
|
||||
{
|
||||
m_buffer = NULL;
|
||||
}
|
||||
|
||||
~wxSharedDCBufferManager()
|
||||
{
|
||||
delete m_buffer;
|
||||
}
|
||||
|
||||
wxBitmap* GetBuffer(wxWindow* win, const wxSize& area)
|
||||
{
|
||||
int width = area.x;
|
||||
int height = area.y;
|
||||
|
||||
if ( width <= 0 )
|
||||
win->GetClientSize(&width, &height);
|
||||
|
||||
if ( !m_buffer ||
|
||||
width > m_buffer->GetWidth() ||
|
||||
height > m_buffer->GetHeight() )
|
||||
{
|
||||
delete m_buffer;
|
||||
|
||||
// Create slightly larger bitmap so we don't need to
|
||||
// be reallocating constantly when the user enlarges
|
||||
// the frame for the first time.
|
||||
m_buffer = new wxBitmap(width+20, height+20);
|
||||
}
|
||||
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
private:
|
||||
wxBitmap* m_buffer;
|
||||
};
|
||||
|
||||
static wxSharedDCBufferManager gs_sharedDCBufferManager;
|
||||
|
||||
// ============================================================================
|
||||
// wxBufferedDC
|
||||
// ============================================================================
|
||||
|
||||
// Blits the buffer to the dc, and detaches the dc from the buffer (so it
|
||||
// can be effectively used once only).
|
||||
//
|
||||
// Usually called in the dtor or by the dtor of derived classes if the
|
||||
// BufferedDC must blit before the derived class (which may own the dc it's
|
||||
// blitting to) is destroyed.
|
||||
void wxBufferedDC::UnMask()
|
||||
{
|
||||
if ( m_buffer )
|
||||
{
|
||||
wxASSERT_MSG( m_mainDc != NULL,
|
||||
_T("No underlying DC associated with wxBufferedDC (anymore)") );
|
||||
|
||||
wxDC* bufferDc = DetachDC();
|
||||
|
||||
wxASSERT( bufferDc->IsKindOf(CLASSINFO(wxMemoryDC)) );
|
||||
|
||||
wxCoord x=0, y=0;
|
||||
|
||||
if (m_style & wxBUFFER_CLIENT_AREA)
|
||||
bufferDc->GetDeviceOrigin(& x, & y);
|
||||
|
||||
m_mainDc->Blit( 0, 0,
|
||||
m_buffer->GetWidth(), m_buffer->GetHeight(), bufferDc,
|
||||
-x, -y );
|
||||
m_mainDc = NULL;
|
||||
m_buffer = NULL;
|
||||
delete bufferDc;
|
||||
}
|
||||
}
|
||||
|
||||
void wxBufferedDC::PrepareBuffer(wxWindow* win, const wxSize& area)
|
||||
{
|
||||
m_buffer = gs_sharedDCBufferManager.GetBuffer(win, area);
|
||||
}
|
||||
|
||||
void wxBufferedDC::UseBuffer()
|
||||
{
|
||||
wxASSERT(m_buffer);
|
||||
|
||||
wxMemoryDC* memoryDc = new wxMemoryDC(m_mainDc);
|
||||
memoryDc->SelectObject(*m_buffer);
|
||||
|
||||
AttachDC(memoryDc);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ void wxGenericComboCtrl::OnResize()
|
||||
void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxSize sz = GetClientSize();
|
||||
wxBufferedPaintDC dc(this,GetBufferBitmap(sz));
|
||||
wxAutoBufferedPaintDC dc(this);
|
||||
|
||||
const wxRect& rectb = m_btnArea;
|
||||
wxRect rect = m_tcArea;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "wx/calctrl.h"
|
||||
#include "wx/popupwin.h"
|
||||
#include "wx/renderer.h"
|
||||
#include "wx/dcbuffer.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -682,6 +683,7 @@ wxDataViewHeaderWindow::wxDataViewHeaderWindow( wxDataViewCtrl *parent, wxWindow
|
||||
m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE );
|
||||
|
||||
wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
|
||||
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
|
||||
SetOwnForegroundColour( attr.colFg );
|
||||
SetOwnBackgroundColour( attr.colBg );
|
||||
if (!m_hasFont)
|
||||
@@ -698,7 +700,10 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
int w, h;
|
||||
GetClientSize( &w, &h );
|
||||
|
||||
wxPaintDC dc( this );
|
||||
wxAutoBufferedPaintDC dc( this );
|
||||
|
||||
dc.SetBackground(GetBackgroundColour());
|
||||
dc.Clear();
|
||||
|
||||
int xpix;
|
||||
m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
|
||||
@@ -953,6 +958,7 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i
|
||||
|
||||
m_hasFocus = false;
|
||||
|
||||
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
|
||||
SetBackgroundColour( *wxWHITE );
|
||||
|
||||
UpdateDisplay();
|
||||
@@ -1094,7 +1100,10 @@ void wxDataViewMainWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
|
||||
|
||||
void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxPaintDC dc( this );
|
||||
wxAutoBufferedPaintDC dc( this );
|
||||
|
||||
dc.SetBackground(GetBackgroundColour());
|
||||
dc.Clear();
|
||||
|
||||
GetOwner()->PrepareDC( dc );
|
||||
|
||||
|
||||
+1
-12
@@ -64,7 +64,6 @@ void wxVListBox::Init()
|
||||
m_current =
|
||||
m_anchor = wxNOT_FOUND;
|
||||
m_selStore = NULL;
|
||||
m_doubleBuffer = NULL;
|
||||
}
|
||||
|
||||
bool wxVListBox::Create(wxWindow *parent,
|
||||
@@ -94,7 +93,6 @@ bool wxVListBox::Create(wxWindow *parent,
|
||||
|
||||
wxVListBox::~wxVListBox()
|
||||
{
|
||||
delete m_doubleBuffer;
|
||||
delete m_selStore;
|
||||
}
|
||||
|
||||
@@ -360,18 +358,9 @@ void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
|
||||
|
||||
void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
// If size is larger, recalculate double buffer bitmap
|
||||
wxSize clientSize = GetClientSize();
|
||||
|
||||
if ( !m_doubleBuffer ||
|
||||
clientSize.x > m_doubleBuffer->GetWidth() ||
|
||||
clientSize.y > m_doubleBuffer->GetHeight() )
|
||||
{
|
||||
delete m_doubleBuffer;
|
||||
m_doubleBuffer = new wxBitmap(clientSize.x+25,clientSize.y+25);
|
||||
}
|
||||
|
||||
wxBufferedPaintDC dc(this,*m_doubleBuffer);
|
||||
wxAutoBufferedPaintDC dc(this);
|
||||
|
||||
// the update rectangle
|
||||
wxRect rectUpdate = GetUpdateClientRect();
|
||||
|
||||
+36
-22
@@ -192,6 +192,10 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
|
||||
|
||||
GtkWidget *button = GetButtonWidget();
|
||||
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
int x_diff = 0;
|
||||
if (win->GetLayoutDirection() == wxLayout_RightToLeft)
|
||||
x_diff = rect.width;
|
||||
@@ -199,9 +203,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
|
||||
gtk_paint_box
|
||||
(
|
||||
button->style,
|
||||
// FIXME: I suppose GTK_PIZZA(win->m_wxwindow)->bin_window doesn't work with wxMemoryDC.
|
||||
// Maybe use code similar as in DrawPushButton below?
|
||||
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||
gdk_window,
|
||||
flags & wxCONTROL_DISABLED ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_OUT,
|
||||
NULL,
|
||||
@@ -220,6 +222,10 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
|
||||
{
|
||||
GtkWidget *tree = GetTreeWidget();
|
||||
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
GtkStateType state;
|
||||
if ( flags & wxCONTROL_CURRENT )
|
||||
state = GTK_STATE_PRELIGHT;
|
||||
@@ -229,13 +235,13 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
|
||||
int x_diff = 0;
|
||||
if (win->GetLayoutDirection() == wxLayout_RightToLeft)
|
||||
x_diff = rect.width;
|
||||
|
||||
|
||||
// VZ: I don't know how to get the size of the expander so as to centre it
|
||||
// in the given rectangle, +2/3 below is just what looks good here...
|
||||
gtk_paint_expander
|
||||
(
|
||||
tree->style,
|
||||
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||
gdk_window,
|
||||
state,
|
||||
NULL,
|
||||
tree,
|
||||
@@ -299,6 +305,10 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
||||
return;
|
||||
}
|
||||
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
wxCoord full_size = GetGtkSplitterFullSize();
|
||||
|
||||
// are we drawing vertical or horizontal splitter?
|
||||
@@ -332,7 +342,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
||||
gtk_paint_handle
|
||||
(
|
||||
win->m_wxwindow->style,
|
||||
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||
gdk_window,
|
||||
flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_NONE,
|
||||
NULL /* no clipping */,
|
||||
@@ -347,7 +357,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
||||
}
|
||||
|
||||
void
|
||||
wxRendererGTK::DrawDropArrow(wxWindow *win,
|
||||
wxRendererGTK::DrawDropArrow(wxWindow *WXUNUSED(win),
|
||||
wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
@@ -359,11 +369,9 @@ wxRendererGTK::DrawDropArrow(wxWindow *win,
|
||||
// work for wxMemoryDC. So that is why we assume wxDC
|
||||
// is wxWindowDC (wxClientDC, wxMemoryDC and wxPaintDC
|
||||
// are derived from it) and use its m_window.
|
||||
wxWindowDC& wdc = (wxWindowDC&)dc;
|
||||
|
||||
// only doing debug-time checking here (it should
|
||||
// probably be enough)
|
||||
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
// draw arrow so that there is even space horizontally
|
||||
// on both sides
|
||||
@@ -390,7 +398,7 @@ wxRendererGTK::DrawDropArrow(wxWindow *win,
|
||||
gtk_paint_arrow
|
||||
(
|
||||
button->style,
|
||||
wdc.m_window,
|
||||
gdk_window,
|
||||
state,
|
||||
flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
||||
NULL,
|
||||
@@ -416,7 +424,7 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
|
||||
}
|
||||
|
||||
void
|
||||
wxRendererGTK::DrawCheckBox(wxWindow *win,
|
||||
wxRendererGTK::DrawCheckBox(wxWindow *WXUNUSED(win),
|
||||
wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags )
|
||||
@@ -424,8 +432,9 @@ wxRendererGTK::DrawCheckBox(wxWindow *win,
|
||||
GtkWidget *button = GetCheckButtonWidget();
|
||||
|
||||
// for reason why we do this, see DrawDropArrow
|
||||
wxWindowDC& wdc = (wxWindowDC&)dc;
|
||||
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
GtkStateType state;
|
||||
|
||||
@@ -441,7 +450,7 @@ wxRendererGTK::DrawCheckBox(wxWindow *win,
|
||||
gtk_paint_check
|
||||
(
|
||||
button->style,
|
||||
wdc.m_window,
|
||||
gdk_window,
|
||||
state,
|
||||
flags & wxCONTROL_CHECKED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
||||
NULL,
|
||||
@@ -454,7 +463,7 @@ wxRendererGTK::DrawCheckBox(wxWindow *win,
|
||||
}
|
||||
|
||||
void
|
||||
wxRendererGTK::DrawPushButton(wxWindow *win,
|
||||
wxRendererGTK::DrawPushButton(wxWindow *WXUNUSED(win),
|
||||
wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
@@ -462,8 +471,9 @@ wxRendererGTK::DrawPushButton(wxWindow *win,
|
||||
GtkWidget *button = GetButtonWidget();
|
||||
|
||||
// for reason why we do this, see DrawDropArrow
|
||||
wxWindowDC& wdc = (wxWindowDC&)dc;
|
||||
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
// draw button
|
||||
GtkStateType state;
|
||||
@@ -480,7 +490,7 @@ wxRendererGTK::DrawPushButton(wxWindow *win,
|
||||
gtk_paint_box
|
||||
(
|
||||
button->style,
|
||||
wdc.m_window,
|
||||
gdk_window,
|
||||
state,
|
||||
flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
||||
NULL,
|
||||
@@ -496,6 +506,10 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow *win,
|
||||
const wxRect& rect,
|
||||
int flags )
|
||||
{
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
GtkStateType state;
|
||||
if (flags & wxCONTROL_SELECTED)
|
||||
{
|
||||
@@ -505,7 +519,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow *win,
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
|
||||
gtk_paint_flat_box( win->m_wxwindow->style,
|
||||
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||
gdk_window,
|
||||
state,
|
||||
GTK_SHADOW_NONE,
|
||||
NULL,
|
||||
|
||||
@@ -3935,6 +3935,11 @@ void wxWindowGTK::SetDoubleBuffered( bool on )
|
||||
gtk_widget_set_double_buffered( m_wxwindow, on );
|
||||
}
|
||||
|
||||
bool wxWindowGTK::IsDoubleBuffered() const
|
||||
{
|
||||
return GTK_WIDGET_DOUBLE_BUFFERED( m_wxwindow );
|
||||
}
|
||||
|
||||
void wxWindowGTK::ClearBackground()
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
||||
|
||||
@@ -309,11 +309,9 @@ wxRendererGTK::DrawDropArrow(wxWindow *win,
|
||||
// work for wxMemoryDC. So that is why we assume wxDC
|
||||
// is wxWindowDC (wxClientDC, wxMemoryDC and wxPaintDC
|
||||
// are derived from it) and use its m_window.
|
||||
wxWindowDC& wdc = (wxWindowDC&)dc;
|
||||
|
||||
// only doing debug-time checking here (it should
|
||||
// probably be enough)
|
||||
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
// draw arrow so that there is even space horizontally
|
||||
// on both sides
|
||||
@@ -340,7 +338,7 @@ wxRendererGTK::DrawDropArrow(wxWindow *win,
|
||||
gtk_paint_arrow
|
||||
(
|
||||
button->style,
|
||||
wdc.m_window,
|
||||
gdk_window,
|
||||
state,
|
||||
flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
||||
NULL,
|
||||
@@ -364,8 +362,9 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
|
||||
GtkWidget *button = GetButtonWidget();
|
||||
|
||||
// for reason why we do this, see DrawDropArrow
|
||||
wxWindowDC& wdc = (wxWindowDC&)dc;
|
||||
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
|
||||
GdkWindow* gdk_window = dc.GetGDKWindow();
|
||||
wxASSERT_MSG( gdk_window,
|
||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||
|
||||
// draw button
|
||||
GtkStateType state;
|
||||
@@ -382,7 +381,7 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
|
||||
gtk_paint_box
|
||||
(
|
||||
button->style,
|
||||
wdc.m_window,
|
||||
gdk_window,
|
||||
state,
|
||||
flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
||||
NULL,
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
||||
// TODO: Convert drawing in this function to Windows API Code
|
||||
|
||||
wxSize sz = GetClientSize();
|
||||
wxBufferedPaintDC dc(this,GetBufferBitmap(sz));
|
||||
wxAutoBufferedPaintDC dc(this);
|
||||
|
||||
const wxRect& rectb = m_btnArea;
|
||||
wxRect rect = m_tcArea;
|
||||
|
||||
@@ -3950,6 +3950,20 @@ bool wxWindowMSW::HandlePower(WXWPARAM WXUNUSED_IN_WINCE(wParam),
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxWindowMSW::IsDoubleBuffered() const
|
||||
{
|
||||
const wxWindow* wnd = this;
|
||||
|
||||
while ( wnd )
|
||||
{
|
||||
if ( ::GetWindowLong((HWND)wnd->GetHWND(), GWL_EXSTYLE) & WS_EX_COMPOSITED )
|
||||
return true;
|
||||
wnd = wnd->GetParent();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// owner drawn stuff
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user