]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/fl/antiflickpl.h
e8569aa6df794b177224a6586a44df1ed193070e
[wxWidgets.git] / contrib / include / wx / fl / antiflickpl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: antiflickpl.h
3 // Purpose: Double-buffering plugin class for reducing flicker
4 // Author: Aleksandras Gluchovas (@Lithuania)
5 // Modified by:
6 // Created: 23/10/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __ANTIFLICKPL_G__
13 #define __ANTIFLICKPL_G__
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "antiflickpl.h"
17 #endif
18
19 #include "wx/fl/controlbar.h"
20
21 /*
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.
25
26 Locking for multithreaded applications is not yet implemented.
27 */
28
29 class WXFL_DECLSPEC cbAntiflickerPlugin : public cbPluginBase
30 {
31 DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin )
32 protected:
33
34 static wxBitmap* mpVertBuf;
35 static wxBitmap* mpHorizBuf;
36 static wxMemoryDC* mpVertBufDc;
37 static wxMemoryDC* mpHorizBufDc;
38
39 static int mRefCount;
40
41 wxDC* mpLRUBufDc; // last-recently-used buffer
42 wxRect mLRUArea; // last-recently-used area
43
44 protected:
45 // Finds a suitable buffer. Returns NULL if a suitable buffer is not present.
46
47 wxDC* FindSuitableBuffer( const wxRect& forArea );
48
49 // Allocates a suitable buffer.
50
51 wxDC* AllocNewBuffer( const wxRect& forArea );
52
53 // Gets the window device context.
54
55 wxDC& GetWindowDC();
56
57 // Gets the client device context.
58
59 wxDC& GetClientDC();
60 public:
61
62 // Default constructor.
63
64 cbAntiflickerPlugin(void);
65
66 // Constructor taking frame layout panel, and pane mask.
67
68 cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
69
70 // Destructor.
71
72 virtual ~cbAntiflickerPlugin();
73
74 // Handler for plugin event.
75
76 void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
77
78 // Handler for plugin event.
79
80 void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event );
81
82 DECLARE_EVENT_TABLE()
83 };
84
85 #endif /* __ANTIFLICKPL_G__ */
86