kde-extraapps/kdevplatform/sublime/ideallayout.h
2015-07-26 14:23:17 +03:00

90 lines
2.4 KiB
C++

/*
Copyright 2007 Roberto Raggi <roberto@kdevelop.org>
Copyright 2007 Hamish Rodda <rodda@kde.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef KDEVPLATFORM_SUBLIME_IDEALLAYOUT_H
#define KDEVPLATFORM_SUBLIME_IDEALLAYOUT_H
#include <QtGui/QLayout>
#include <QtCore/QMap>
#include <QtCore/QHash>
#include "sublimedefs.h"
#define IDEAL_LAYOUT_MARGIN 0
#define IDEAL_LAYOUT_SPACING 2
class KAction;
class KActionCollection;
namespace Sublime {
class IdealDockWidget;
class IdealButtonBarLayout: public QLayout
{
Q_OBJECT
public:
IdealButtonBarLayout(Qt::Orientation orientation, QWidget *parent = 0);
virtual ~IdealButtonBarLayout();
void setHeight(int height);
inline Qt::Orientation orientation() const;
virtual Qt::Orientations expandingDirections() const;
virtual QSize minimumSize() const;
virtual QSize sizeHint() const;
virtual void setGeometry(const QRect &rect);
virtual void addItem(QLayoutItem *item);
virtual QLayoutItem* itemAt(int index) const;
virtual QLayoutItem* takeAt(int index);
virtual int count() const;
virtual void invalidate();
protected:
int doVerticalLayout(const QRect &rect, bool updateGeometry = true) const;
int doHorizontalLayout(const QRect &rect, bool updateGeometry = true) const;
private:
QList<QLayoutItem *> _items;
Qt::Orientation _orientation;
int _height;
mutable bool m_minSizeDirty : 1;
mutable bool m_sizeHintDirty : 1;
mutable bool m_layoutDirty : 1;
mutable QSize m_min;
mutable QSize m_hint;
};
}
#endif