ATLAS Offline Software
VP1MaterialButton.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // //
7 // Header file for class VP1MaterialButton //
8 // //
9 // Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10 // //
11 // Initial version: September 2007 //
12 // //
14 
15 #ifndef VP1MATERIALBUTTON_H
16 #define VP1MATERIALBUTTON_H
17 
19 
20 #include <QPushButton>
21 
22 class SoMaterial;
23 class IVP1System;
24 
25 class VP1MaterialButtonBase : public QPushButton, public VP1HelperClassBase{
26  Q_OBJECT
27  public:
28  VP1MaterialButtonBase(QWidget* parent, IVP1System * sys = 0, QString helpername = "")
29  : QPushButton(parent),VP1HelperClassBase(sys,helpername){};
30 
31  virtual bool setMaterial(SoMaterial*)=0;
32  virtual void copyValuesFromMaterial(SoMaterial*)=0;
33  virtual double lastAppliedTransparency() const=0;
34  virtual double lastAppliedShininess() const=0 ;
35  virtual double lastAppliedBrightness() const=0;
36 
37  virtual QByteArray saveState() const =0;
38  virtual void restoreFromState( const QByteArray& )=0 ;
39 
41  signals:
43 };
44 
45 
47 
48  Q_OBJECT
49 
50 public:
52  //
53  // Static methods for creating/editing "simple materials" (those
54  // edited in the simple mode of this button). Most typical use case
55  // is to first call createSimpleMaterial(..) to create a new simple
56  // material, and then subsequently connect it to some material
57  // button by the setMaterial(..) method:
58 
59  static SoMaterial* createMaterial( const QColor&, const double& brightness = 0.0, const double& transp = 0.0 );
60  static SoMaterial* createMaterial( const double& r, const double& g, double b, const double& brightness = 0.0,const double& transp = 0.0 );
61  static void setMaterialParameters( SoMaterial * m, const QColor&, const double& brightness = 0.0, const double& transp = 0.0 );
62  static void setMaterialParameters( SoMaterial * m, const double& r, const double& g, const double& b, const double& brightness = 0.0, const double& transp = 0.0 );
63 
65 
66  VP1MaterialButton(QWidget * parent = 0, int dim = 25);//dim<=0 => Won't change sizepolicy
67  virtual ~VP1MaterialButton();
68 
69  bool handleMaterial(SoMaterial *); //Returns false if already handling or null.
70  bool stopHandlingMaterial(SoMaterial *);//Returns false if didn't handle or null.
71  void clearHandledMaterials();
72 
73  void copyValuesFromMaterial(SoMaterial*);
74 
75  bool setMaterial(SoMaterial*);//calls copyValuesFromMaterial and handleMaterial in that order:
76 
77  QList<SoMaterial*> handledMaterials() const;
78 
79  void setText ( const QString & );//Forbidden!! Only here since Designer generated code needs it in public.
80 
81  void setDimension(int dim);
82 
83  QColor lastAppliedDiffuseColour() const;
84  QColor lastAppliedAmbientColour() const;
85  QColor lastAppliedSpecularColour() const;
86  QColor lastAppliedEmissiveColour() const;
87  double lastAppliedTransparency() const;
88  double lastAppliedShininess() const;
89  double lastAppliedBrightness() const;//Redundant
90 
91  QWidget& editWindow() ;
92 
93  QByteArray saveState() const;
94  void restoreFromState( const QByteArray& );
95 
96 signals:
97  void lastAppliedChanged(); // emitted when something changes
98 
99 public Q_SLOTS:
100  void showEditMaterialDialog();
101  void setMaterialText(const QString&);//If set to XXX, title will display "Edit Material XXX"
102 
103 protected Q_SLOTS:
104  void updatePreview();
106  void apply();
107  void reset();
108  void updateButton();
109  void switchMode();
110  void transparencyChanged();
111 
112 protected:
113  void mousePressEvent(QMouseEvent *event);
114  void mouseMoveEvent(QMouseEvent *event);
115  void dropEvent(QDropEvent *event);
116  void dragEnterEvent(QDragEnterEvent *event);
117 private:
118 
119  class Imp;
120  Imp * m_d;
121 
122 };
123 
124 #endif
beamspotman.r
def r
Definition: beamspotman.py:676
VP1MaterialButton::updateButton
void updateButton()
Definition: VP1MaterialButton.cxx:661
VP1MaterialButtonBase::VP1MaterialButtonBase
VP1MaterialButtonBase(QWidget *parent, IVP1System *sys=0, QString helpername="")
Definition: VP1MaterialButton.h:28
VP1MaterialButton::lastAppliedAmbientColour
QColor lastAppliedAmbientColour() const
Definition: VP1MaterialButton.cxx:168
VP1MaterialButton::apply
void apply()
Definition: VP1MaterialButton.cxx:632
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
VP1MaterialButton::updatePreview
void updatePreview()
Definition: VP1MaterialButton.cxx:477
VP1MaterialButton::transparencyChanged
void transparencyChanged()
Definition: VP1MaterialButton.cxx:682
VP1MaterialButton::saveState
QByteArray saveState() const
fill out with the state of the object (used for drag and drop etc)
Definition: VP1MaterialButton.cxx:935
VP1MaterialButton::VP1MaterialButton
VP1MaterialButton(QWidget *parent=0, int dim=25)
Definition: VP1MaterialButton.cxx:124
VP1MaterialButton
Definition: VP1MaterialButton.h:46
VP1MaterialButtonBase::lastAppliedBrightness
virtual double lastAppliedBrightness() const =0
VP1MaterialButtonBase::restoreFromState
virtual void restoreFromState(const QByteArray &)=0
VP1MaterialButton::lastAppliedDiffuseColour
QColor lastAppliedDiffuseColour() const
Definition: VP1MaterialButton.cxx:167
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
VP1MaterialButton::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Definition: VP1MaterialButton.cxx:840
VP1MaterialButton::dropEvent
void dropEvent(QDropEvent *event)
Definition: VP1MaterialButton.cxx:916
VP1MaterialButton::stopHandlingMaterial
bool stopHandlingMaterial(SoMaterial *)
Definition: VP1MaterialButton.cxx:459
VP1MaterialButton::handledMaterials
QList< SoMaterial * > handledMaterials() const
Definition: VP1MaterialButton.cxx:647
IVP1System
Definition: IVP1System.h:36
VP1MaterialButton::~VP1MaterialButton
virtual ~VP1MaterialButton()
Definition: VP1MaterialButton.cxx:150
VP1MaterialButton::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event)
Definition: VP1MaterialButton.cxx:909
VP1MaterialButtonBase::lastAppliedShininess
virtual double lastAppliedShininess() const =0
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
VP1MaterialButton::setMaterialParameters
static void setMaterialParameters(SoMaterial *m, const QColor &, const double &brightness=0.0, const double &transp=0.0)
Definition: VP1MaterialButton.cxx:802
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
VP1MaterialButton::lastAppliedBrightness
double lastAppliedBrightness() const
Definition: VP1MaterialButton.cxx:173
VP1MaterialButton::Imp
Definition: VP1MaterialButton.cxx:48
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1MaterialButton::setText
void setText(const QString &)
Definition: VP1MaterialButton.cxx:653
VP1MaterialButton::lastAppliedSpecularColour
QColor lastAppliedSpecularColour() const
Definition: VP1MaterialButton.cxx:169
VP1MaterialButton::updatePreviewSceneAndBgd
void updatePreviewSceneAndBgd()
Definition: VP1MaterialButton.cxx:487
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
VP1MaterialButton::lastAppliedChanged
void lastAppliedChanged()
VP1MaterialButtonBase::copyValuesFromMaterial
virtual void copyValuesFromMaterial(SoMaterial *)=0
VP1MaterialButton::copyValuesFromMaterial
void copyValuesFromMaterial(SoMaterial *)
Definition: VP1MaterialButton.cxx:243
VP1MaterialButton::setMaterial
bool setMaterial(SoMaterial *)
Definition: VP1MaterialButton.cxx:447
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
VP1MaterialButton::createMaterial
static SoMaterial * createMaterial(const QColor &, const double &brightness=0.0, const double &transp=0.0)
Definition: VP1MaterialButton.cxx:786
VP1MaterialButtonBase::setMaterial
virtual bool setMaterial(SoMaterial *)=0
VP1MaterialButton::setDimension
void setDimension(int dim)
Definition: VP1MaterialButton.cxx:673
VP1HelperClassBase.h
VP1MaterialButtonBase
Definition: VP1MaterialButton.h:25
VP1MaterialButton::lastAppliedShininess
double lastAppliedShininess() const
Definition: VP1MaterialButton.cxx:172
VP1MaterialButton::reset
void reset()
Definition: VP1MaterialButton.cxx:641
VP1MaterialButton::showEditMaterialDialog
void showEditMaterialDialog()
Definition: VP1MaterialButton.cxx:182
VP1MaterialButton::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition: VP1MaterialButton.cxx:848
VP1MaterialButtonBase::saveState
virtual QByteArray saveState() const =0
fill out with the state of the object (used for drag and drop etc)
VP1MaterialButton::editWindow
QWidget & editWindow()
Definition: VP1MaterialButton.cxx:175
VP1MaterialButtonBase::~VP1MaterialButtonBase
virtual ~VP1MaterialButtonBase()
Definition: VP1MaterialButton.h:40
VP1MaterialButton::restoreFromState
void restoreFromState(const QByteArray &)
Definition: VP1MaterialButton.cxx:941
VP1MaterialButton::setMaterialText
void setMaterialText(const QString &)
Definition: VP1MaterialButton.cxx:191
VP1MaterialButton::switchMode
void switchMode()
Definition: VP1MaterialButton.cxx:745
VP1MaterialButton::clearHandledMaterials
void clearHandledMaterials()
Definition: VP1MaterialButton.cxx:469
VP1MaterialButton::lastAppliedTransparency
double lastAppliedTransparency() const
Definition: VP1MaterialButton.cxx:171
VP1MaterialButton::lastAppliedEmissiveColour
QColor lastAppliedEmissiveColour() const
Definition: VP1MaterialButton.cxx:170
VP1MaterialButtonBase::lastAppliedChanged
void lastAppliedChanged()
VP1MaterialButtonBase::lastAppliedTransparency
virtual double lastAppliedTransparency() const =0
VP1MaterialButton::m_d
Imp * m_d
Definition: VP1MaterialButton.h:119
VP1MaterialButton::handleMaterial
bool handleMaterial(SoMaterial *)
Definition: VP1MaterialButton.cxx:436