]>
Commit | Line | Data |
---|---|---|
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 | #include "wx/fl/controlbar.h" | |
16 | ||
17 | /* | |
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. | |
21 | ||
22 | Locking for multithreaded applications is not yet implemented. | |
23 | */ | |
24 | ||
25 | class WXDLLIMPEXP_FL cbAntiflickerPlugin : public cbPluginBase | |
26 | { | |
27 | DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin ) | |
28 | protected: | |
29 | ||
30 | static wxBitmap* mpVertBuf; | |
31 | static wxBitmap* mpHorizBuf; | |
32 | static wxMemoryDC* mpVertBufDc; | |
33 | static wxMemoryDC* mpHorizBufDc; | |
34 | ||
35 | static int mRefCount; | |
36 | ||
37 | wxDC* mpLRUBufDc; // last-recently-used buffer | |
38 | wxRect mLRUArea; // last-recently-used area | |
39 | ||
40 | protected: | |
41 | // Finds a suitable buffer. Returns NULL if a suitable buffer is not present. | |
42 | ||
43 | wxDC* FindSuitableBuffer( const wxRect& forArea ); | |
44 | ||
45 | // Allocates a suitable buffer. | |
46 | ||
47 | wxDC* AllocNewBuffer( const wxRect& forArea ); | |
48 | ||
49 | // Gets the window device context. | |
50 | ||
51 | wxDC& GetWindowDC(); | |
52 | ||
53 | // Gets the client device context. | |
54 | ||
55 | wxDC& GetClientDC(); | |
56 | public: | |
57 | ||
58 | // Default constructor. | |
59 | ||
60 | cbAntiflickerPlugin(void); | |
61 | ||
62 | // Constructor taking frame layout panel, and pane mask. | |
63 | ||
64 | cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
65 | ||
66 | // Destructor. | |
67 | ||
68 | virtual ~cbAntiflickerPlugin(); | |
69 | ||
70 | // Handler for plugin event. | |
71 | ||
72 | void OnStartDrawInArea ( cbStartDrawInAreaEvent& event ); | |
73 | ||
74 | // Handler for plugin event. | |
75 | ||
76 | void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event ); | |
77 | ||
78 | DECLARE_EVENT_TABLE() | |
79 | }; | |
80 | ||
81 | #endif /* __ANTIFLICKPL_G__ */ | |
82 |