mkRPG
src/editor/GUI/Tabs/Docks/bdockszone.h
Go to the documentation of this file.
00001 #ifndef BDOCKSZONE_H
00002 #define BDOCKSZONE_H
00003 
00004 #include <QtWidgets>
00005 #include "intertie.h"
00006 #include "bdock.h"
00007 
00008 #include "GUI/options.h"
00009 
00022 class BLayout : public QWidget
00023 {
00024     Q_OBJECT
00025 
00026 public:
00027     explicit BLayout(QWidget *parent = 0);
00028     void setOrientation(Qt::Orientation o);
00029     void insert(BDock *d, int ind = -1);
00030     void setSpacing(int e);
00031     void setLength(int t);
00032     int spacing() const;
00033 
00034 signals:
00035     void sizeChanged(int);
00036     void showPoint(int, int);
00037 
00038 private slots:
00039     void adjust();
00040     void dockClick(int i, const QPoint &p);
00041     void dockMove(int k, const QPoint &p);
00042     void dockRelease(int i, const QPoint &p);
00043     void dockStopped(int i);
00044 
00045 private:
00046     void paintEvent(QPaintEvent *event);
00047     void resizeEvent(QResizeEvent *re);
00048     void mouseDoubleClickEvent(QMouseEvent *me);
00049 
00050     int len, size;
00051     int space;
00052 
00053     int clPos;
00054     int initPos;
00055     bool repainting;
00056     //QBoxLayout *lay;
00057     QPoint prev;
00058     Qt::Orientation orient;
00059     BDock *movingDock;
00060     QVector<BDock*> docks;
00061     QVector<QPair<int,int>> placement;
00062 };
00063 
00064 
00065 
00066 
00067 
00068 
00075 class BDocksZone : public QWidget
00076 {
00077     Q_OBJECT
00078     Q_PROPERTY(int length READ length WRITE setLength)
00079     Q_PROPERTY(int currentLength READ currentLength WRITE setCurrentLenght)
00080 
00081     
00085     enum ScrollBarMode{
00086         AlwaysVisible,  
00087         Adjustable,     
00088         Fixed           
00089     };
00090 
00091 public:
00092     explicit BDocksZone(QWidget *parent = 0);
00093     void setUnfold(bool u, bool anim = true);
00094     const BinaryStateMachine* states() const;
00095     int length() const;
00096     void setLength(int t);
00097     inline ScrollBarMode scrollBarMode() const{return scrm;}
00098     void setScrollBarMode(ScrollBarMode m);
00099 
00100     int currentLength() const;
00101 
00102     void addDock(QString title, BDockWidget *dock); // TODO temporaire
00103 
00104 signals:
00105 
00106 public slots:
00107     void swap(bool anim = true);
00108 
00109 protected slots:
00110     void setCurrentLenght(int t);
00111 
00112 private slots:
00113     void showPoint(int x, int y);
00114     void foldingChanged(bool f);
00115     void docksSizeChanged();
00116     void paintEvent(QPaintEvent *event);
00117     void mousePressEvent(QMouseEvent *me);
00118     void mouseMoveEvent(QMouseEvent *me);
00119     void resizeEvent(QResizeEvent *event);
00120     void updateDockLength();
00121     void updateMousePos();
00122 
00123 private:
00124     void mouseDoubleClickEvent(QMouseEvent *);
00125     void mouseReleaseEvent(QMouseEvent *);
00126     void setDockLength(int l, bool inert = true);
00127 
00128     bool resizing;
00129     int lMin, lMax;
00130     int base, lBase;
00131     int lId;
00132     Intertie *inLength;
00133     QGridLayout *lay;
00134     BinaryStateMachine unfoldStates;
00135     QToolButton *bUnfold;
00136     QScrollArea *dockArea;
00137     BLayout *docks;
00138     ScrollBarMode scrm;
00139 
00140 
00141     static const int BUTTON = 12;
00142 };
00143 
00144 #endif // BDOCKSZONE_H
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Defines