]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/fl/gcupdatesmgr.h
Removed leaks from Forty demo
[wxWidgets.git] / contrib / include / wx / fl / gcupdatesmgr.h
CommitLineData
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
25This class implements optimized logic for refreshing
26the areas of frame layout that actually need to be updated.
27It is used as the default updates manager by wxFrameLayout.
28
29It is called 'Garbage Collecting' updates manager because
30its implementation tries to find out dependencies between bars,
31and to order them into a 'hierarchy'. This hierarchical sorting resembles
32the implementation of heap-garbage collectors, which resolve
33dependencies between references.
34
35Example: there are situations where the order in which the user
36moves 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
51Past/future positions of A and B windows completely overlap, i.e.
52depend on each other, and there is no solution for
53moving the windows without refreshing both of them
54-- we have a cyclic dependency here. The garbage collection algorithm will
55find 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
76In this case past/future positions do not overlap, so
77it is enough only to move windows without refreshing them.
78Garbage collection will 'notice' this.
79
80There is also a third case, when overlapping is partial.
81In this case the refreshing can also be avoided by
82moving windows in the order of 'most-dependant' towards the
83'least-dependent'. GC handles this automatically, by
84sorting windows by their dependency-level (or 'hierarchy').
85
86See garbagec.h for more details of this method; garbagec.h/cpp
87implement sorting of generic dependencies and does not deal
88with graphical objects directly.
89
90Summary: garbage collection improves performance when complex or large
91windows are moved around, by reducing the number of repaints. It also helps
92to avoid dirty non-client areas of moved windows
93in some special cases of 'overlapping anomalies'.
94*/
8e08b761
JS
95
96class cbGCUpdatesMgr : public cbSimpleUpdatesMgr
97{
4cbc57f0 98 DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr )
8e08b761
JS
99protected:
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
113public:
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