Files
ResInsight/ApplicationLibCode/ProjectDataModel/RimViewWindow.h
T

115 lines
3.5 KiB
C++
Raw Normal View History

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaDefines.h"
2020-05-09 11:23:58 +02:00
#include "cafFontTools.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
2026-04-30 17:45:45 +02:00
class RimDockWindowController;
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
{
CAF_PDM_HEADER_INIT;
public:
2023-04-14 14:07:45 +02:00
RimViewWindow();
~RimViewWindow() override;
2019-11-14 20:48:11 +01:00
virtual int id() const = 0;
2019-11-15 10:12:19 +01:00
bool showWindow() const;
void setShowWindow( bool showWindow );
2026-05-19 02:26:59 +02:00
void setAsActiveViewer();
2026-05-19 18:08:18 +02:00
bool isActive() const;
2026-05-19 02:26:59 +02:00
bool isMainDockedWindow() const;
2026-05-18 13:39:38 +02:00
bool isDockedIn3DView() const;
bool isDockedInPlotView() const;
void loadDataAndUpdate();
void updateDockWindowVisibility();
void removeWindowFromDock();
void dockAs3DViewWindow();
void dockAsPlotWindow();
virtual QWidget* viewWidget() = 0;
2026-05-05 00:10:08 +02:00
ads::CDockWidget* dockWidget();
ads::CDockWidget* createDockWidget();
virtual QImage snapshotWindowContent();
virtual void zoomAll() = 0;
void viewNavigationChanged();
virtual void updateWindowTitle();
2022-10-31 10:41:50 +01:00
2026-05-12 17:46:29 +02:00
QString dockWindowName() const;
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;
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() {};
virtual void deleteViewWidget() = 0;
virtual void onLoadDataAndUpdate() = 0;
virtual void onViewNavigationChanged();
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-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
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;
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
private:
2019-11-14 20:48:11 +01:00
friend class RimProject;
2026-05-22 15:18:43 +02:00
void dockInWindow( RiaDefines::RIMainWindow mainWindowID );
2019-11-15 13:35:39 +01:00
virtual void assignIdIfNecessary() = 0;
protected:
caf::PdmField<bool> m_showWindow;
RimDockWindowController* m_windowController;
ads::CDockWidget* m_dockWidget;
2026-05-12 17:46:29 +02:00
size_t m_dockWindowId;
2026-05-19 02:26:59 +02:00
bool m_activeViewer;
2026-05-12 17:46:29 +02:00
static size_t m_nextDockWindowId;
};