src/hbwidgets/itemviews/hbgridlayout_p.h
changeset 0 16d8024aca5e
child 1 f7ac710697a9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 
       
     2 /****************************************************************************
       
     3 **
       
     4 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     5 ** All rights reserved.
       
     6 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     7 **
       
     8 ** This file is part of the HbWidgets module of the UI Extensions for Mobile.
       
     9 **
       
    10 ** GNU Lesser General Public License Usage
       
    11 ** This file may be used under the terms of the GNU Lesser General Public
       
    12 ** License version 2.1 as published by the Free Software Foundation and
       
    13 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    14 ** Please review the following information to ensure the GNU Lesser General
       
    15 ** Public License version 2.1 requirements will be met:
       
    16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    17 **
       
    18 ** In addition, as a special exception, Nokia gives you certain additional
       
    19 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    21 **
       
    22 ** If you have questions regarding the use of this file, please contact
       
    23 ** Nokia at developer.feedback@nokia.com.
       
    24 **
       
    25 ****************************************************************************/
       
    26 
       
    27 #ifndef HBGRIDLAYOUT_P_H
       
    28 #define HBGRIDLAYOUT_P_H
       
    29 
       
    30 #include <QObject>
       
    31 #include <QGraphicsLayout>
       
    32 
       
    33 #include <hbeffect.h>
       
    34 #include <hbglobal.h>
       
    35 
       
    36 class HbGridLayoutPrivate;
       
    37 
       
    38 class HB_AUTOTEST_EXPORT HbGridLayout : public QObject, public QGraphicsLayout
       
    39 {
       
    40     Q_OBJECT
       
    41     Q_ENUMS(layoutDirection)
       
    42     Q_INTERFACES(QGraphicsLayout)
       
    43 
       
    44     Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
       
    45 
       
    46 public:
       
    47 
       
    48     enum AnimationType {
       
    49         RemoveAnimation,
       
    50         InsertAnimation
       
    51     };
       
    52 
       
    53     HbGridLayout( QGraphicsLayoutItem *parent = 0 );
       
    54     virtual ~HbGridLayout( );
       
    55     
       
    56     void addItem(QGraphicsLayoutItem *item);
       
    57     void insertItem(int index, QGraphicsLayoutItem *item, bool animate);
       
    58     void removeItem(QGraphicsLayoutItem *item, bool animate);
       
    59 
       
    60     int indexOf(QGraphicsLayoutItem *item) const;
       
    61     QGraphicsLayoutItem *itemAt(int i) const;
       
    62 
       
    63     void setSize(const QSizeF &size,int &targetCount);
       
    64 
       
    65     void setScrollDirection(Qt::Orientations scrollDirection);
       
    66     Qt::Orientations scrollDirection() const;
       
    67 
       
    68     void setMargins(qreal topMargin, qreal bottomMargin, qreal leftMargin, qreal rightMargin);
       
    69     qreal spacing() const;
       
    70     void setSpacing(qreal spacing);
       
    71 
       
    72     void setRowCount(int rowCount);
       
    73     int rowCount() const;
       
    74 
       
    75     void setColumnCount(int columnCount);    
       
    76     int columnCount() const;
       
    77 
       
    78     int count() const;
       
    79 
       
    80     void setRecycling(bool enableRecycling);
       
    81     bool isRecyclingEnabled();
       
    82 
       
    83     void moveItem(QGraphicsLayoutItem *item, int targetIndex, bool animate = false);
       
    84 
       
    85     void recycleItems(QGraphicsLayoutItem *sourceItem, QGraphicsLayoutItem *targetItem);
       
    86 
       
    87     bool isAnimated(QGraphicsLayoutItem *item) const;
       
    88 
       
    89     virtual void removeAt(int index);
       
    90     virtual void setGeometry(const QRectF &rect);
       
    91     virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
       
    92     virtual void invalidate();
       
    93 
       
    94 signals:
       
    95 
       
    96     void animationFinished(QGraphicsLayoutItem *item, HbGridLayout::AnimationType animationType);
       
    97 
       
    98 protected slots:
       
    99 
       
   100     void effectFinished(const HbEffect::EffectStatus &status);
       
   101 
       
   102 protected:
       
   103     HbGridLayout( HbGridLayoutPrivate &dd, QGraphicsLayoutItem *parent = 0 );
       
   104     HbGridLayoutPrivate * const d_ptr;
       
   105 
       
   106 private:
       
   107     Q_DECLARE_PRIVATE_D( d_ptr, HbGridLayout )
       
   108     Q_DISABLE_COPY( HbGridLayout )
       
   109     Q_PRIVATE_SLOT(d_func(), void _q_timerUpdate())
       
   110 };
       
   111 
       
   112 #endif // HBGRIDLAYOUT_P_H
       
   113