2001-07-24 11:27:12 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2002-01-18 17:34:01 -05:00
|
|
|
// Name: antiflickpl.h
|
|
|
|
// Purpose: Double-buffering plugin class for reducing flicker
|
2001-07-24 11:27:12 -04:00
|
|
|
// Author: Aleksandras Gluchovas (@Lithuania)
|
|
|
|
// Modified by:
|
|
|
|
// Created: 23/10/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Aleksandras Gluchovas
|
2002-01-21 17:34:42 -05:00
|
|
|
// Licence: wxWindows licence
|
2001-07-24 11:27:12 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __ANTIFLICKPL_G__
|
|
|
|
#define __ANTIFLICKPL_G__
|
|
|
|
|
|
|
|
#include "wx/fl/controlbar.h"
|
|
|
|
|
2002-01-18 17:34:01 -05:00
|
|
|
/*
|
|
|
|
Implements double-buffering to reduce flicker.
|
2002-01-21 17:34:42 -05:00
|
|
|
Bitmap and memory DC buffers are shared 'resources' among all instances of
|
2002-01-18 17:34:01 -05:00
|
|
|
antiflicker plugins within the application.
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
Locking for multithreaded applications is not yet implemented.
|
2002-01-18 17:34:01 -05:00
|
|
|
*/
|
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
class WXDLLIMPEXP_FL cbAntiflickerPlugin : public cbPluginBase
|
2001-07-24 11:27:12 -04:00
|
|
|
{
|
2002-01-21 17:34:42 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin )
|
2001-07-24 11:27:12 -04:00
|
|
|
protected:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
static wxBitmap* mpVertBuf;
|
|
|
|
static wxBitmap* mpHorizBuf;
|
|
|
|
static wxMemoryDC* mpVertBufDc;
|
|
|
|
static wxMemoryDC* mpHorizBufDc;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
static int mRefCount;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxDC* mpLRUBufDc; // last-recently-used buffer
|
|
|
|
wxRect mLRUArea; // last-recently-used area
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
protected:
|
2002-01-21 17:34:42 -05:00
|
|
|
// Finds a suitable buffer. Returns NULL if a suitable buffer is not present.
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxDC* FindSuitableBuffer( const wxRect& forArea );
|
|
|
|
|
|
|
|
// Allocates a suitable buffer.
|
|
|
|
|
|
|
|
wxDC* AllocNewBuffer( const wxRect& forArea );
|
|
|
|
|
|
|
|
// Gets the window device context.
|
|
|
|
|
|
|
|
wxDC& GetWindowDC();
|
|
|
|
|
|
|
|
// Gets the client device context.
|
|
|
|
|
|
|
|
wxDC& GetClientDC();
|
2001-07-24 11:27:12 -04:00
|
|
|
public:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Default constructor.
|
|
|
|
|
|
|
|
cbAntiflickerPlugin(void);
|
|
|
|
|
|
|
|
// Constructor taking frame layout panel, and pane mask.
|
|
|
|
|
|
|
|
cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
|
|
|
|
|
|
|
// Destructor.
|
|
|
|
|
|
|
|
virtual ~cbAntiflickerPlugin();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handler for plugin event.
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handler for plugin event.
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-07-24 11:27:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ANTIFLICKPL_G__ */
|
|
|
|
|