]>
Commit | Line | Data |
---|---|---|
8e08b761 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: No names yet. | |
3 | // Purpose: Contrib. demo | |
4 | // Author: Aleksandras Gluchovas | |
5 | // Modified by: | |
6 | // Created: 19/10/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
9 | // Licence: wxWindows license | |
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 | /* | |
25 | * class implements optimized logic for refreshing | |
26 | * areas of frame layout - which actually need to be updated. | |
27 | * Is used as default updates-manager by wxFrameLayout. | |
28 | * | |
29 | * it is called "Garbage Collecting" u.mgr for it's implementation | |
30 | * tries to find out dependencies between bars, and to order | |
31 | * them ito "hierarchy", this hierarchical sorting resembles | |
32 | * implemenation of heap-garbage collectors, which resolve | |
33 | * dependencies between references. | |
34 | * | |
35 | * Example: there are situations where the order of moving | |
36 | * the windows does matter: | |
37 | * | |
38 | * case 1) | |
39 | * ------ --- | |
40 | * | A | |B| | |
41 | * ------ ---> | | | |
42 | * --- --- ------ | |
43 | * |B| | A | | |
44 | * | | ------ | |
45 | * --- | |
46 | * (future) | |
47 | * (past) | |
48 | * | |
49 | * past/future positions of A and B windows completely overlapp, i.e. | |
50 | * depend on each other, and there is not solution for | |
51 | * moving the windows witout refreshing both of them, | |
52 | * -- we have cyclic dependency here. The gc. alg will | |
53 | * find this cyclic dependecy and will force "refresh" | |
54 | * after movement. | |
55 | * | |
56 | * case 2) | |
57 | * | |
58 | * ------ | |
59 | * | A | | |
60 | * ------ ---> | |
61 | * --- | |
62 | * |B| ------ | |
63 | * | | | A | | |
64 | * --- ------ | |
65 | * --- | |
66 | * |B| | |
67 | * | | | |
68 | * --- | |
69 | * | |
70 | * (future) | |
71 | * (past) | |
72 | * | |
73 | * in this case past/future positions do not overlapp, thus | |
74 | * it's enough only to move windows, without refreshing them. | |
75 | * GC will "notice" it. | |
76 | * | |
77 | * there is also third case, when overlapping is partial | |
78 | * in this case the refershing can be also avoided by | |
79 | * moving windows in the order of "most-dependant" towards the | |
80 | * "least-dependent". GC handles this automatically, by | |
81 | * sorting windows by their dependency-level (or "hierarchy") | |
82 | * | |
83 | * See garbagec.h for more details of this method, garbagec.h/cpp | |
84 | * implement sorting of generic-dependencies (does not deal | |
85 | * with graphical objects directly) | |
86 | * | |
87 | * Summary: improves performance when complex/large windows are | |
88 | * moved around, by reducing number of repaints. Also helps | |
89 | * to avoid dirty non-client areas of moved windows | |
90 | * in some special cases of "overlapping anomalies" | |
91 | */ | |
92 | ||
93 | class cbGCUpdatesMgr : public cbSimpleUpdatesMgr | |
94 | { | |
95 | DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr ) | |
96 | protected: | |
97 | ||
98 | GarbageCollector mGC; | |
99 | ||
100 | void DoRepositionItems( wxList& items ); | |
101 | ||
102 | void AddItem( wxList& itemList, | |
103 | cbBarInfo* pBar, | |
104 | cbDockPane* pPane, | |
105 | wxRect& curBounds, | |
106 | wxRect& prevBounds ); | |
107 | ||
108 | public: | |
109 | ||
110 | cbGCUpdatesMgr(void) {} | |
111 | ||
112 | cbGCUpdatesMgr( wxFrameLayout* pPanel ); | |
113 | ||
114 | // notificiactions received from Frame Layout : | |
115 | ||
116 | virtual void OnStartChanges(); | |
117 | ||
118 | // refreshes parts of the frame layout, which need an update | |
119 | virtual void UpdateNow(); | |
120 | }; | |
121 | ||
122 | #endif /* __GCUPDATESMGR_G__ */ | |
123 |