1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Double-buffering plugin class for reducing flicker
4 // Author: Aleksandras Gluchovas (@Lithuania)
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __ANTIFLICKPL_G__
13 #define __ANTIFLICKPL_G__
15 #include "wx/fl/controlbar.h"
18 Implements double-buffering to reduce flicker.
19 Bitmap and memory DC buffers are shared 'resources' among all instances of
20 antiflicker plugins within the application.
22 Locking for multithreaded applications is not yet implemented.
25 class WXDLLIMPEXP_FL cbAntiflickerPlugin
: public cbPluginBase
27 DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin
)
30 static wxBitmap
* mpVertBuf
;
31 static wxBitmap
* mpHorizBuf
;
32 static wxMemoryDC
* mpVertBufDc
;
33 static wxMemoryDC
* mpHorizBufDc
;
37 wxDC
* mpLRUBufDc
; // last-recently-used buffer
38 wxRect mLRUArea
; // last-recently-used area
41 // Finds a suitable buffer. Returns NULL if a suitable buffer is not present.
43 wxDC
* FindSuitableBuffer( const wxRect
& forArea
);
45 // Allocates a suitable buffer.
47 wxDC
* AllocNewBuffer( const wxRect
& forArea
);
49 // Gets the window device context.
53 // Gets the client device context.
58 // Default constructor.
60 cbAntiflickerPlugin(void);
62 // Constructor taking frame layout panel, and pane mask.
64 cbAntiflickerPlugin( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
);
68 virtual ~cbAntiflickerPlugin();
70 // Handler for plugin event.
72 void OnStartDrawInArea ( cbStartDrawInAreaEvent
& event
);
74 // Handler for plugin event.
76 void OnFinishDrawInArea( cbFinishDrawInAreaEvent
& event
);
81 #endif /* __ANTIFLICKPL_G__ */