libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YImage.cc
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:         YImage.cc
00020 
00021   Author:       Stefan Hundhammer <sh@suse.de>
00022 
00023 /-*/
00024 
00025 
00026 #include "YImage.h"
00027 #include "YBothDim.h"
00028 
00029 
00030 struct YImagePrivate
00031 {
00032     /**
00033      * Constructor.
00034      **/
00035     YImagePrivate( const std::string & imageFileName, bool animated )
00036         : imageFileName( imageFileName )
00037         , animated( animated )
00038         , autoScale( false )
00039     {
00040         zeroSize.hor  = false;
00041         zeroSize.vert = false;
00042     }
00043 
00044 
00045     std::string         imageFileName;
00046     bool                animated;
00047     YBothDim<bool>      zeroSize;
00048     bool                autoScale;
00049 };
00050 
00051 
00052 
00053 
00054 YImage::YImage( YWidget *               parent,
00055                 const std::string &     imageFileName,
00056                 bool                    animated )
00057     : YWidget( parent )
00058     , priv( new YImagePrivate( imageFileName, animated ) )
00059 {
00060     YUI_CHECK_NEW( priv );
00061 }
00062 
00063 
00064 YImage::~YImage()
00065 {
00066     // NOP
00067 }
00068 
00069 
00070 std::string YImage::imageFileName() const
00071 {
00072     return priv->imageFileName;
00073 }
00074 
00075 
00076 bool YImage::animated() const
00077 {
00078     return priv->animated;
00079 }
00080 
00081 
00082 void YImage::setImage( const std::string & imageFileName, bool animated )
00083 {
00084     priv->imageFileName = imageFileName;
00085     priv->animated      = animated;
00086 }
00087 
00088 
00089 bool YImage::hasZeroSize( YUIDimension dim ) const
00090 {
00091     return priv->zeroSize[ dim ];
00092 }
00093 
00094 
00095 void YImage::setZeroSize( YUIDimension dim, bool zeroSize )
00096 {
00097     priv->zeroSize[ dim ] = zeroSize;
00098     setStretchable( dim, zeroSize );
00099 }
00100 
00101 
00102 bool YImage::autoScale() const
00103 {
00104     return priv->autoScale;
00105 }
00106 
00107 
00108 void YImage::setAutoScale( bool autoScale )
00109 {
00110     priv->autoScale = autoScale;
00111 }
 All Classes Functions Variables Enumerations Friends