#include <qtabbar.h>
#include <qwidgetlist.h>
+class QAction;
class QTabBar;
class QPainter;
class QSplitter;
class QtxWorkstackChild;
class QtxWorkstackTabBar;
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
class QTX_EXPORT QtxWorkstack : public QWidget
{
Q_OBJECT
+public:
enum { SplitVertical, SplitHorizontal, Close };
+
+ enum SplitType {
+ SPLIT_STAY, //!< given widget stays in its workarea, others are moved into a new one
+ SPLIT_AT, //!< widgets before a given widget stays in they workarea, others are moved into a new one
+ SPLIT_MOVE //!< given widget is moved into a new workarea, others stay in an old one
+ };
public:
QtxWorkstack( QWidget* = 0 );
QWidget* activeWindow() const;
+ int accel( const int ) const;
+ void setAccel( const int, const int );
+
void split( const int );
+ // STV: Useless function. wid->setFocus() should be used instead.
+ // void OnTop( QWidget* wid);
+
+ void Split( QWidget* wid, const Qt::Orientation o, const SplitType type );
+ void Attract( QWidget* wid1, QWidget* wid2, const bool all );
+ void SetRelativePosition( QWidget* wid, const Qt::Orientation o, const double pos );
+ void SetRelativePositionInSplitter( QWidget* wid, const double pos );
+
signals:
void windowActivated( QWidget* );
public slots:
void splitVertical();
void splitHorizontal();
-
+
private slots:
- void onPopupActivated( int );
+ void onCloseWindow();
void onDestroyed( QObject* );
void onWindowActivated( QWidget* );
void onContextMenuRequested( QPoint );
void updateState( QSplitter* );
void distributeSpace( QSplitter* ) const;
+ int setPosition( QWidget* wid, QSplitter* split, const Qt::Orientation o,
+ const int need_pos, const int splitter_pos );
private:
QWidget* myWin;
QtxWorkstackArea* myArea;
QSplitter* mySplit;
+ QMap<int, QAction*> myActionsMap; //!< The map of the actions. Allows to get the QAction object by the key.
+
friend class QtxWorkstackArea;
friend class QtxWorkstackDrag;
};
bool isEmpty() const;
void insertWidget( QWidget*, const int = -1 );
- void removeWidget( QWidget* );
+ void removeWidget( QWidget*, const bool = true );
QWidget* activeWidget() const;
void setActiveWidget( QWidget* );
void onClose();
void onSelected( int );
+ void onWidgetDestroyed();
+
void onDragActiveTab();
void onChildDestroyed( QObject* );
void onChildShown( QtxWorkstackChild* );
QtxWorkstackChild* child( QWidget* ) const;
private:
+ struct WidgetInfo
+ {
+ WidgetInfo() : id( 0 ), vis( false ) {}
+ int id; bool vis;
+ };
+
typedef QMap<QWidget*, bool> BlockMap;
typedef QMap<QWidget*, QtxWorkstackChild*> ChildMap;
- typedef struct { int id; bool vis; } WidgetInfo;
typedef QMap<QWidget*, WidgetInfo> WidgetInfoMap;
private:
int myTab;
QtxWorkstackArea* myArea;
QPainter* myPainter;
+
};
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
#endif