]>
Commit | Line | Data |
---|---|---|
8e08b761 | 1 | ///////////////////////////////////////////////////////////////////////////// |
e598303a JS |
2 | // Name: antiflickpl.h |
3 | // Purpose: Double-buffering plugin class for reducing flicker | |
8e08b761 JS |
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 license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __ANTIFLICKPL_G__ | |
13 | #define __ANTIFLICKPL_G__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "antiflickpl.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | ||
e598303a JS |
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 | ||
8e08b761 JS |
29 | class cbAntiflickerPlugin : public cbPluginBase |
30 | { | |
31 | DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin ) | |
32 | protected: | |
8e08b761 JS |
33 | |
34 | static wxBitmap* mpVertBuf; | |
35 | static wxBitmap* mpHorizBuf; | |
36 | static wxMemoryDC* mpVertBufDc; | |
37 | static wxMemoryDC* mpHorizBufDc; | |
38 | ||
39 | static int mRefCount; | |
40 | ||
e598303a JS |
41 | wxDC* mpLRUBufDc; // last-recently-used buffer |
42 | wxRect mLRUArea; // last-recently-used area | |
8e08b761 JS |
43 | |
44 | protected: | |
e598303a | 45 | // Finds a suitable buffer. Returns NULL if a suitable buffer is not present. |
8e08b761 | 46 | wxDC* FindSuitableBuffer( const wxRect& forArea ); |
e598303a | 47 | // Allocates a suitable buffer. |
8e08b761 | 48 | wxDC* AllocNewBuffer( const wxRect& forArea ); |
8e08b761 | 49 | |
e598303a | 50 | wxDC& GetWindowDC(); |
8e08b761 JS |
51 | wxDC& GetClientDC(); |
52 | public: | |
53 | ||
54 | cbAntiflickerPlugin(void); | |
55 | ||
56 | cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
57 | ||
58 | virtual ~cbAntiflickerPlugin(); | |
59 | ||
e598303a | 60 | // Handler for plugin event. |
8e08b761 | 61 | void OnStartDrawInArea ( cbStartDrawInAreaEvent& event ); |
e598303a JS |
62 | |
63 | // Handler for plugin event. | |
8e08b761 JS |
64 | void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event ); |
65 | ||
66 | DECLARE_EVENT_TABLE() | |
67 | }; | |
68 | ||
69 | #endif /* __ANTIFLICKPL_G__ */ | |
70 |