Shinya Kitaoka 810553
#pragma once
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
Shinya Kitaoka 120a6e
// 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
*/
Shinya Kitaoka 120a6e
class DVAPI TMainWindow : public QWidget {
Shinya Kitaoka 120a6e
  Q_OBJECT  // Just needed by qobject_cast, for now
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
      DockLayout *m_layout;
Shinya Kitaoka 120a6e
  QWidget *m_menu;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
otakuto e2eb37
  TMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
Shinya Kitaoka 120a6e
  virtual ~TMainWindow();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void addDockWidget(TDockWidget *item);
Shinya Kitaoka 120a6e
  void removeDockWidget(TDockWidget *item);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setMenuWidget(QWidget *menubar);
Shinya Kitaoka 120a6e
  QWidget *menuWidget() const { return m_menu; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // Style options
Shinya Kitaoka 120a6e
  void setDecoAllocator(DockDecoAllocator *allocator);
Shinya Kitaoka 120a6e
  void setSeparatorsThickness(int thick);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  DockLayout *dockLayout() const { return m_layout; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void resizeEvent(QResizeEvent *event) override;
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
*/
Shinya Kitaoka 120a6e
class DVAPI TDockWidget : public DockWidget {
Shinya Kitaoka 120a6e
  Q_OBJECT  // Needed by qobject_cast
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
      QWidget *m_titlebar;
Shinya Kitaoka 120a6e
  QWidget *m_widget;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_margin;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TDockWidget(const QString &title, QWidget *parent = 0,
otakuto e2eb37
              Qt::WindowFlags flags = Qt::WindowFlags());
otakuto e2eb37
  TDockWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
Shinya Kitaoka 120a6e
  ~TDockWidget() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setTitleBarWidget(QWidget *titlebar);
Shinya Kitaoka 120a6e
  QWidget *titleBarWidget() const { return m_titlebar; }
Shinya Kitaoka 120a6e
  void setFloatingMargin(int margin) { m_margin = margin; }
Shinya Kitaoka 120a6e
  int getFloatingMargin() const { return m_margin; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setWidget(QWidget *widget);
Shinya Kitaoka 120a6e
  QWidget *widget() const { return m_widget; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setFloating(bool status = true);
Shinya Kitaoka 120a6e
  void setMaximized(bool status = true);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  enum Orientation { horizontal = 0, vertical = 1 };
Shinya Kitaoka 120a6e
  void setOrientation(bool direction = vertical);
Shinya Kitaoka 120a6e
  bool getOrientation() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 473e70
  QSize getDockedMinimumSize() override;
Shinya Kitaoka 473e70
  QSize getDockedMaximumSize() override;
Shinya Kitaoka 473e70
  void setFloatingAppearance() override;
Shinya Kitaoka 473e70
  void setDockedAppearance() override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void selectDockPlaceholder(QMouseEvent *me) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool isDragGrip(QPoint p) override;
Shinya Kitaoka 473e70
  int isResizeGrip(QPoint p) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void windowTitleEvent(QEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // TDOCKWINDOWS_H