///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RiuInterfaceToViewWindow.h" #include "RiuWidgetStyleSheet.h" #include "cafPdmPointer.h" #include "cafSelectionChangedReceiver.h" #include #include #include #include #include #include #include class RiaPlotWindowRedrawScheduler; class RimGridPlotWindow; class RiuQwtPlotLegend; class RiuQwtPlotWidget; class QFocusEvent; class QLabel; class QScrollBar; //================================================================================================== // // RiuGridPlotWindow // //================================================================================================== class RiuGridPlotWindow : public QWidget, public RiuInterfaceToViewWindow, public caf::SelectionChangedReceiver { Q_OBJECT public: RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget* parent = nullptr ); ~RiuGridPlotWindow() override; RimGridPlotWindow* ownerPlotDefinition(); RimViewWindow* ownerViewWindow() const override; void addPlot( RiuQwtPlotWidget* plotWidget ); void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ); void removePlot( RiuQwtPlotWidget* plotWidget ); void setPlotTitle( const QString& plotTitle ); void setTitleVisible( bool visible ); void setSelectionsVisible( bool visible ); void setFontSize( int fontSize ); int fontSize() const; int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ); void scheduleUpdate(); void scheduleReplotOfAllPlots(); virtual void updateVerticalScrollBar( double visibleMin, double visibleMax, double totalMin, double totalMax ) {} protected: void contextMenuEvent( QContextMenuEvent* ) override; void keyPressEvent( QKeyEvent* keyEvent ) override; QLabel* createTitleLabel() const; void resizeEvent( QResizeEvent* event ) override; void showEvent( QShowEvent* event ) override; void dragEnterEvent( QDragEnterEvent* event ) override; void dragMoveEvent( QDragMoveEvent* event ) override; void dragLeaveEvent( QDragLeaveEvent* event ) override; void dropEvent( QDropEvent* event ) override; virtual bool willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const; std::pair rowAndColumnCount( int plotWidgetCount ) const; virtual void onSelectionManagerSelectionChanged( const std::set& changedSelectionLevels ) override; void setWidgetState( RiuWidgetStyleSheet::StateTag widgetState ); virtual bool showYAxis( int row, int column ) const; void reinsertPlotWidgets(); int alignCanvasTops(); void clearGridLayout(); RiuWidgetStyleSheet createDropTargetStyleSheet(); QList> visiblePlotWidgets() const; QList> visibleLegends() const; QList> visibleTitles() const; std::pair findAvailableRowAndColumn( int startRow, int startColumn, int columnSpan, int columnCount ) const; private slots: virtual void performUpdate(); protected: QPointer m_layout; QPointer m_plotLayout; QPointer m_plotWidgetFrame; QPointer m_gridLayout; QPointer m_plotTitle; QList m_legendColumns; QList> m_subTitles; QList> m_legends; QList> m_plotWidgets; caf::PdmPointer m_plotDefinition; QPointer m_dropTargetPlaceHolder; RiuWidgetStyleSheet m_dropTargetStyleSheet; private: friend class RiaPlotWindowRedrawScheduler; };