]>
Commit | Line | Data |
---|---|---|
8e08b761 | 1 | ///////////////////////////////////////////////////////////////////////////// |
4cbc57f0 JS |
2 | // Name: gcupdatesmgr.h |
3 | // Purpose: Header for cbGCUpdatesMgr class. | |
8e08b761 JS |
4 | // Author: Aleksandras Gluchovas |
5 | // Modified by: | |
6 | // Created: 19/10/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
4cbc57f0 | 9 | // Licence: wxWindows licence |
8e08b761 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __GCUPDATESMGR_G__ | |
13 | #define __GCUPDATESMGR_G__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "gcupdatesmgr.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | #include "wx/fl/updatesmgr.h" | |
21 | ||
22 | #include "wx/fl/garbagec.h" | |
23 | ||
24 | /* | |
4cbc57f0 JS |
25 | This class implements optimized logic for refreshing |
26 | the areas of frame layout that actually need to be updated. | |
27 | It is used as the default updates manager by wxFrameLayout. | |
28 | ||
29 | It is called 'Garbage Collecting' updates manager because | |
30 | its implementation tries to find out dependencies between bars, | |
31 | and to order them into a 'hierarchy'. This hierarchical sorting resembles | |
32 | the implementation of heap-garbage collectors, which resolve | |
33 | dependencies between references. | |
34 | ||
35 | Example: there are situations where the order in which the user | |
36 | moves windows does matter. | |
37 | ||
38 | \begin{verbatim} | |
39 | case 1) | |
40 | ------ --- | |
41 | | A | |B| | |
42 | ------ ---> | | | |
43 | --- --- ------ | |
44 | |B| | A | | |
45 | | | ------ | |
46 | --- | |
47 | (future) | |
48 | (past) | |
49 | \end{verbatim} | |
50 | ||
51 | Past/future positions of A and B windows completely overlap, i.e. | |
52 | depend on each other, and there is no solution for | |
53 | moving the windows without refreshing both of them | |
54 | -- we have a cyclic dependency here. The garbage collection algorithm will | |
55 | find this cyclic dependecy and will force refresh after movement. | |
56 | ||
57 | \begin{verbatim} | |
58 | case 2) | |
59 | ||
60 | ------ | |
61 | | A | | |
62 | ------ ---> | |
63 | --- | |
64 | |B| ------ | |
65 | | | | A | | |
66 | --- ------ | |
67 | --- | |
68 | |B| | |
69 | | | | |
70 | --- | |
71 | ||
72 | (future) | |
73 | (past) | |
74 | \end{verbatim} | |
75 | ||
76 | In this case past/future positions do not overlap, so | |
77 | it is enough only to move windows without refreshing them. | |
78 | Garbage collection will 'notice' this. | |
79 | ||
80 | There is also a third case, when overlapping is partial. | |
81 | In this case the refreshing can also be avoided by | |
82 | moving windows in the order of 'most-dependant' towards the | |
83 | 'least-dependent'. GC handles this automatically, by | |
84 | sorting windows by their dependency-level (or 'hierarchy'). | |
85 | ||
86 | See garbagec.h for more details of this method; garbagec.h/cpp | |
87 | implement sorting of generic dependencies and does not deal | |
88 | with graphical objects directly. | |
89 | ||
90 | Summary: garbage collection improves performance when complex or large | |
91 | windows are moved around, by reducing the number of repaints. It also helps | |
92 | to avoid dirty non-client areas of moved windows | |
93 | in some special cases of 'overlapping anomalies'. | |
94 | */ | |
8e08b761 JS |
95 | |
96 | class cbGCUpdatesMgr : public cbSimpleUpdatesMgr | |
97 | { | |
4cbc57f0 | 98 | DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr ) |
8e08b761 JS |
99 | protected: |
100 | ||
4cbc57f0 | 101 | GarbageCollector mGC; |
8e08b761 | 102 | |
4cbc57f0 JS |
103 | // Internal function for repositioning items. |
104 | void DoRepositionItems( wxList& items ); | |
8e08b761 | 105 | |
4cbc57f0 JS |
106 | // Internal function for repositioning items. |
107 | void AddItem( wxList& itemList, | |
108 | cbBarInfo* pBar, | |
109 | cbDockPane* pPane, | |
110 | wxRect& curBounds, | |
111 | wxRect& prevBounds ); | |
8e08b761 JS |
112 | |
113 | public: | |
114 | ||
4cbc57f0 JS |
115 | // Default constructor. |
116 | cbGCUpdatesMgr(void) {} | |
8e08b761 | 117 | |
4cbc57f0 JS |
118 | // Constructor, taking a frame layout. |
119 | cbGCUpdatesMgr( wxFrameLayout* pPanel ); | |
8e08b761 | 120 | |
4cbc57f0 JS |
121 | // Receives notifications from the frame layout. |
122 | virtual void OnStartChanges(); | |
8e08b761 | 123 | |
4cbc57f0 JS |
124 | // Refreshes the parts of the frame layout which need an update. |
125 | virtual void UpdateNow(); | |
8e08b761 JS |
126 | }; |
127 | ||
128 | #endif /* __GCUPDATESMGR_G__ */ | |
129 |