ATLAS Offline Software
Loading...
Searching...
No Matches
VP1MaterialButton.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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
22class SoMaterial;
23class IVP1System;
24
25class VP1MaterialButtonBase : public QPushButton, public VP1HelperClassBase{
26 Q_OBJECT
27 public:
28 VP1MaterialButtonBase(QWidget* parent, IVP1System * sys = 0, const 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
50public:
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.
72
73 void copyValuesFromMaterial(SoMaterial*);
74
75 bool setMaterial(SoMaterial*);//calls copyValuesFromMaterial and handleMaterial in that order:
76
77 const 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
96signals:
97 void lastAppliedChanged(); // emitted when something changes
98
99public Q_SLOTS:
101 void setMaterialText(const QString&);//If set to XXX, title will display "Edit Material XXX"
102
103protected Q_SLOTS:
104 void updatePreview();
106 void apply();
107 void reset();
108 void updateButton();
109 void switchMode();
110 void transparencyChanged();
111
112protected:
113 void mousePressEvent(QMouseEvent *event);
114 void mouseMoveEvent(QMouseEvent *event);
115 void dropEvent(QDropEvent *event);
116 void dragEnterEvent(QDragEnterEvent *event);
117private:
118
119 class Imp;
121
122};
123
124#endif
VP1HelperClassBase(IVP1System *sys=0, QString helpername="")
virtual void restoreFromState(const QByteArray &)=0
virtual double lastAppliedShininess() const =0
virtual double lastAppliedBrightness() const =0
virtual bool setMaterial(SoMaterial *)=0
virtual void copyValuesFromMaterial(SoMaterial *)=0
virtual double lastAppliedTransparency() const =0
VP1MaterialButtonBase(QWidget *parent, IVP1System *sys=0, const QString &helpername="")
virtual QByteArray saveState() const =0
fill out with the state of the object (used for drag and drop etc)
void setText(const QString &)
bool stopHandlingMaterial(SoMaterial *)
static void setMaterialParameters(SoMaterial *m, const QColor &, const double &brightness=0.0, const double &transp=0.0)
void setMaterialText(const QString &)
void mousePressEvent(QMouseEvent *event)
void dragEnterEvent(QDragEnterEvent *event)
QColor lastAppliedEmissiveColour() const
static SoMaterial * createMaterial(const QColor &, const double &brightness=0.0, const double &transp=0.0)
const QList< SoMaterial * > & handledMaterials() const
QColor lastAppliedAmbientColour() const
bool setMaterial(SoMaterial *)
void dropEvent(QDropEvent *event)
double lastAppliedBrightness() const
void copyValuesFromMaterial(SoMaterial *)
VP1MaterialButton(QWidget *parent=0, int dim=25)
void lastAppliedChanged()
void mouseMoveEvent(QMouseEvent *event)
QByteArray saveState() const
fill out with the state of the object (used for drag and drop etc)
void restoreFromState(const QByteArray &)
double lastAppliedTransparency() const
QColor lastAppliedDiffuseColour() const
QColor lastAppliedSpecularColour() const
bool handleMaterial(SoMaterial *)
double lastAppliedShininess() const
int r
Definition globals.cxx:22