~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to tools/designer/src/lib/shared/qdesigner_widget_p.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the designer application of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
//
 
30
//  W A R N I N G
 
31
//  -------------
 
32
//
 
33
// This file is not part of the Qt API.  It exists for the convenience
 
34
// of Qt Designer.  This header
 
35
// file may change from version to version without notice, or even be removed.
 
36
//
 
37
// We mean it.
 
38
//
 
39
 
 
40
#ifndef QDESIGNER_WIDGET_H
 
41
#define QDESIGNER_WIDGET_H
 
42
 
 
43
#include "shared_global_p.h"
 
44
#include "layoutdecoration.h"
 
45
 
 
46
#include <QtDesigner/QDesignerMetaDataBaseInterface>
 
47
 
 
48
#include <QtCore/QPointer>
 
49
#include <QtCore/QPair>
 
50
 
 
51
#include <QtGui/QGridLayout>
 
52
#include <QtGui/QWidget>
 
53
#include <QtGui/QDialog>
 
54
#include <QtGui/QLabel>
 
55
#include <QtGui/QPixmap>
 
56
 
 
57
class QDesignerFormWindowInterface;
 
58
class QAction;
 
59
class QLayoutItem;
 
60
class QVBoxLayout;
 
61
class QHBoxLayout;
 
62
class QGridLayout;
 
63
 
 
64
class QT_SHARED_EXPORT QDesignerWidget : public QWidget
 
65
{
 
66
    Q_OBJECT
 
67
public:
 
68
    QDesignerWidget(QDesignerFormWindowInterface* formWindow, QWidget *parent = 0);
 
69
    virtual ~QDesignerWidget();
 
70
 
 
71
    inline QDesignerFormWindowInterface* formWindow() const
 
72
    { return m_formWindow; }
 
73
 
 
74
    void updatePixmap();
 
75
 
 
76
protected:
 
77
    virtual void paintEvent(QPaintEvent *e);
 
78
    virtual void dragEnterEvent(QDragEnterEvent *e);
 
79
 
 
80
private:
 
81
    QDesignerFormWindowInterface* m_formWindow;
 
82
    uint need_frame : 1;
 
83
    QPixmap grid;
 
84
};
 
85
 
 
86
class QT_SHARED_EXPORT QDesignerDialog : public QDialog
 
87
{
 
88
    Q_OBJECT
 
89
public:
 
90
    QDesignerDialog(QDesignerFormWindowInterface *fw, QWidget *parent)
 
91
        : QDialog(parent), m_formWindow(fw) {}
 
92
 
 
93
protected:
 
94
    void paintEvent(QPaintEvent *e);
 
95
 
 
96
private:
 
97
    QDesignerFormWindowInterface *m_formWindow;
 
98
};
 
99
 
 
100
class QT_SHARED_EXPORT QDesignerLabel : public QLabel
 
101
{
 
102
    Q_OBJECT
 
103
    Q_PROPERTY(QByteArray buddy READ buddy WRITE setBuddy)
 
104
public:
 
105
    QDesignerLabel(QWidget *parent = 0);
 
106
 
 
107
    inline void setBuddy(const QByteArray &b)
 
108
    {
 
109
        myBuddy = b;
 
110
        updateBuddy();
 
111
    }
 
112
 
 
113
    inline QByteArray buddy() const
 
114
    { return myBuddy; }
 
115
 
 
116
    void setBuddy(QWidget *widget);
 
117
 
 
118
protected:
 
119
    void showEvent(QShowEvent *e)
 
120
    {
 
121
        QLabel::showEvent(e);
 
122
        updateBuddy();
 
123
    }
 
124
 
 
125
private:
 
126
    void updateBuddy();
 
127
 
 
128
    QByteArray myBuddy;
 
129
};
 
130
 
 
131
class QT_SHARED_EXPORT Line : public QFrame
 
132
{
 
133
    Q_OBJECT
 
134
    Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
 
135
public:
 
136
    Line(QWidget *parent) : QFrame(parent)
 
137
    { setAttribute(Qt::WA_MouseNoMask); setFrameStyle(HLine | Sunken); }
 
138
 
 
139
    inline void setOrientation(Qt::Orientation orient)
 
140
    { setFrameShape(orient == Qt::Horizontal ? HLine : VLine); }
 
141
 
 
142
    inline Qt::Orientation orientation() const
 
143
    { return frameShape() == HLine ? Qt::Horizontal : Qt::Vertical; }
 
144
};
 
145
 
 
146
#endif // QDESIGNER_WIDGET_H