]> git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/rowlayoutpl.h
don't crash when invalid colour is set as fg/bg colour
[wxWidgets.git] / utils / framelayout / src / rowlayoutpl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: No names yet.
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 02/10/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __ROWLAYOUTPL_G__
13 #define __ROWLAYOUTPL_G__
14
15 #include "controlbar.h"
16
17 /*
18 * Simple implementaiton of plugin, which handles row-layouting
19 * requests sent from Frame Layout
20 */
21
22 class cbRowLayoutPlugin : public cbPluginBase
23 {
24 DECLARE_DYNAMIC_CLASS( cbRowLayoutPlugin )
25 protected:
26 cbDockPane* mpPane; // is set up temorarely, while handling event
27 protected:
28
29 // not-fixed-bars layouting related helpers
30
31 void FitBarsToRange( int from, int till, cbBarInfo* pTheBar, cbRowInfo* pRow );
32 void RelayoutNotFixedBarsAround( cbBarInfo* pTheBar, cbRowInfo* pRow );
33 void MinimzeNotFixedBars( cbRowInfo* pRow, cbBarInfo* pBarToPreserve );
34 int GetRowFreeSpace( cbRowInfo* pRow );
35
36 void RecalcLenghtRatios( cbRowInfo* pRow );
37 void ApplyLenghtRatios( cbRowInfo* pRow );
38 void ExpandNotFixedBars( cbRowInfo* pRow );
39 void AdjustLenghtOfInserted( cbRowInfo* pRow, cbBarInfo* pTheBar );
40
41 void DetectBarHandles( cbRowInfo* pRow );
42 void CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& rowInfo );
43
44
45 // row-layouting helpers (simulate "bar-friction")
46
47 int CalcRowHeight( cbRowInfo& row );
48 void LayoutItemsVertically( cbRowInfo& row );
49
50 void StickRightSideBars( cbBarInfo* pToBar );
51
52 void SlideLeftSideBars ( cbBarInfo* pTheBar );
53 void SlideRightSideBars( cbBarInfo* pTheBar );
54
55 void ShiftLeftTrashold ( cbBarInfo* pTheBar, cbRowInfo& row );
56 void ShiftRightTrashold( cbBarInfo* pTheBar, cbRowInfo& row );
57
58 void InsertBefore( cbBarInfo* pBeforeBar,
59 cbBarInfo* pTheBar,
60 cbRowInfo& row
61 );
62
63 void DoInsertBar( cbBarInfo* pTheBar, cbRowInfo& row );
64
65 public:
66
67 cbRowLayoutPlugin(void);
68
69 cbRowLayoutPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
70
71 // event handlers
72
73 void OnResizeRow ( cbResizeRowEvent& event );
74 void OnInsertBar ( cbInsertBarEvent& event );
75 void OnRemoveBar ( cbRemoveBarEvent& event );
76 void OnLayoutRow ( cbLayoutRowEvent& event );
77 void OnLayoutRows( cbLayoutRowsEvent& event );
78
79 DECLARE_EVENT_TABLE()
80 };
81
82 #endif