kexi

spring.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef SPACER_H
00021 #define SPACER_H
00022 
00023 #include <qwidget.h>
00024 
00025 class QDomElement;
00026 class QDomDocument;
00027 
00028 namespace KFormDesigner {
00029 
00030 class ObjectTreeItem;
00031 class Container;
00032 class WidgetLibrary;
00033 
00034 }
00035 
00036 class KFORMEDITOR_EXPORT Spring : public QWidget
00037 {
00038     Q_OBJECT
00039     Q_ENUMS(SizeType)
00040     Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation)
00041     Q_PROPERTY(SizeType sizeType READ sizeType WRITE setSizeType)
00042 
00043     private:
00044         enum {HSize = 6, HMask = 0x3f, VMask = HMask << HSize, MayGrow = 1, ExpMask = 2, MayShrink = 4 };
00045     public:
00046         enum SizeType {Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink , MinimumExpanding = Minimum|ExpMask,
00047             Expanding = MinimumExpanding|MayShrink };
00048 
00049     public:
00050         Spring(QWidget *parent, const char *name);
00051         ~Spring() {;}
00052 
00053         static bool isPropertyVisible(const QCString &name);
00054         static void saveSpring(KFormDesigner::ObjectTreeItem *item, QDomElement &parent, QDomDocument &domDoc, bool insideGridLayout);
00055 
00056         void setOrientation(Orientation orient);
00057         Orientation orientation() const { return m_orient;}
00058         void setSizeType(SizeType size);
00059         SizeType sizeType() const;
00060 
00061         void  setPreviewMode() { m_edit = false; }
00062 
00063     private:
00064         void paintEvent(QPaintEvent *ev);
00065 
00066     private:
00067         Orientation   m_orient;
00068         bool          m_edit;
00069 };
00070 
00071 
00072 #endif
00073 
00074 
KDE Home | KDE Accessibility Home | Description of Access Keys