QTfrontend/ui/widget/flowlayout.h
author unc0rr
Thu, 17 Jan 2013 23:17:39 +0400
changeset 8396 5123eac2f9d6
parent 8385 9e8924ff9813
permissions -rw-r--r--
- Pass unknown chat commands to server - Make server recognize /delegate command
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     1
 /****************************************************************************
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     2
 **
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     3
 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     4
 ** All rights reserved.
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     5
 ** Contact: Nokia Corporation (qt-info@nokia.com)
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     6
 **
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     7
 ** This file is part of the examples of the Qt Toolkit.
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     8
 **
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     9
 ** $QT_BEGIN_LICENSE:BSD$
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    10
 ** You may use this file under the terms of the BSD license as follows:
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    11
 **
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    12
 ** "Redistribution and use in source and binary forms, with or without
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    13
 ** modification, are permitted provided that the following conditions are
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    14
 ** met:
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    15
 **   * Redistributions of source code must retain the above copyright
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    16
 **     notice, this list of conditions and the following disclaimer.
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    17
 **   * Redistributions in binary form must reproduce the above copyright
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    18
 **     notice, this list of conditions and the following disclaimer in
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    19
 **     the documentation and/or other materials provided with the
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    20
 **     distribution.
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    21
 **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    22
 **     the names of its contributors may be used to endorse or promote
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    23
 **     products derived from this software without specific prior written
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    24
 **     permission.
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    25
 **
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    26
 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    27
 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    28
 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    29
 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    30
 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    31
 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    32
 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    33
 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    34
 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    35
 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    36
 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    37
 ** $QT_END_LICENSE$
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    38
 **
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    39
 ****************************************************************************/
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    40
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    41
 #ifndef FLOWLAYOUT_H
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    42
 #define FLOWLAYOUT_H
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    43
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    44
 #include <QLayout>
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    45
 #include <QRect>
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    46
 #include <QStyle>
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    47
 #include <QWidgetItem>
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    48
 class FlowLayout : public QLayout
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    49
 {
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    50
 public:
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    51
     FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    52
     FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    53
     ~FlowLayout();
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    54
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    55
     void addItem(QLayoutItem *item);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    56
     int horizontalSpacing() const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    57
     int verticalSpacing() const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    58
     Qt::Orientations expandingDirections() const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    59
     bool hasHeightForWidth() const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    60
     int heightForWidth(int) const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    61
     int count() const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    62
     QLayoutItem *itemAt(int index) const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    63
     QSize minimumSize() const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    64
     void setGeometry(const QRect &rect);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    65
     QSize sizeHint() const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    66
     QLayoutItem *takeAt(int index);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    67
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    68
 private:
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    69
     int doLayout(const QRect &rect, bool testOnly) const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    70
     int smartSpacing(QStyle::PixelMetric pm) const;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    71
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    72
     QList<QLayoutItem *> itemList;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    73
     int m_hSpace;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    74
     int m_vSpace;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    75
 };
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    76
8385
9e8924ff9813 Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents: 8377
diff changeset
    77
 #endif