Xfce
Foundation Classes |
|||
« Main Page | Index | |||
FramesFrames can be used to enclose one
or more
widgets with a decorative box which can optionally be labeled. The
position of the
label and the style of the box can be altered to suit.
A Frame can be created with one of the following constructors: Frame(Gtk::ShadowType type =
Gtk::SHADOW_ETCHED_IN); The first constructor creates a
Frame with the
specified ShadowType, which by default is SHADOW_ETCHED_IN. The second
constructor additionally lets you specify a label for the frame. The
label is by default placed in the upper left hand corner of the frame.
The text of the label can be set or changed using this next method: void
set_label(const String& label); A label widget can be added later
by either
calling the set_label() method, in which case a label widget is created
for
you, or by specifically calling the next method followed by a call to
set_label() to set the label text.
void
set_label_widget(Widget& label_widget); The position of the label can be changed using this method: void
set_label_align(float xalign, float yalign); The 'xalign' and 'yalign' arguments take values between 0.0 and 1.0. xalign indicates the position of the label along the top horizontal of the frame. yalign indicates the vertical position with respect to the top horizontal of the frame - either above (0.0), below (1.0) or somewhere over it. The default value of xalign is 0.0 which places the label at the left hand end of the frame. The default value of yalign is 0.5 which places the middle of the label over the top horizontal of the frame. The next function alters the style of the box that is used to outline the frame. void
set_shadow_type(Gtk::ShadowType type); The 'type' argument can take one of the following values from the Gtk::ShadowType enum:
Frame ExampleThe following code example illustrates the use of the Frame widget. It creates a simple window that contains a frame with a label aligned to the left side on the top edge.The header file for the Frame example is
<frame.hh>:
#include <xfc/main.hh>
#include <xfc/gtk/window.hh> using namespace Xfc; class FrameWindow : public Gtk::Window { public: FrameWindow(); virtual ~FrameWindow(); }; and the source file is <frame.cc>: #include "frame.hh" Compiling Frame
If you compiled and installed XFC yourself, you will find the source
code for Frame in the
<examples/frame> source directory along with a Makefile. If
XFC came pre-installed, or you installed it from an RPM package, you
will
find the source code in the
</usr/share/doc/xfcui-X.X/examples/frame> subdirectory. In
this case you will have to create the Makefile yourself (replace X.X
with the
version number of the libXFCui library you have installed). |
Copyright © 2004-2005 The XFC Development Team | Top |
XFC
4.4 |