~ubuntu-branches/ubuntu/precise/gwenview/precise-proposed

« back to all changes in this revision

Viewing changes to lib/slidecontainer.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20111215141754-z043hyx69dulbggf
Tags: upstream-4.7.90
ImportĀ upstreamĀ versionĀ 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define SLIDECONTAINER_H
22
22
 
23
23
// Qt
 
24
#include <QWeakPointer>
24
25
#include <QFrame>
25
 
#include <QTimeLine>
26
26
 
27
27
#include <lib/gwenviewlib_export.h>
28
28
 
29
 
namespace Gwenview {
 
29
class QPropertyAnimation;
30
30
 
 
31
namespace Gwenview
 
32
{
31
33
 
32
34
/**
33
35
 * This widget is design to contain one child widget, the "content" widget.
34
36
 * It will start hidden by default. Calling slideIn() will slide in the content
35
37
 * widget from the top border. Calling slideOut() will slide it out.
36
38
 */
37
 
class GWENVIEWLIB_EXPORT SlideContainer : public QFrame {
38
 
        Q_OBJECT
 
39
class GWENVIEWLIB_EXPORT SlideContainer : public QFrame
 
40
{
 
41
    Q_OBJECT
 
42
    Q_PROPERTY(int slideHeight READ slideHeight WRITE setSlideHeight)
39
43
public:
40
 
        SlideContainer(QWidget* parent = 0);
41
 
 
42
 
        /**
43
 
         * Returns the content widget
44
 
         */
45
 
        QWidget* content() const;
46
 
 
47
 
        /**
48
 
         * Defines the content widget
49
 
         */
50
 
        void setContent(QWidget* content);
51
 
 
52
 
        virtual QSize sizeHint() const;
53
 
 
54
 
        virtual QSize minimumSizeHint() const;
 
44
    SlideContainer(QWidget* parent = 0);
 
45
 
 
46
    /**
 
47
     * Returns the content widget
 
48
     */
 
49
    QWidget* content() const;
 
50
 
 
51
    /**
 
52
     * Defines the content widget
 
53
     */
 
54
    void setContent(QWidget* content);
 
55
 
 
56
    virtual QSize sizeHint() const;
 
57
 
 
58
    virtual QSize minimumSizeHint() const;
 
59
 
 
60
    int slideHeight() const;
 
61
 
 
62
    Q_INVOKABLE void setSlideHeight(int height);
55
63
 
56
64
public Q_SLOTS:
57
 
        /**
58
 
         * Slides the content widget in.
59
 
         * Calling it multiple times won't cause the animation to be replayed.
60
 
         */
61
 
        void slideIn();
 
65
    /**
 
66
     * Slides the content widget in.
 
67
     * Calling it multiple times won't cause the animation to be replayed.
 
68
     */
 
69
    void slideIn();
62
70
 
63
 
        /**
64
 
         * Slides the content widget out.
65
 
         * Calling it multiple times won't cause the animation to be replayed.
66
 
         */
67
 
        void slideOut();
 
71
    /**
 
72
     * Slides the content widget out.
 
73
     * Calling it multiple times won't cause the animation to be replayed.
 
74
     */
 
75
    void slideOut();
68
76
 
69
77
protected:
70
 
        void resizeEvent(QResizeEvent*);
71
 
        bool eventFilter(QObject*, QEvent*);
 
78
    void resizeEvent(QResizeEvent*);
 
79
    bool eventFilter(QObject*, QEvent* event);
72
80
 
73
81
private Q_SLOTS:
74
 
        void slotTimeLineChanged(qreal value);
75
 
        void slotTimeLineFinished();
 
82
    void slotSlidedOut();
76
83
 
77
84
private:
78
 
        QWidget* mContent;
79
 
        QTimeLine* mTimeLine;
 
85
    QWidget* mContent;
 
86
    QWeakPointer<QPropertyAnimation> mAnim;
 
87
    bool mSlidingOut;
 
88
 
 
89
    void adjustContentGeometry();
 
90
 
 
91
    void animTo(int height);
80
92
};
81
93
 
82
 
 
83
94
} /* namespace */
84
95
 
85
 
 
86
96
#endif /* SLIDECONTAINER_H */