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