libyui-qt  2.47.1.1
YQImage.h
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: YQImage.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQImage_h
27 #define YQImage_h
28 
29 #include <qlabel.h>
30 #include <qmovie.h>
31 
32 #include <yui/YImage.h>
33 #include <yui/YUI.h>
34 
35 
36 class YQImage : public QLabel, public YImage
37 {
38  Q_OBJECT
39 
40 public:
41  /**
42  * Constructor.
43  *
44  * 'animated' indicates if 'imageFileName' is an animated image format
45  * (e.g., MNG).
46  **/
47  YQImage( YWidget * parent,
48  const std::string & imageFileName,
49  bool animated = false );
50 
51  /**
52  * Destructor.
53  **/
54  virtual ~YQImage();
55 
56  /**
57  * Set and display a new image.
58  *
59  * Reimplemented from YImage.
60  **/
61  virtual void setImage( const std::string & imageFileName, bool animated = false );
62 
63  /**
64  * Make the image fit into the available space.
65  *
66  * Reimplemented from YImage.
67  **/
68  virtual void setAutoScale( bool autoScale = true );
69 
70  /**
71  * if false, the image will be displayed in gray
72  */
73  virtual void setEnabled( bool enabled );
74 
75  /**
76  * Preferred width of the widget.
77  *
78  * Reimplemented from YWidget.
79  **/
80  virtual int preferredWidth();
81 
82  /**
83  * Preferred height of the widget.
84  *
85  * Reimplemented from YWidget.
86  **/
87  virtual int preferredHeight();
88 
89  /**
90  * Set the new size of the widget.
91  *
92  * Reimplemented from YWidget.
93  **/
94  virtual void setSize( int newWidth, int newHeight );
95 
96 protected:
97 
98  int _pixmapWidth;
99  int _pixmapHeight;
100 };
101 
102 #endif // YQImage_h
virtual void setImage(const std::string &imageFileName, bool animated=false)
Set and display a new image.
Definition: YQImage.cc:63
virtual int preferredHeight()
Preferred height of the widget.
Definition: YQImage.cc:144
virtual void setAutoScale(bool autoScale=true)
Make the image fit into the available space.
Definition: YQImage.cc:109
YQImage(YWidget *parent, const std::string &imageFileName, bool animated=false)
Constructor.
Definition: YQImage.cc:39
virtual ~YQImage()
Destructor.
Definition: YQImage.cc:56
virtual void setEnabled(bool enabled)
if false, the image will be displayed in gray
Definition: YQImage.cc:171
virtual int preferredWidth()
Preferred width of the widget.
Definition: YQImage.cc:122
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
Definition: YQImage.cc:166