libyui  3.0.5
 All Classes Functions Variables Enumerations Friends
YImage.cc
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YImage.cc
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 
26 #include "YImage.h"
27 #include "YBothDim.h"
28 
29 
31 {
32  /**
33  * Constructor.
34  **/
35  YImagePrivate( const std::string & imageFileName, bool animated )
36  : imageFileName( imageFileName )
37  , animated( animated )
38  , autoScale( false )
39  {
40  zeroSize.hor = false;
41  zeroSize.vert = false;
42  }
43 
44 
45  std::string imageFileName;
46  bool animated;
47  YBothDim<bool> zeroSize;
48  bool autoScale;
49 };
50 
51 
52 
53 
55  const std::string & imageFileName,
56  bool animated )
57  : YWidget( parent )
58  , priv( new YImagePrivate( imageFileName, animated ) )
59 {
60  YUI_CHECK_NEW( priv );
61 }
62 
63 
65 {
66  // NOP
67 }
68 
69 
70 std::string YImage::imageFileName() const
71 {
72  return priv->imageFileName;
73 }
74 
75 
76 bool YImage::animated() const
77 {
78  return priv->animated;
79 }
80 
81 
82 void YImage::setImage( const std::string & imageFileName, bool animated )
83 {
84  priv->imageFileName = imageFileName;
85  priv->animated = animated;
86 }
87 
88 
89 bool YImage::hasZeroSize( YUIDimension dim ) const
90 {
91  return priv->zeroSize[ dim ];
92 }
93 
94 
95 void YImage::setZeroSize( YUIDimension dim, bool zeroSize )
96 {
97  priv->zeroSize[ dim ] = zeroSize;
98  setStretchable( dim, zeroSize );
99 }
100 
101 
102 bool YImage::autoScale() const
103 {
104  return priv->autoScale;
105 }
106 
107 
108 void YImage::setAutoScale( bool autoScale )
109 {
110  priv->autoScale = autoScale;
111 }