]>
Commit | Line | Data |
---|---|---|
499b2ed8 JS |
1 | \chapter{Introduction}\label{introduction} |
2 | \pagenumbering{arabic}% | |
3 | \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% | |
4 | \setfooter{\thepage}{}{}{}{}{\thepage}% | |
5 | ||
4805d825 | 6 | \section{What is FL?}\label{whatisfl} |
499b2ed8 JS |
7 | |
8 | This manual describes FL (Frame Layout), a | |
9 | class library for managing sophisticated window layout, | |
4805d825 JS |
10 | with panes that can be moved around the main window |
11 | and customized. FL handles many decoration and dragging | |
12 | issues, giving applications the kind of docking facilities | |
13 | that Visual C++ and Netscape Navigator possess. | |
14 | ||
15 | The following screenshot (from fl\_demo1) shows a frame with a number of | |
16 | bars that can be dragged around. The vertical grippers with | |
17 | two lines allow a bar to be dragged in that row, changing the | |
18 | ordering of the bar if necessary. | |
19 | The dotted grippers (as in Netscape Navigator) allow | |
20 | a whole row to be moved, again changing the position of the row | |
21 | if required. While moving a bar or row, immediate feedback | |
22 | is given as the moving bar displaces other bars. | |
23 | ||
24 | Other features: the splitter bar shows a dotted thick line as | |
25 | it's dragged. Single-clicking on a row handle minimizes it to | |
26 | a horizontal tab which is given its own narrow row. This allows | |
27 | the user to temporarily hide a row whilst allowing quick access | |
28 | to it when required. | |
29 | ||
30 | A close button (x) hides a bar completely. You can get it back again | |
31 | by right-clicking and selecting the appropriate menu item. | |
32 | ||
33 | A left or right pointing arrow button expands the pane in that direction. | |
34 | ||
35 | \center{\image{}{screen01.bmp}} | |
36 | ||
37 | \section{Compiling and using FL} | |
38 | ||
39 | FL can be found under the 'contrib' hierarchy, in the following directories: | |
40 | ||
41 | \begin{verbatim} | |
42 | contrib/src/fl | |
43 | contrib/include/wx/fl | |
44 | contrib/samples/fl | |
45 | contrib/docs/latex/wx | |
46 | docs/html/fl | |
47 | docs/htmlhelp/fl.chm | |
48 | docs/pdf/fl.pdf | |
49 | docs/winhelp/fl.hlp | |
50 | \end{verbatim} | |
51 | ||
52 | To compile FL: | |
53 | ||
54 | \begin{itemize}\itemsep=0pt | |
55 | \item Under Windows using VC++, open the flVC.dsw project | |
56 | and compile. | |
57 | \item Under Unix, FL should be configured when you configured | |
58 | wxWindows. Make FL by changing directory to contrib/src/fl and | |
59 | type 'make'. | |
60 | \end{itemize} | |
61 | ||
62 | To use FL: | |
63 | ||
64 | \begin{itemize}\itemsep=0pt | |
65 | \item Under Windows using VC++, link with fl[d].lib. | |
66 | \item Under Unix, link with libfl[d].a. | |
67 | \end{itemize} | |
68 | ||
69 | \section{FL concepts} | |
70 | ||
71 | The following is taken from fl\_demo1 and shows the main code implementing the | |
72 | user interface as illustrated in \helpref{What is FL?}{whatisfl}. | |
73 | ||
74 | Notable points in the code: | |
75 | ||
76 | \begin{itemize}\itemsep=0pt | |
77 | \item creating a new \helpref{wxFrameLayout}{wxframelayout} passing the top-level frame and the window that | |
78 | is interpreted as the main 'client' window; | |
79 | \item setting an updates manager for optimizing drag operations; | |
80 | \item adding plugins for implementing various features; | |
81 | \item adding bars; | |
82 | \item enabling floating mode. | |
83 | \end{itemize} | |
84 | ||
85 | \begin{verbatim} | |
86 | MyFrame::MyFrame(wxFrame *frame) | |
87 | : wxFrame( frame, -1, "wxWindows 2.0 wxFrameLayout Test Application", wxDefaultPosition, | |
88 | wxSize( 700, 500 ), | |
89 | wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | | |
90 | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION, | |
91 | "freimas" ) | |
92 | { | |
93 | mpClientWnd = CreateTextCtrl( "Client window" ); | |
94 | ||
95 | mpLayout = new wxFrameLayout( this, mpClientWnd ); | |
96 | ||
97 | mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() ); | |
98 | ||
99 | // setup plugins for testing | |
100 | mpLayout->PushDefaultPlugins(); | |
101 | ||
102 | mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // fancy "X"es and bevel for bars | |
103 | mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); | |
104 | mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) ); | |
105 | mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) ); | |
106 | mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) ); | |
107 | ||
108 | // drop in some bars | |
109 | cbDimInfo sizes0( 200,45, // when docked horizontally | |
110 | 200,85, // when docked vertically | |
111 | 175,35, // when floated | |
112 | FALSE, // the bar is not fixed-size | |
113 | 4, // vertical gap (bar border) | |
114 | 4 // horizontal gap (bar border) | |
115 | ); | |
116 | ||
117 | cbDimInfo sizes1( 150,35, // when docked horizontally | |
118 | 150,85, // when docked vertically | |
119 | 175,35, // when floated | |
120 | TRUE, // the bar is not fixed-size | |
121 | 4, // vertical gap (bar border) | |
122 | 4 // horizontal gap (bar border) | |
123 | ); | |
124 | ||
125 | cbDimInfo sizes2( 175,45, // when docked horizontally | |
126 | 175,37, // when docked vertically | |
127 | 170,35, // when floated | |
128 | TRUE, // the bar is not fixed-size | |
129 | 4, // vertical gap (bar border) | |
130 | 4, // horizontal gap (bar border) | |
131 | new cbDynToolBarDimHandler() | |
132 | ); | |
133 | ||
134 | mpLayout->AddBar( CreateTextCtrl("Hello"), // bar window | |
135 | sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) | |
136 | 0, // insert into 0th row (vert. position) | |
137 | 0, // offset from the start of row (in pixels) | |
138 | "InfoViewer1", // name to refere in customization pop-ups | |
139 | TRUE | |
140 | ); | |
141 | ||
142 | mpLayout->AddBar( CreateTextCtrl("Bye"), // bar window | |
143 | sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) | |
144 | 1, // insert into 0th row (vert. position) | |
145 | 0, // offset from the start of row (in pixels) | |
146 | "InfoViewer2", // name to refere in customization pop-ups | |
147 | TRUE | |
148 | ); | |
149 | ||
150 | mpLayout->AddBar( CreateTextCtrl("Fixed0"), // bar window | |
151 | sizes1, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) | |
152 | 0, // insert into 0th row (vert. position) | |
153 | 0, // offset from the start of row (in pixels) | |
154 | "ToolBar1", // name to refer in customization pop-ups | |
155 | TRUE | |
156 | ); | |
157 | ||
158 | wxDynamicToolBar* pToolBar = new wxDynamicToolBar(); | |
159 | ||
160 | pToolBar->Create( this, -1 ); | |
161 | ||
162 | // 1001-1006 ids of command events fired by added tool-buttons | |
163 | ||
164 | pToolBar->AddTool( 1001, BMP_DIR "new.bmp" ); | |
165 | pToolBar->AddTool( 1002, BMP_DIR "open.bmp" ); | |
166 | pToolBar->AddTool( 1003, BMP_DIR "save.bmp" ); | |
167 | ||
168 | pToolBar->AddTool( 1004, BMP_DIR "cut.bmp" ); | |
169 | pToolBar->AddTool( 1005, BMP_DIR "copy.bmp" ); | |
170 | pToolBar->AddTool( 1006, BMP_DIR "paste.bmp" ); | |
171 | ||
172 | mpLayout->AddBar( pToolBar, // bar window (can be NULL) | |
173 | sizes2, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc) | |
174 | 0, // insert into 0th row (vert. position) | |
175 | 0, // offset from the start of row (in pixels) | |
176 | "ToolBar2", // name to refere in customization pop-ups | |
177 | FALSE | |
178 | ); | |
179 | ||
180 | mpLayout->EnableFloating( TRUE ); // off, thinking about wxGtk... | |
181 | } | |
182 | \end{verbatim} | |
183 | ||
184 | ||
499b2ed8 | 185 |