2016-05-24 10:37:10 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2016 Statoil ASA
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2016-05-24 10:37:10 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2016-05-24 10:37:10 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2016-05-24 10:37:10 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-04-10 16:13:40 +02:00
|
|
|
#include "RiaDefines.h"
|
|
|
|
|
|
2020-05-09 11:23:58 +02:00
|
|
|
#include "cafFontTools.h"
|
2017-01-17 13:06:57 +01:00
|
|
|
#include "cafPdmChildField.h"
|
2019-09-06 10:40:57 +02:00
|
|
|
#include "cafPdmField.h"
|
|
|
|
|
#include "cafPdmObject.h"
|
2016-10-27 11:03:13 +02:00
|
|
|
|
2026-06-19 15:41:50 +02:00
|
|
|
class QImage;
|
2026-04-30 17:45:45 +02:00
|
|
|
class RimDockWindowController;
|
2017-01-17 13:06:57 +01:00
|
|
|
|
2026-05-05 00:10:08 +02:00
|
|
|
namespace ads
|
|
|
|
|
{
|
|
|
|
|
class CDockWidget;
|
|
|
|
|
} // namespace ads
|
|
|
|
|
|
2020-05-09 11:23:58 +02:00
|
|
|
class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface
|
2016-05-24 10:37:10 +02:00
|
|
|
{
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2016-05-24 10:37:10 +02:00
|
|
|
public:
|
2023-04-14 14:07:45 +02:00
|
|
|
RimViewWindow();
|
|
|
|
|
~RimViewWindow() override;
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2019-11-14 20:48:11 +01:00
|
|
|
virtual int id() const = 0;
|
2019-10-09 09:21:28 +02:00
|
|
|
|
2019-11-15 10:12:19 +01:00
|
|
|
bool showWindow() const;
|
|
|
|
|
void setShowWindow( bool showWindow );
|
|
|
|
|
|
2026-06-24 16:07:21 +02:00
|
|
|
void setAsActiveViewer( bool allowSelectionChange = false );
|
2026-06-22 13:39:27 +02:00
|
|
|
bool isActiveViewer() const;
|
2026-05-19 02:26:59 +02:00
|
|
|
|
2026-05-06 16:54:21 +02:00
|
|
|
bool isMainDockedWindow() const;
|
|
|
|
|
|
2026-05-18 13:39:38 +02:00
|
|
|
bool isDockedIn3DView() const;
|
|
|
|
|
bool isDockedInPlotView() const;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void loadDataAndUpdate();
|
2026-05-06 16:54:21 +02:00
|
|
|
void updateDockWindowVisibility();
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2026-05-06 16:54:21 +02:00
|
|
|
void removeWindowFromDock();
|
2019-10-31 13:48:40 +01:00
|
|
|
|
2026-05-06 16:54:21 +02:00
|
|
|
void dockAs3DViewWindow();
|
|
|
|
|
void dockAsPlotWindow();
|
2019-09-06 10:40:57 +02:00
|
|
|
|
|
|
|
|
virtual QWidget* viewWidget() = 0;
|
|
|
|
|
|
2026-06-11 16:30:46 +02:00
|
|
|
ads::CDockWidget* dockWidget() const;
|
2026-05-05 00:10:08 +02:00
|
|
|
ads::CDockWidget* createDockWidget();
|
|
|
|
|
|
2026-06-04 17:27:13 +02:00
|
|
|
virtual QImage captureSnapshot( int width, int height );
|
|
|
|
|
|
2026-03-30 12:26:10 +02:00
|
|
|
virtual QImage snapshotWindowContent();
|
|
|
|
|
virtual void zoomAll() = 0;
|
2019-09-06 10:40:57 +02:00
|
|
|
|
|
|
|
|
void viewNavigationChanged();
|
|
|
|
|
|
2026-05-06 16:54:21 +02:00
|
|
|
virtual void updateWindowTitle();
|
2026-08-19 16:57:00 +02:00
|
|
|
void updateWindowTitleIcon( QString title );
|
2022-10-31 10:41:50 +01:00
|
|
|
|
2026-06-02 17:29:04 +02:00
|
|
|
void resetDockWindowId();
|
2026-06-02 13:34:48 +02:00
|
|
|
QString dockWindowName();
|
2026-05-12 17:46:29 +02:00
|
|
|
|
2017-01-20 16:25:05 +01:00
|
|
|
protected:
|
2026-05-19 02:26:59 +02:00
|
|
|
//// Interface for the Window controller
|
2026-04-30 01:19:06 +02:00
|
|
|
friend class RimDockWindowController;
|
2016-05-24 10:37:10 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
QString windowTitle();
|
2019-11-15 10:12:19 +01:00
|
|
|
virtual QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) = 0;
|
2025-04-11 18:34:32 +02:00
|
|
|
virtual void updateViewWidgetAfterCreation() {};
|
2019-09-06 10:40:57 +02:00
|
|
|
virtual void deleteViewWidget() = 0;
|
|
|
|
|
virtual void onLoadDataAndUpdate() = 0;
|
|
|
|
|
virtual void onViewNavigationChanged();
|
2019-10-11 15:54:19 +02:00
|
|
|
virtual bool isWindowVisible() const; // Virtual To allow special visibility control
|
2026-05-12 17:46:29 +02:00
|
|
|
void deleteDockWidget();
|
2026-05-19 02:26:59 +02:00
|
|
|
void setActive( bool active );
|
|
|
|
|
////
|
2017-01-17 13:06:57 +01:00
|
|
|
|
2017-01-20 17:20:28 +01:00
|
|
|
// Derived classes are not supposed to override this function. The intention is to always use m_showWindow
|
|
|
|
|
// as the objectToggleField for this class. This way the visibility of a widget being part of a composite widget
|
|
|
|
|
// can be controlled from the project tree using check box toggles
|
2018-10-18 19:45:57 +02:00
|
|
|
caf::PdmFieldHandle* objectToggleField() final;
|
2023-02-26 10:48:40 +01:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
2019-11-04 15:26:03 +01:00
|
|
|
|
|
|
|
|
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
2017-01-17 13:06:57 +01:00
|
|
|
|
2026-06-19 15:41:50 +02:00
|
|
|
static QImage internalCaptureSnapshot( ads::CDockWidget* dockWidget, QWidget* widget, int width, int height );
|
2026-06-04 17:27:13 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
private:
|
2019-11-14 20:48:11 +01:00
|
|
|
friend class RimProject;
|
|
|
|
|
|
2026-06-01 14:01:51 +02:00
|
|
|
void dockInWindow( int mainWindowID );
|
2019-11-15 13:35:39 +01:00
|
|
|
virtual void assignIdIfNecessary() = 0;
|
2017-01-17 13:06:57 +01:00
|
|
|
|
2019-10-09 09:21:28 +02:00
|
|
|
protected:
|
2026-06-01 14:01:51 +02:00
|
|
|
caf::PdmChildField<RimDockWindowController*> m_windowController;
|
|
|
|
|
|
2026-06-02 13:34:48 +02:00
|
|
|
caf::PdmField<bool> m_showWindow;
|
|
|
|
|
ads::CDockWidget* m_dockWidget;
|
|
|
|
|
caf::PdmField<QString> m_dockWindowId;
|
|
|
|
|
bool m_isActiveViewer;
|
2016-05-24 10:37:10 +02:00
|
|
|
};
|