Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef SPREADSHEETVIEWER_H
Toshihiro Shimizu 890ddd
#define SPREADSHEETVIEWER_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include <qframe></qframe>
Toshihiro Shimizu 890ddd
#include <qscrollarea></qscrollarea>
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
// forward declaration
Toshihiro Shimizu 890ddd
class TFrameHandle;
Toshihiro Shimizu 890ddd
class SpreadsheetViewer;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace Spreadsheet {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// forward declaration
Toshihiro Shimizu 890ddd
class GenericPanel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI FrameScroller {
Shinya Kitaoka 120a6e
  QList<framescroller *=""> m_connectedScrollers;</framescroller>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FrameScroller();
Shinya Kitaoka 120a6e
  virtual ~FrameScroller();
Shinya Kitaoka 120a6e
  void connectScroller(FrameScroller *scroller);
Shinya Kitaoka 120a6e
  void disconnectScroller(FrameScroller *scroller);
Shinya Kitaoka 120a6e
  bool isScrollerConnected(FrameScroller *scroller);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual QScrollArea *getFrameScrollArea() const = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void registerFrameScroller();
Shinya Kitaoka 120a6e
  void unregisterFrameScroller();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void prepareToScroll(int dy);
Shinya Kitaoka 120a6e
  virtual void onPrepareToScroll(int dy) {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI DragTool {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  DragTool() {}
Shinya Kitaoka 120a6e
  virtual ~DragTool() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void click(int row, int col, QMouseEvent *e) {}
Shinya Kitaoka 120a6e
  virtual void drag(int row, int col, QMouseEvent *e) {}
Shinya Kitaoka 120a6e
  virtual void release(int row, int col, QMouseEvent *e) {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI SetFrameDragTool final : public DragTool {
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SetFrameDragTool(TFrameHandle *frameHandle) : m_frameHandle(frameHandle) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void click(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void drag(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void release(int row, int col, QMouseEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI SelectionDragTool final : public DragTool {
Shinya Kitaoka 120a6e
  SpreadsheetViewer *m_viewer;
Shinya Kitaoka 120a6e
  int m_firstRow, m_firstCol;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SelectionDragTool(SpreadsheetViewer *viewer);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void click(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void drag(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void release(int row, int col, QMouseEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI PanTool final : public DragTool {
Shinya Kitaoka 120a6e
  SpreadsheetViewer *m_viewer;
Shinya Kitaoka 120a6e
  GenericPanel *m_panel;
Shinya Kitaoka 120a6e
  QPoint m_lastPos;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PanTool(GenericPanel *panel);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void click(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void drag(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void release(int row, int col, QMouseEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI ScrollArea final : public QScrollArea {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
#if QT_VERSION >= 0x050500
Shinya Kitaoka 120a6e
  ScrollArea(QWidget *parent = 0, Qt::WindowFlags flags = 0);
Toshihiro Shimizu 890ddd
#else
Shinya Kitaoka 120a6e
  ScrollArea(QWidget *parent = 0, Qt::WFlags flags = 0);
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
  virtual ~ScrollArea();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  // keyPressEvent and wheelEvent are ignored by the ScrollArea
Shinya Kitaoka 120a6e
  // and therefore they are handled by the parent (Viewer)
Shinya Kitaoka 473e70
  void keyPressEvent(QKeyEvent *e) override;
Shinya Kitaoka 473e70
  void wheelEvent(QWheelEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI GenericPanel : public QWidget {
Shinya Kitaoka 120a6e
  Q_OBJECT
Shinya Kitaoka 120a6e
  SpreadsheetViewer *m_viewer;
Shinya Kitaoka 120a6e
  DragTool *m_dragTool;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  GenericPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~GenericPanel();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  SpreadsheetViewer *getViewer() const { return m_viewer; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual DragTool *createDragTool(QMouseEvent *) { return 0; };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void paintEvent(QPaintEvent *) override;
Shinya Kitaoka 473e70
  void mousePressEvent(QMouseEvent *) override;
Shinya Kitaoka 473e70
  void mouseReleaseEvent(QMouseEvent *) override;
Shinya Kitaoka 473e70
  void mouseMoveEvent(QMouseEvent *) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI RowPanel : public GenericPanel {
Shinya Kitaoka 120a6e
  Q_OBJECT
Shinya Kitaoka 120a6e
  const int m_xa;  // frame cells start at m_xa
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  RowPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~RowPanel() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  DragTool *createDragTool(QMouseEvent *) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void paintEvent(QPaintEvent *) override;
Shinya Kitaoka 120a6e
  void drawRows(QPainter &p, int r0, int r1);
Shinya Kitaoka 120a6e
  void drawCurrentRowGadget(QPainter &p, int r0, int r1);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI ColumnPanel : public GenericPanel {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ColumnPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~ColumnPanel() {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI CellPanel : public GenericPanel {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  CellPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~CellPanel() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  DragTool *createDragTool(QMouseEvent *) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void paintEvent(QPaintEvent *) override;
Shinya Kitaoka 120a6e
  virtual void drawCells(QPainter &p, int r0, int c0, int r1, int c1) {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI SpreadsheetViewer : public QFrame,
Shinya Kitaoka 120a6e
                                public Spreadsheet::FrameScroller {
Shinya Kitaoka 120a6e
  Q_OBJECT
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  QColor m_lightLightBgColor;  // RowPanel background (124,124,124)
Shinya Kitaoka 120a6e
  QColor m_bgColor;         // RowPanel background in scene range(164,164,164)
Shinya Kitaoka 120a6e
  QColor m_lightLineColor;  // horizontal line (146,144,146)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor LightLightBGColor READ getLightLightBGColor WRITE
Shinya Kitaoka 120a6e
                 setLightLightBGColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor BGColor READ getBGColor WRITE setBGColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor LightLineColor READ getLightLineColor WRITE setLightLineColor)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  QColor m_currentRowBgColor;  // current frame, column
Shinya Kitaoka 120a6e
  QColor m_markerLineColor;    // marker interval (0, 255, 246)
Shinya Kitaoka 120a6e
  QColor m_textColor;          // text (black)
Shinya Kitaoka 120a6e
  QColor m_verticalLineColor;  // vertical line (black)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor CurrentRowBgColor READ getCurrentRowBgColor WRITE
Shinya Kitaoka 120a6e
                 setCurrentRowBgColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor MarkerLineColor READ getMarkerLineColor WRITE setMarkerLineColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor TextColor READ getTextColor WRITE setTextColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor VerticalLineColor READ getVerticalLineColor WRITE
Shinya Kitaoka 120a6e
                 setVerticalLineColor)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // key frame
Shinya Kitaoka 120a6e
  QColor m_keyFrameColor;          // (219,139,54)
Shinya Kitaoka 120a6e
  QColor m_keyFrameBorderColor;    // (82,51,20)
Shinya Kitaoka 120a6e
  QColor m_selectedKeyFrameColor;  // (237,197,155)
Shinya Kitaoka 120a6e
  // key frame inbetween
Shinya Kitaoka 120a6e
  QColor m_inBetweenColor;          // (194,194,176)
Shinya Kitaoka 120a6e
  QColor m_inBetweenBorderColor;    // (72,72,65)
Shinya Kitaoka 120a6e
  QColor m_selectedInBetweenColor;  // (225,225,216)
Shinya Kitaoka 120a6e
  // empty cell
Shinya Kitaoka 120a6e
  QColor m_selectedEmptyColor;  // (190,190,190)
Shinya Kitaoka 120a6e
  // empty cell in the scene range
Shinya Kitaoka 120a6e
  QColor m_selectedSceneRangeEmptyColor;  // (210,210,210)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor KeyFrameColor READ getKeyFrameColor WRITE setKeyFrameColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor KeyFrameBorderColor READ getKeyFrameBorderColor WRITE
Shinya Kitaoka 120a6e
                 setKeyFrameBorderColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor SelectedKeyFrameColor READ getSelectedKeyFrameColor WRITE
Shinya Kitaoka 120a6e
                 setSelectedKeyFrameColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor InBetweenColor READ getInBetweenColor WRITE setInBetweenColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor InBetweenBorderColor READ getInBetweenBorderColor WRITE
Shinya Kitaoka 120a6e
                 setInBetweenBorderColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor SelectedInBetweenColor READ getSelectedInBetweenColor WRITE
Shinya Kitaoka 120a6e
                 setSelectedInBetweenColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor SelectedEmptyColor READ getSelectedEmptyColor WRITE
Shinya Kitaoka 120a6e
                 setSelectedEmptyColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor SelectedSceneRangeEmptyColor READ getSelectedSceneRangeEmptyColor
Shinya Kitaoka 120a6e
          WRITE setSelectedSceneRangeEmptyColor)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  QColor m_columnHeaderBorderColor;  // column header border lines (46,47,46)
Shinya Kitaoka 120a6e
  QColor m_selectedColumnTextColor;  // selected column text (red)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor ColumnHeaderBorderColor READ getColumnHeaderBorderColor
Shinya Kitaoka 120a6e
                 WRITE setColumnHeaderBorderColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor SelectedColumnTextColor READ getSelectedColumnTextColor
Shinya Kitaoka 120a6e
                 WRITE setSelectedColumnTextColor)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Spreadsheet::ScrollArea *m_columnScrollArea;
Shinya Kitaoka 120a6e
  Spreadsheet::ScrollArea *m_rowScrollArea;
Shinya Kitaoka 120a6e
  Spreadsheet::ScrollArea *m_cellScrollArea;
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int m_columnWidth;
Shinya Kitaoka 120a6e
  int m_rowHeight;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // QPoint m_delta;
Shinya Kitaoka 120a6e
  int m_timerId;
Shinya Kitaoka 120a6e
  QPoint m_autoPanSpeed;
Shinya Kitaoka 120a6e
  QPoint m_lastAutoPanPos;
Shinya Kitaoka 120a6e
  int m_rowCount, m_columnCount;
Shinya Kitaoka 120a6e
  int m_currentRow;
Shinya Kitaoka 120a6e
  int m_markRowDistance, m_markRowOffset;
Shinya Kitaoka 120a6e
  // QRect m_selectedCells; // x=col, y=row
Shinya Kitaoka 120a6e
  bool m_isComputingSize;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SpreadsheetViewer(QWidget *parent);
Shinya Kitaoka 120a6e
  virtual ~SpreadsheetViewer();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getColumnWidth() const { return m_columnWidth; }
Shinya Kitaoka 120a6e
  void setColumnWidth(int width) { m_columnWidth = width; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getRowHeight() const { return m_rowHeight; }
Shinya Kitaoka 120a6e
  void setRowHeight(int height) { m_rowHeight = height; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setRowsPanel(Spreadsheet::RowPanel *rows);
Shinya Kitaoka 120a6e
  void setColumnsPanel(Spreadsheet::ColumnPanel *columns);
Shinya Kitaoka 120a6e
  void setCellsPanel(Spreadsheet::CellPanel *cells);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getRowCount() const { return m_rowCount; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // provvisorio
Shinya Kitaoka 473e70
  QScrollArea *getFrameScrollArea() const override { return m_cellScrollArea; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // QProperty
Shinya Kitaoka 120a6e
  void setLightLightBGColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_lightLightBgColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getLightLightBGColor() const { return m_lightLightBgColor; }
Shinya Kitaoka 120a6e
  void setBGColor(const QColor &color) { m_bgColor = color; }
Shinya Kitaoka 120a6e
  QColor getBGColor() const { return m_bgColor; }
Shinya Kitaoka 120a6e
  void setLightLineColor(const QColor &color) { m_lightLineColor = color; }
Shinya Kitaoka 120a6e
  QColor getLightLineColor() const { return m_lightLineColor; }
Shinya Kitaoka 120a6e
  void setCurrentRowBgColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_currentRowBgColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getCurrentRowBgColor() const { return m_currentRowBgColor; }
Shinya Kitaoka 120a6e
  void setMarkerLineColor(const QColor &color) { m_markerLineColor = color; }
Shinya Kitaoka 120a6e
  QColor getMarkerLineColor() const { return m_markerLineColor; }
Shinya Kitaoka 120a6e
  void setTextColor(const QColor &color) { m_textColor = color; }
Shinya Kitaoka 120a6e
  QColor getTextColor() const { return m_textColor; }
Shinya Kitaoka 120a6e
  void setVerticalLineColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_verticalLineColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getVerticalLineColor() const { return m_verticalLineColor; }
Shinya Kitaoka 120a6e
  void setKeyFrameColor(const QColor &color) { m_keyFrameColor = color; }
Shinya Kitaoka 120a6e
  QColor getKeyFrameColor() const { return m_keyFrameColor; }
Shinya Kitaoka 120a6e
  void setKeyFrameBorderColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_keyFrameBorderColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getKeyFrameBorderColor() const { return m_keyFrameBorderColor; }
Shinya Kitaoka 120a6e
  void setSelectedKeyFrameColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedKeyFrameColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedKeyFrameColor() const { return m_selectedKeyFrameColor; }
Shinya Kitaoka 120a6e
  void setInBetweenColor(const QColor &color) { m_inBetweenColor = color; }
Shinya Kitaoka 120a6e
  QColor getInBetweenColor() const { return m_inBetweenColor; }
Shinya Kitaoka 120a6e
  void setInBetweenBorderColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_inBetweenBorderColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getInBetweenBorderColor() const { return m_inBetweenBorderColor; }
Shinya Kitaoka 120a6e
  void setSelectedInBetweenColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedInBetweenColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedInBetweenColor() const { return m_selectedInBetweenColor; }
Shinya Kitaoka 120a6e
  void setSelectedEmptyColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedEmptyColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedEmptyColor() const { return m_selectedEmptyColor; }
Shinya Kitaoka 120a6e
  void setSelectedSceneRangeEmptyColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedSceneRangeEmptyColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedSceneRangeEmptyColor() const {
Shinya Kitaoka 120a6e
    return m_selectedSceneRangeEmptyColor;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void setColumnHeaderBorderColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_columnHeaderBorderColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getColumnHeaderBorderColor() const {
Shinya Kitaoka 120a6e
    return m_columnHeaderBorderColor;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void setSelectedColumnTextColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedColumnTextColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedColumnTextColor() const {
Shinya Kitaoka 120a6e
    return m_selectedColumnTextColor;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void scroll(QPoint delta);
Shinya Kitaoka 473e70
  void onPrepareToScroll(int dy) override { refreshContentSize(0, dy); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setAutoPanSpeed(const QPoint &speed);
Shinya Kitaoka 120a6e
  void setAutoPanSpeed(const QRect &widgetBounds, const QPoint &mousePos);
Shinya Kitaoka 120a6e
  void stopAutoPan() { setAutoPanSpeed(QPoint()); }
Shinya Kitaoka 120a6e
  bool isAutoPanning() const {
Shinya Kitaoka 120a6e
    return m_autoPanSpeed.x() != 0 || m_autoPanSpeed.y() != 0;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int xToColumn(int x) const;
Shinya Kitaoka 120a6e
  int yToRow(int y) const;
Shinya Kitaoka 120a6e
  int columnToX(int col) const;
Shinya Kitaoka 120a6e
  int rowToY(int row) const;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool refreshContentSize(int scrollDx, int scrollDy);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getCurrentRow() const { return m_currentRow; }
Shinya Kitaoka 120a6e
  void setCurrentRow(int row) { m_currentRow = row; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual QRect getSelectedCells() const               = 0;
Shinya Kitaoka 120a6e
  virtual void selectCells(const QRect &selectedCells) = 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool isSelectedCell(int row, int col) const {
Shinya Kitaoka 120a6e
    return getSelectedCells().contains(QPoint(col, row));
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void setMarkRow(int distance, int offset) {
Shinya Kitaoka 120a6e
    m_markRowDistance = distance > 0 ? distance : 6;
Shinya Kitaoka 120a6e
    m_markRowOffset   = offset;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void getMarkRow(int &distance, int &offset) const {
Shinya Kitaoka 120a6e
    distance = m_markRowDistance;
Shinya Kitaoka 120a6e
    offset   = m_markRowOffset;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  int isMarkRow(int row) const {
Shinya Kitaoka 120a6e
    return (row - m_markRowOffset) % m_markRowDistance == 0;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setFrameHandle(TFrameHandle *frameHandle);
Shinya Kitaoka 120a6e
  TFrameHandle *getFrameHandle() const { return m_frameHandle; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void ensureVisibleCol(int col);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Shinya Kitaoka 473e70
  void resizeEvent(QResizeEvent *event) override;
Shinya Kitaoka 473e70
  void keyPressEvent(QKeyEvent *event) override;
Shinya Kitaoka 473e70
  void wheelEvent(QWheelEvent *event) override;
Shinya Kitaoka 473e70
  void timerEvent(QTimerEvent *) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void setRowCount(int rowCount);
Shinya Kitaoka 120a6e
  void setColumnCount(int columnCount);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void frameSwitched();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void updateAreas();
Shinya Kitaoka 120a6e
  void onVSliderChanged(int);
Shinya Kitaoka 120a6e
  void onHSliderChanged(int);
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
void updateAllAree();
Shinya Kitaoka 120a6e
void updateCellColumnAree();
Shinya Kitaoka 120a6e
void updateCellRowAree();
Shinya Kitaoka 120a6e
*/
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif