ListElements/ModelViewList/PLLayout.h
changeset 45 b23ec2b62c45
equal deleted inserted replaced
44:ca3ea89c80a3 45:b23ec2b62c45
       
     1 #ifndef PLLAYOUT_H
       
     2 #define PLLAYOUT_H
       
     3 
       
     4 #include <QLayout>
       
     5 #include <QResizeEvent>
       
     6 
       
     7 
       
     8 
       
     9 
       
    10 class PLLayout : public QLayout
       
    11 {
       
    12     Q_OBJECT
       
    13 
       
    14 public:
       
    15     PLLayout();
       
    16     ~PLLayout();
       
    17     //the main API methods
       
    18     int setLLayout(QLayout *clientlayout);
       
    19     int setPLayout(QLayout *clientlayout);
       
    20     void activatePLayout();
       
    21     void activateLLayout();
       
    22     //re-implementation of QLayout Methods, as needed
       
    23     void addItem(QLayoutItem *item);
       
    24     QSize sizeHint() const;
       
    25     QSize minimumSize() const;
       
    26     void setGeometry(const QRect &rect);
       
    27     bool hasHeightForWidth() const;
       
    28     int heightForWidth( int ) const;
       
    29     QLayoutItem * itemAt(int index ) const;
       
    30     QLayoutItem * takeAt ( int index );
       
    31     int count() const;
       
    32 
       
    33     //a convenience method for the parent widgets event handler
       
    34     void resizeEvent(QResizeEvent* event);
       
    35 
       
    36 protected:
       
    37     //these two may be promoted to public, when extending to more generic use cases
       
    38     void activateLayout(int idx);
       
    39     int newLayout(QLayout *clientlayout);
       
    40 
       
    41 private:
       
    42 
       
    43     QList<QLayout*> m_layoutList;
       
    44     int m_numOfClients;
       
    45     int m_currentLayoutIdx;
       
    46 
       
    47     int m_portraitLayoutIdx;
       
    48     int m_landscapeLayoutIdx;
       
    49     int getLayoutIdx()const ;
       
    50 
       
    51     bool m_hasPLayout;
       
    52     bool m_hasLLayout;
       
    53     bool m_isPLayout;
       
    54     bool m_isLLayout;
       
    55 
       
    56     void redrawParent();
       
    57 };
       
    58 
       
    59 #endif // PLLAYOUT_H