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 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "antiflickpl.h"
19 #include "wx/fl/controlbar.h"
22 Implements double-buffering to reduce flicker.
23 Bitmap and memory DC buffers are shared 'resources' among all instances of
24 antiflicker plugins within the application.
26 Locking for multithreaded applications is not yet implemented.
29 class WXDLLIMPEXP_FL cbAntiflickerPlugin
: public cbPluginBase
31 DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin
)
34 static wxBitmap
* mpVertBuf
;
35 static wxBitmap
* mpHorizBuf
;
36 static wxMemoryDC
* mpVertBufDc
;
37 static wxMemoryDC
* mpHorizBufDc
;
41 wxDC
* mpLRUBufDc
; // last-recently-used buffer
42 wxRect mLRUArea
; // last-recently-used area
45 // Finds a suitable buffer. Returns NULL if a suitable buffer is not present.
47 wxDC
* FindSuitableBuffer( const wxRect
& forArea
);
49 // Allocates a suitable buffer.
51 wxDC
* AllocNewBuffer( const wxRect
& forArea
);
53 // Gets the window device context.
57 // Gets the client device context.
62 // Default constructor.
64 cbAntiflickerPlugin(void);
66 // Constructor taking frame layout panel, and pane mask.
68 cbAntiflickerPlugin( wxFrameLayout
* pPanel
, int paneMask
= wxALL_PANES
);
72 virtual ~cbAntiflickerPlugin();
74 // Handler for plugin event.
76 void OnStartDrawInArea ( cbStartDrawInAreaEvent
& event
);
78 // Handler for plugin event.
80 void OnFinishDrawInArea( cbFinishDrawInAreaEvent
& event
);
85 #endif /* __ANTIFLICKPL_G__ */