1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gcupdatesmgr.h
3 // Purpose: Header for cbGCUpdatesMgr class.
4 // Author: Aleksandras Gluchovas
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __GCUPDATESMGR_G__
13 #define __GCUPDATESMGR_G__
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "gcupdatesmgr.h"
19 #include "wx/fl/controlbar.h"
20 #include "wx/fl/updatesmgr.h"
22 #include "wx/fl/garbagec.h"
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.
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.
35 Example: there are situations where the order in which the user
36 moves windows does matter.
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.
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.
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').
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.
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'.
96 class WXDLLIMPEXP_FL cbGCUpdatesMgr
: public cbSimpleUpdatesMgr
98 DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr
)
101 GarbageCollector mGC
;
103 // Internal function for repositioning items.
104 void DoRepositionItems( wxList
& items
);
106 // Internal function for repositioning items.
107 void AddItem( wxList
& itemList
,
111 wxRect
& prevBounds
);
115 // Default constructor.
116 cbGCUpdatesMgr(void) {}
118 // Constructor, taking a frame layout.
119 cbGCUpdatesMgr( wxFrameLayout
* pPanel
);
121 // Receives notifications from the frame layout.
122 virtual void OnStartChanges();
124 // Refreshes the parts of the frame layout which need an update.
125 virtual void UpdateNow();
128 #endif /* __GCUPDATESMGR_G__ */