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
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __ANTIFLICKPL_G__
|
|
|
|
#define __ANTIFLICKPL_G__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "antiflickpl.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/fl/controlbar.h"
|
|
|
|
|
2002-01-18 17:34:01 -05:00
|
|
|
/*
|
|
|
|
Implements double-buffering to reduce flicker.
|
|
|
|
Bitmap and memory DC buffers are shared "resources" among all instances of
|
|
|
|
antiflicker plugins within the application.
|
|
|
|
|
|
|
|
Locking for multithreaded applications is not yet implemented.
|
|
|
|
*/
|
|
|
|
|
2001-07-24 11:27:12 -04:00
|
|
|
class cbAntiflickerPlugin : public cbPluginBase
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin )
|
|
|
|
protected:
|
|
|
|
|
|
|
|
static wxBitmap* mpVertBuf;
|
|
|
|
static wxBitmap* mpHorizBuf;
|
|
|
|
static wxMemoryDC* mpVertBufDc;
|
|
|
|
static wxMemoryDC* mpHorizBufDc;
|
|
|
|
|
|
|
|
static int mRefCount;
|
|
|
|
|
2002-01-18 17:34:01 -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-18 17:34:01 -05:00
|
|
|
// Finds a suitable buffer. Returns NULL if a suitable buffer is not present.
|
2001-07-24 11:27:12 -04:00
|
|
|
wxDC* FindSuitableBuffer( const wxRect& forArea );
|
2002-01-18 17:34:01 -05:00
|
|
|
// Allocates a suitable buffer.
|
2001-07-24 11:27:12 -04:00
|
|
|
wxDC* AllocNewBuffer( const wxRect& forArea );
|
|
|
|
|
2002-01-18 17:34:01 -05:00
|
|
|
wxDC& GetWindowDC();
|
2001-07-24 11:27:12 -04:00
|
|
|
wxDC& GetClientDC();
|
|
|
|
public:
|
|
|
|
|
|
|
|
cbAntiflickerPlugin(void);
|
|
|
|
|
|
|
|
cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
|
|
|
|
|
|
|
virtual ~cbAntiflickerPlugin();
|
|
|
|
|
2002-01-18 17:34:01 -05:00
|
|
|
// Handler for plugin event.
|
2001-07-24 11:27:12 -04:00
|
|
|
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
|
|
|
// Handler for plugin event.
|
2001-07-24 11:27:12 -04:00
|
|
|
void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event );
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ANTIFLICKPL_G__ */
|
|
|
|
|