|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TDOCKWINDOWS_H
|
|
Toshihiro Shimizu |
890ddd |
#define TDOCKWINDOWS_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "docklayout.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qframe></qframe>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZQT_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//========================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
class TDockWidget;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//========================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------
|
|
Toshihiro Shimizu |
890ddd |
// TMainWindow
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
TMainWindow class is intended as a convenience QMainWindow-like interface
|
|
Toshihiro Shimizu |
890ddd |
for DockLayout.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\sa TDockWidget class.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TMainWindow : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT //Just needed by qobject_cast, for now
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DockLayout *m_layout;
|
|
Toshihiro Shimizu |
890ddd |
QWidget *m_menu;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
|
Toshihiro Shimizu |
890ddd |
virtual ~TMainWindow();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addDockWidget(TDockWidget *item);
|
|
Toshihiro Shimizu |
890ddd |
void removeDockWidget(TDockWidget *item);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setMenuWidget(QWidget *menubar);
|
|
Toshihiro Shimizu |
890ddd |
QWidget *menuWidget() const { return m_menu; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Style options
|
|
Toshihiro Shimizu |
890ddd |
void setDecoAllocator(DockDecoAllocator *allocator);
|
|
Toshihiro Shimizu |
890ddd |
void setSeparatorsThickness(int thick);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DockLayout *dockLayout() const { return m_layout; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
virtual void resizeEvent(QResizeEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//========================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------
|
|
Toshihiro Shimizu |
890ddd |
// TDockWidget
|
|
Toshihiro Shimizu |
890ddd |
//-------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
TDockWidget class is a convenience QDockWidget-like interface to DockWidget
|
|
Toshihiro Shimizu |
890ddd |
class. It provides an internal base layout including a titlebar and a
|
|
Toshihiro Shimizu |
890ddd |
content widget.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\sa TMainWindow class.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TDockWidget : public DockWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT //Needed by qobject_cast
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QWidget *m_titlebar;
|
|
Toshihiro Shimizu |
890ddd |
QWidget *m_widget;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_margin;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TDockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
|
Toshihiro Shimizu |
890ddd |
TDockWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
|
Toshihiro Shimizu |
890ddd |
~TDockWidget() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setTitleBarWidget(QWidget *titlebar);
|
|
Toshihiro Shimizu |
890ddd |
QWidget *titleBarWidget() const { return m_titlebar; }
|
|
Toshihiro Shimizu |
890ddd |
void setFloatingMargin(int margin) { m_margin = margin; }
|
|
Toshihiro Shimizu |
890ddd |
int getFloatingMargin() const { return m_margin; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setWidget(QWidget *widget);
|
|
Toshihiro Shimizu |
890ddd |
QWidget *widget() const { return m_widget; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setFloating(bool status = true);
|
|
Toshihiro Shimizu |
890ddd |
void setMaximized(bool status = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum Orientation { horizontal = 0,
|
|
Toshihiro Shimizu |
890ddd |
vertical = 1 };
|
|
Toshihiro Shimizu |
890ddd |
void setOrientation(bool direction = vertical);
|
|
Toshihiro Shimizu |
890ddd |
bool getOrientation() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
QSize getDockedMinimumSize();
|
|
Toshihiro Shimizu |
890ddd |
QSize getDockedMaximumSize();
|
|
Toshihiro Shimizu |
890ddd |
void setFloatingAppearance();
|
|
Toshihiro Shimizu |
890ddd |
void setDockedAppearance();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void selectDockPlaceholder(QMouseEvent *me);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isDragGrip(QPoint p);
|
|
Toshihiro Shimizu |
890ddd |
int isResizeGrip(QPoint p);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void windowTitleEvent(QEvent *e);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //TDOCKWINDOWS_H
|