]> git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/gcupdatesmgr.h
Allowed MSW wxTrextCtrl styling to also set the background colour,
[wxWidgets.git] / utils / framelayout / src / gcupdatesmgr.h
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 #include "controlbar.h"
16 #include "updatesmgr.h"
17
18 #include "garbagec.h"
19
20 /*
21 * class implements optimized logic for refreshing
22 * areas of frame layout - which actually need to be updated.
23 * Is used as default updates-manager by wxFrameLayout.
24 *
25 * it is called "Garbage Collecting" u.mgr for it's impelmentation
26 * tries to find out dependencies between bars, and to order
27 * them ito "hierarchy", this hierarchical sorting resembles
28 * impelmenation of heap-garbage collectors, which resolve
29 * dependencies between referencs.
30 *
31 * Example: there are situations where the order of moving
32 * the windows does matter:
33 *
34 * case 1)
35 * ------ ---
36 * | A | |B|
37 * ------ ---> | |
38 * --- --- ------
39 * |B| | A |
40 * | | ------
41 * ---
42 * (future)
43 * (past)
44 *
45 * past/future positions of A and B windows completely overlapp, i.e.
46 * depend on each other, and there is not solution for
47 * moving the windows witout refereshing both of them,
48 * -- we have cyclic dependency here. The gc. alg will
49 * find this cyclic dependecy and will force "refresh"
50 * after movement.
51 *
52 * case 2)
53 *
54 * ------
55 * | A |
56 * ------ --->
57 * ---
58 * |B| ------
59 * | | | A |
60 * --- ------
61 * ---
62 * |B|
63 * | |
64 * ---
65 *
66 * (future)
67 * (past)
68 *
69 * in this case past/future positions do not overlapp, thus
70 * it's enough only to move windows, without refreshing them.
71 * GC will "notice" it.
72 *
73 * there is also third case, when overlapping is partial
74 * in this case the refershing can be also avoided by
75 * moving windows in the order of "most-dependant" towards the
76 * "least-dependent". GC handles this automatically, by
77 * sorting windows by their dependency-level (or "hierarchy")
78 *
79 * See garbagec.h for more details of this method, garbagec.h/cpp
80 * implement sorting of generic-depenencies (does not deal
81 * with graphical objects directly)
82 *
83 * Summary: improves performance when complex/large windows are
84 * moved around, by reducing number of repaints. Also helps
85 * to avoid dirty non-client areas of moved windows
86 * in some sepcal cases of "overlapping anomalies"
87 */
88
89 class cbGCUpdatesMgr : public cbSimpleUpdatesMgr
90 {
91 DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr )
92 protected:
93
94 GarbageCollector mGC;
95
96 void DoRepositionItems( wxList& items );
97
98 void AddItem( wxList& itemList,
99 cbBarInfo* pBar,
100 cbDockPane* pPane,
101 wxRect& curBounds,
102 wxRect& prevBounds );
103
104 public:
105
106 cbGCUpdatesMgr(void) {}
107
108 cbGCUpdatesMgr( wxFrameLayout* pPanel );
109
110 // notificiactions received from Frame Layout :
111
112 virtual void OnStartChanges();
113
114 // refreshes parts of the frame layout, which need an update
115 virtual void UpdateNow();
116 };
117
118 #endif