QCodeEdit  2.2
qpanellayout.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
4 **
5 ** This file is part of the Edyuk project <http://edyuk.org>
6 **
7 ** This file may be used under the terms of the GNU General Public License
8 ** version 3 as published by the Free Software Foundation and appearing in the
9 ** file GPL.txt included in the packaging of this file.
10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 **
14 ****************************************************************************/
15 
16 #ifndef _QPANEL_LAYOUT_H_
17 #define _QPANEL_LAYOUT_H_
18 
19 #include "qce-config.h"
20 
26 #include <QList>
27 #include <QLayout>
28 #include <QPointer>
29 
30 class QPanel;
31 class QEditor;
32 
34 {
35  Q_OBJECT
36 
37  public:
38  enum Position
39  {
40  West,
41  North,
42  South,
43  East
44  };
45 
47  QPanelLayout(const QString& layout, QEditor *p);
48  virtual ~QPanelLayout();
49 
50  virtual int count() const;
51  virtual bool hasHeightForWidth() const;
52  virtual Qt::Orientations expandingDirections() const;
53 
54  virtual QSize sizeHint() const;
55  virtual QSize minimumSize() const;
56 
57  virtual QLayoutItem *itemAt(int idx) const;
58  virtual QLayoutItem *takeAt(int idx);
59 
60  QString serialized() const;
61  void addSerialized(const QString& layout);
62 
63  QList<QPanel*> panels() const;
64 
65  public slots:
66  virtual void addItem(QLayoutItem *item);
67  virtual void setGeometry(const QRect &rect);
68 
69  void add(QLayoutItem *item, Position position);
70  void addWidget(QWidget *widget, Position position);
71 
72  private:
73  QPointer<QEditor> m_parent;
74 
75  struct PanelWrapper
76  {
77  PanelWrapper(QLayoutItem *i, Position p)
78  {
79  item = i;
80  position = p;
81  }
82 
83  QLayoutItem *item;
84  Position position;
85  };
86 
87  enum SizeType { MinimumSize, SizeHint };
88  QSize calculateSize(SizeType sizeType) const;
89 
90  QList<PanelWrapper*> m_list;
91 };
92 
93 #endif // _QPANEL_LAYOUT_H_
94 
#define QCE_EXPORT
Macro needed for cross-platform shared libraries creation.
Definition: qce-config.h:40
Utility file for shared library creation.
Helper class for panels displayed by QCodeEdit.
Definition: qpanel.h:40
A text editing widget.
Definition: qeditor.h:55
A specialized layout taking care of panel display.
Definition: qpanellayout.h:33