Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef FRAMENVIGATOR_H
Toshihiro Shimizu 890ddd
#define FRAMENVIGATOR_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzQt includes
Toshihiro Shimizu 890ddd
#include "toonzqt/intfield.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// Qt includes
Toshihiro Shimizu 890ddd
#include <qwidget></qwidget>
Toshihiro Shimizu 890ddd
#include <qtoolbar></qtoolbar>
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
Toshihiro Shimizu 890ddd
class TFrameHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//======================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//*****************************************************************************
Toshihiro Shimizu 890ddd
//    KeyframeNavigator  declaration
Toshihiro Shimizu 890ddd
//*****************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  \brief    The FrameNavigator is a simple toolbar widget showing a numerical
Toshihiro Shimizu 890ddd
            representation of an integer timeline.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  \details  A FrameNavigator is a TFrameHandle viewer composed of a line edit
Toshihiro Shimizu 890ddd
            widget showing the current frame number, and a pair of directional
Toshihiro Shimizu 890ddd
            arrow buttons that move to adjacent frames.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  \remark   The text field actually visualizes the internal integer \p m_frame
Shinya Kitaoka 120a6e
  \a +1
Toshihiro Shimizu 890ddd
            (e.g. when \p m_frame is 0 then 1 is visualized).
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI FrameNavigator final : public QToolBar {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_frame;
Shinya Kitaoka 120a6e
  DVGui::IntLineEdit *m_lineEdit;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FrameNavigator(QWidget *parent = 0);
Shinya Kitaoka 120a6e
  ~FrameNavigator() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int getFrame() const { return m_frame; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setFrameHandle(TFrameHandle *);  //!< Attaches the navigator to the
Shinya Kitaoka 38fd86
                                        //! specified frameHandle.
Shinya Kitaoka 120a6e
  //!  \remark    Detaches from any previously attached frame handle.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool anyWidgetHasFocus();
Toshihiro Shimizu 890ddd
signals:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void frameSwitched();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setFrame(
Shinya Kitaoka 120a6e
      int frame,
Shinya Kitaoka 120a6e
      bool notifyFrameHandler);  //!< Sets the navigator's current frame.
Shinya Kitaoka 120a6e
                                 //!  \deprecated  Remove the bool.
Shinya Kitaoka 120a6e
  void prevFrame() {
Shinya Kitaoka 120a6e
    setFrame(m_frame - 1, true);
Shinya Kitaoka 120a6e
  }  //!< Move to previous frame.
Shinya Kitaoka 120a6e
  void nextFrame() { setFrame(m_frame + 1, true); }  //!< Move to next frame.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void updateFrame(int frame);  //!< Changes frame without emitting any signal
Shinya Kitaoka 38fd86
                                //! and notifying the frameHandle.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
\details  Copies the value in the frame's line edit widget to the internal
Shinya Kitaoka 120a6e
current frame value.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  void onEditingFinished();  //!< Slot invoked whenever current frame's text
Shinya Kitaoka 38fd86
                             //! editing is finished.
Shinya Kitaoka 120a6e
  void onFrameSwitched();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // FRAMENVIGATORTOOLBAR_H