libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YSpacing.h
00001 /*
00002   Copyright (C) 2000-2012 Novell, Inc
00003   This library is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU Lesser General Public License as
00005   published by the Free Software Foundation; either version 2.1 of the
00006   License, or (at your option) version 3.0 of the License. This library
00007   is distributed in the hope that it will be useful, but WITHOUT ANY
00008   WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00009   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00010   License for more details. You should have received a copy of the GNU
00011   Lesser General Public License along with this library; if not, write
00012   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
00013   Floor, Boston, MA 02110-1301 USA
00014 */
00015 
00016 
00017 /*-/
00018 
00019   File:         YSpacing.h
00020 
00021   Author:       Stefan Hundhammer <sh@suse.de>
00022 
00023 /-*/
00024 
00025 #ifndef YSpacing_h
00026 #define YSpacing_h
00027 
00028 #include "YWidget.h"
00029 #include "ImplPtr.h"
00030 
00031 class YSpacingPrivate;
00032 
00033 
00034 /**
00035  * HSpacing, VSpacing, HStretch, VStretch
00036  **/
00037 class YSpacing: public YWidget
00038 {
00039 public:
00040 
00041     /**
00042      * Constructor.
00043      *
00044      * A Spacing/Stretch widget works only in one dimension ('dim') at the same
00045      * time. But it can be stretchable and have a size at the same time, in
00046      * which case the specified size acts very much like a minimal size - but
00047      * not exactly, since YLayoutBox will reduce Spacings first before other
00048      * widgets have to be resized below their preferred size.
00049      *
00050      * 'layoutUnits' is specified in abstract UI units where a main window
00051      * (800x600 pixels in the Qt UI) corresponds to a 80x25 window.
00052      **/
00053     YSpacing( YWidget *         parent,
00054               YUIDimension      dim,
00055               bool              stretchable     = false,
00056               YLayoutSize_t     layoutUnits     = 0.0 );
00057 
00058     /**
00059      * Destructor.
00060      **/
00061     virtual ~YSpacing();
00062 
00063     /**
00064      * Return a descriptive name of this widget class for logging,
00065      * debugging etc.
00066      **/
00067     virtual const char * widgetClass() const;
00068 
00069     /**
00070      * Return the primary dimension of this Spacing/Stretch,
00071      * i.e. the dimension in which it uses space or stretches.
00072      **/
00073     YUIDimension dimension() const;
00074 
00075     /**
00076      * Return the size in the primary dimension.
00077      *
00078      * This is the device dependent size (pixels or character cells), not the
00079      * abstract UI layout unit from the constructor.
00080      **/
00081     int size() const;
00082 
00083     /**
00084      * Return the size in the specified dimension.
00085      *
00086      * This is the device dependent size (pixels or character cells), not the
00087      * abstract UI layout unit from the constructor.
00088      **/
00089     int size( YUIDimension dim ) const;
00090 
00091     /**
00092      * Preferred width of the widget.
00093      *
00094      * Reimplemented from YWidget.
00095      **/
00096     virtual int preferredWidth();
00097 
00098     /**
00099      * Preferred height of the widget.
00100      *
00101      * Reimplemented from YWidget.
00102      **/
00103     virtual int preferredHeight();
00104 
00105 
00106 private:
00107 
00108     ImplPtr<YSpacingPrivate> priv;
00109 };
00110 
00111 
00112 typedef YSpacing YVSpacing;
00113 typedef YSpacing YHSpacing;
00114 typedef YSpacing YHStretch;
00115 typedef YSpacing YVStretch;
00116 
00117 
00118 #endif // YSpacing_h
 All Classes Functions Variables Enumerations Friends