source: trunk/demos/embedded/fluidlauncher/pictureflow.h@ 846

Last change on this file since 846 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 6.6 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the ActiveQt framework of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:BSD$
10** You may use this file under the terms of the BSD license as follows:
11**
12** "Redistribution and use in source and binary forms, with or without
13** modification, are permitted provided that the following conditions are
14** met:
15** * Redistributions of source code must retain the above copyright
16** notice, this list of conditions and the following disclaimer.
17** * Redistributions in binary form must reproduce the above copyright
18** notice, this list of conditions and the following disclaimer in
19** the documentation and/or other materials provided with the
20** distribution.
21** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22** the names of its contributors may be used to endorse or promote
23** products derived from this software without specific prior written
24** permission.
25**
26** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37** $QT_END_LICENSE$
38**
39**
40****************************************************************************/
41
42/*
43 ORIGINAL COPYRIGHT HEADER
44 PictureFlow - animated image show widget
45 http://pictureflow.googlecode.com
46
47 Copyright (C) 2007 Ariya Hidayat ([email protected])
48
49 Permission is hereby granted, free of charge, to any person obtaining a copy
50 of this software and associated documentation files (the "Software"), to deal
51 in the Software without restriction, including without limitation the rights
52 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53 copies of the Software, and to permit persons to whom the Software is
54 furnished to do so, subject to the following conditions:
55
56 The above copyright notice and this permission notice shall be included in
57 all copies or substantial portions of the Software.
58
59 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
65 THE SOFTWARE.
66*/
67
68#ifndef PICTUREFLOW_H
69#define PICTUREFLOW_H
70
71#include <QWidget>
72
73class PictureFlowPrivate;
74
75/*!
76 Class PictureFlow implements an image show widget with animation effect
77 like Apple's CoverFlow (in iTunes and iPod). Images are arranged in form
78 of slides, one main slide is shown at the center with few slides on
79 the left and right sides of the center slide. When the next or previous
80 slide is brought to the front, the whole slides flow to the right or
81 the right with smooth animation effect; until the new slide is finally
82 placed at the center.
83
84 */
85class PictureFlow : public QWidget
86{
87Q_OBJECT
88
89 Q_PROPERTY(int slideCount READ slideCount WRITE setSlideCount)
90 Q_PROPERTY(int currentSlide READ currentSlide WRITE setCurrentSlide)
91 Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize)
92 Q_PROPERTY(int zoomFactor READ zoomFactor WRITE setZoomFactor)
93
94public:
95 /*!
96 Creates a new PictureFlow widget.
97 */
98 PictureFlow(QWidget* parent = 0);
99
100 /*!
101 Destroys the widget.
102 */
103 ~PictureFlow();
104
105 /*!
106 Returns the total number of slides.
107 */
108 int slideCount() const;
109
110 /*!
111 Sets the total number of slides.
112 */
113 void setSlideCount(int count);
114
115 /*!
116 Returns the dimension of each slide (in pixels).
117 */
118 QSize slideSize() const;
119
120 /*!
121 Sets the dimension of each slide (in pixels).
122 */
123 void setSlideSize(QSize size);
124
125 /*!
126 Sets the zoom factor (in percent).
127 */
128 void setZoomFactor(int zoom);
129
130 /*!
131 Returns the zoom factor (in percent).
132 */
133 int zoomFactor() const;
134
135 /*!
136 Clears any caches held to free up memory
137 */
138 void clearCaches();
139
140 /*!
141 Returns QImage of specified slide.
142 This function will be called only whenever necessary, e.g. the 100th slide
143 will not be retrived when only the first few slides are visible.
144 */
145 virtual QImage slide(int index) const;
146
147 /*!
148 Sets an image for specified slide. If the slide already exists,
149 it will be replaced.
150 */
151 virtual void setSlide(int index, const QImage& image);
152
153 virtual void setSlideCaption(int index, QString caption);
154