1/////////////////////////////////////////////////////////////////////////////
2// Name:        rowlayoutpl.h
3// Purpose:     cbRowLayoutPlugin header.
4// Author:      Aleksandras Gluchovas
5// Modified by:
6// Created:     02/10/98
7// RCS-ID:      $Id: rowlayoutpl.h 35650 2005-09-23 12:56:45Z MR $
8// Copyright:   (c) Aleksandras Gluchovas
9// Licence:     wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __ROWLAYOUTPL_G__
13#define __ROWLAYOUTPL_G__
14
15#include "wx/fl/controlbar.h"
16
17/*
18Simple implementation of a plugin which handles row layout
19requests sent from a frame layout.
20*/
21
22class WXDLLIMPEXP_FL cbRowLayoutPlugin : public cbPluginBase
23{
24    DECLARE_DYNAMIC_CLASS( cbRowLayoutPlugin )
25protected:
26    cbDockPane* mpPane; // is set up temporarily, while handling event
27protected:
28
29        // Internal helper relating to not-fixed-bars layout.
30    void FitBarsToRange( int from, int till, cbBarInfo* pTheBar, cbRowInfo* pRow );
31
32        // Internal helper relating to not-fixed-bars layout.
33    void RelayoutNotFixedBarsAround( cbBarInfo* pTheBar, cbRowInfo* pRow );
34
35        // Internal helper relating to not-fixed-bars layout.
36    void MinimzeNotFixedBars( cbRowInfo* pRow, cbBarInfo* pBarToPreserve );
37
38        // Internal helper relating to not-fixed-bars layout.
39    int  GetRowFreeSpace( cbRowInfo* pRow );
40
41
42        // Internal helper relating to not-fixed-bars layout.
43    void RecalcLengthRatios( cbRowInfo* pRow );
44
45        // Internal helper relating to not-fixed-bars layout.
46    void ApplyLengthRatios( cbRowInfo* pRow );
47
48        // Internal helper relating to not-fixed-bars layout.
49    void ExpandNotFixedBars( cbRowInfo* pRow );
50
51        // Internal helper relating to not-fixed-bars layout.
52    void AdjustLengthOfInserted( cbRowInfo* pRow, cbBarInfo* pTheBar );
53
54
55        // Internal helper relating to not-fixed-bars layout.
56    void DetectBarHandles( cbRowInfo* pRow );
57
58        // Internal helper relating to not-fixed-bars layout.
59    void CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& rowInfo );
60
61
62        // Row layout helper simulating bar 'friction'.
63    int  CalcRowHeight( cbRowInfo& row );
64
65        // Row layout helper simulating bar 'friction'.
66    void LayoutItemsVertically( cbRowInfo& row );
67
68
69        // Row layout helper simulating bar 'friction'.
70    void StickRightSideBars( cbBarInfo* pToBar );
71
72
73        // Row layout helper simulating bar 'friction'.
74    void SlideLeftSideBars ( cbBarInfo* pTheBar );
75
76        // Row layout helper simulating bar 'friction'.
77    void SlideRightSideBars( cbBarInfo* pTheBar );
78
79
80        // Row layout helper simulating bar 'friction'.
81    void ShiftLeftTrashold ( cbBarInfo* pTheBar, cbRowInfo& row );
82
83        // Row layout helper simulating bar 'friction'.
84    void ShiftRightTrashold( cbBarInfo* pTheBar, cbRowInfo& row );
85
86
87        // Insert the bar before the given row.
88    void InsertBefore( cbBarInfo* pBeforeBar,
89                       cbBarInfo* pTheBar,
90                       cbRowInfo& row
91                     );
92
93        // Insert the bar before the given row.
94    void DoInsertBar( cbBarInfo* pTheBar, cbRowInfo& row );
95
96public:
97        // Default constructor.
98    cbRowLayoutPlugin(void);
99
100        // Constructor taking frame layout pane and pane mask.
101    cbRowLayoutPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
102
103        // Responds to row resize event.
104    void OnResizeRow ( cbResizeRowEvent&  event );
105
106        // Responds to bar insertion event.
107    void OnInsertBar ( cbInsertBarEvent&  event );
108
109        // Responds to bar removal event.
110    void OnRemoveBar ( cbRemoveBarEvent&  event );
111
112        // Responds to row layout event.
113    void OnLayoutRow ( cbLayoutRowEvent&  event );
114
115        // Responds to rows layout event.
116    void OnLayoutRows( cbLayoutRowsEvent& event );
117
118    DECLARE_EVENT_TABLE()
119};
120
121#endif /* __ROWLAYOUTPL_G__ */
122
123