wxWidgets/contrib/docs/latex/fl/body.tex
2002-01-22 22:37:13 +00:00

186 lines
7.3 KiB
TeX

\chapter{Introduction}\label{introduction}
\pagenumbering{arabic}%
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}%
\section{What is FL?}\label{whatisfl}
This manual describes FL (Frame Layout), a
class library for managing sophisticated window layout,
with panes that can be moved around the main window
and customized. FL handles many decoration and dragging
issues, giving applications the kind of docking facilities
that Visual C++ and Netscape Navigator possess.
The following screenshot (from fl\_demo1) shows a frame with a number of
bars that can be dragged around. The vertical grippers with
two lines allow a bar to be dragged in that row, changing the
ordering of the bar if necessary.
The dotted grippers (as in Netscape Navigator) allow
a whole row to be moved, again changing the position of the row
if required. While moving a bar or row, immediate feedback
is given as the moving bar displaces other bars.
Other features: the splitter bar shows a dotted thick line as
it's dragged. Single-clicking on a row handle minimizes it to
a horizontal tab which is given its own narrow row. This allows
the user to temporarily hide a row whilst allowing quick access
to it when required.
A close button (x) hides a bar completely. You can get it back again
by right-clicking and selecting the appropriate menu item.
A left or right pointing arrow button expands the pane in that direction.
\center{\image{}{screen01.bmp}}
\section{Compiling and using FL}
FL can be found under the 'contrib' hierarchy, in the following directories:
\begin{verbatim}
contrib/src/fl
contrib/include/wx/fl
contrib/samples/fl
contrib/docs/latex/wx
docs/html/fl
docs/htmlhelp/fl.chm
docs/pdf/fl.pdf
docs/winhelp/fl.hlp
\end{verbatim}
To compile FL:
\begin{itemize}\itemsep=0pt
\item Under Windows using VC++, open the flVC.dsw project
and compile.
\item Under Unix, FL should be configured when you configured
wxWindows. Make FL by changing directory to contrib/src/fl and
type 'make'.
\end{itemize}
To use FL:
\begin{itemize}\itemsep=0pt
\item Under Windows using VC++, link with fl[d].lib.
\item Under Unix, link with libfl[d].a.
\end{itemize}
\section{FL concepts}
The following is taken from fl\_demo1 and shows the main code implementing the
user interface as illustrated in \helpref{What is FL?}{whatisfl}.
Notable points in the code:
\begin{itemize}\itemsep=0pt
\item creating a new \helpref{wxFrameLayout}{wxframelayout} passing the top-level frame and the window that
is interpreted as the main 'client' window;
\item setting an updates manager for optimizing drag operations;
\item adding plugins for implementing various features;
\item adding bars;
\item enabling floating mode.
\end{itemize}
\begin{verbatim}
MyFrame::MyFrame(wxFrame *frame)
: wxFrame( frame, -1, "wxWindows 2.0 wxFrameLayout Test Application", wxDefaultPosition,
wxSize( 700, 500 ),
wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION,
"freimas" )
{
mpClientWnd = CreateTextCtrl( "Client window" );
mpLayout = new wxFrameLayout( this, mpClientWnd );
mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() );
// setup plugins for testing
mpLayout->PushDefaultPlugins();
mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // fancy "X"es and bevel for bars
mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) );
mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) );
// drop in some bars
cbDimInfo sizes0( 200,45, // when docked horizontally
200,85, // when docked vertically
175,35, // when floated
FALSE, // the bar is not fixed-size
4, // vertical gap (bar border)
4 // horizontal gap (bar border)
);
cbDimInfo sizes1( 150,35, // when docked horizontally
150,85, // when docked vertically
175,35, // when floated
TRUE, // the bar is not fixed-size
4, // vertical gap (bar border)
4 // horizontal gap (bar border)
);
cbDimInfo sizes2( 175,45, // when docked horizontally
175,37, // when docked vertically
170,35, // when floated
TRUE, // the bar is not fixed-size
4, // vertical gap (bar border)
4, // horizontal gap (bar border)
new cbDynToolBarDimHandler()
);
mpLayout->AddBar( CreateTextCtrl("Hello"), // bar window
sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"InfoViewer1", // name to refere in customization pop-ups
TRUE
);
mpLayout->AddBar( CreateTextCtrl("Bye"), // bar window
sizes0, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
1, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"InfoViewer2", // name to refere in customization pop-ups
TRUE
);
mpLayout->AddBar( CreateTextCtrl("Fixed0"), // bar window
sizes1, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"ToolBar1", // name to refer in customization pop-ups
TRUE
);
wxDynamicToolBar* pToolBar = new wxDynamicToolBar();
pToolBar->Create( this, -1 );
// 1001-1006 ids of command events fired by added tool-buttons
pToolBar->AddTool( 1001, BMP_DIR "new.bmp" );
pToolBar->AddTool( 1002, BMP_DIR "open.bmp" );
pToolBar->AddTool( 1003, BMP_DIR "save.bmp" );
pToolBar->AddTool( 1004, BMP_DIR "cut.bmp" );
pToolBar->AddTool( 1005, BMP_DIR "copy.bmp" );
pToolBar->AddTool( 1006, BMP_DIR "paste.bmp" );
mpLayout->AddBar( pToolBar, // bar window (can be NULL)
sizes2, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
0, // insert into 0th row (vert. position)
0, // offset from the start of row (in pixels)
"ToolBar2", // name to refere in customization pop-ups
FALSE
);
mpLayout->EnableFloating( TRUE ); // off, thinking about wxGtk...
}
\end{verbatim}