slight improvement to the context view layout imo.
[amarok.git] / src / context / layouts / ContextLayout.h
blob54c0dca02a4a1298608e9acd34a32c59fb135313
1 /*
2 * Copyright 2007 by Robert Knight <robertknight@gmail.com>
3 * Copyright 2007 by Leo Franchi <lfranchi@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License
7 * as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef CONTEXT_LAYOUT_H
22 #define CONTEXT_LAYOUT_H
24 #include "amarok_export.h"
26 #include <plasma/layouts/layout.h>
28 namespace Context
31 /**
32 * A layout which lays items out left-to-right , top-to-bottom.
34 * This is similar to the layout of items in a QListView.
36 * Additionally, this class only lays items out width-wise and
37 * uses the items' heightForWidth for the heights
39 class AMAROK_EXPORT ContextLayout : public Plasma::Layout
41 public:
42 /** Construct a new flow layout with the specified parent. */
43 explicit ContextLayout(LayoutItem* parent);
44 virtual ~ContextLayout();
46 // reimplemented
47 virtual int count() const;
48 virtual void addItem(LayoutItem* item);
49 virtual void removeItem(LayoutItem* item);
50 virtual int indexOf(LayoutItem* item) const;
51 virtual LayoutItem* itemAt(int i) const;
52 virtual LayoutItem* takeAt(int i);
54 virtual QSizeF sizeHint() const;
55 virtual Qt::Orientations expandingDirections() const;
56 virtual void setColumnWidth( const qreal width );
57 virtual qreal columnWidth() const;
59 protected:
60 void relayout();
62 private:
63 class Private;
64 Private *const d;
69 #endif // __FLOWLAYOUT__