lightSettings.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_VIEW_DIALOGS_LIGHTSETTINGS_H
00006 #define BALL_VIEW_DIALOGS_LIGHTSETTINGS_H
00007 
00008 #ifndef BALL_COMMON_GLOBAL_H
00009 # include <BALL/COMMON/global.h>
00010 #endif
00011 
00012 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY
00013 # include <BALL/VIEW/KERNEL/preferencesEntry.h>
00014 #endif
00015 
00016 #ifndef BALL_VIEW_KERNEL_STAGE_H
00017 # include <BALL/VIEW/KERNEL/stage.h>
00018 #endif
00019 
00020 #include <BALL/VIEW/UIC/ui_lightSettings.h>
00021 
00022 namespace BALL
00023 {
00024   namespace VIEW
00025   {
00026     class Scene;
00027 
00034     class BALL_VIEW_EXPORT LightSettings 
00035       : public QWidget,
00036         public Ui_LightSettingsData,
00037         public PreferencesEntry
00038     { 
00039       Q_OBJECT
00040 
00041       public:
00042 
00044       LightSettings( QWidget* parent = 0, const char* name = "LightSettings", 
00045                     Qt::WFlags fl = 0 );
00046 
00048       ~LightSettings() {}
00049 
00051       void update();
00052 
00054       void updateFromStage();
00055 
00057       void apply();
00058 
00060       virtual void restoreDefaultValues(bool /*all*/ = false);
00061 
00063       void restoreValues(bool all);
00064       
00065       public slots:
00066 
00068       virtual void addLightPressed();
00069 
00071       virtual void colorPressed();
00072       
00074       virtual void defaultsPressed();
00075       
00077       virtual void lightSelected(QListWidgetItem* current_item, QListWidgetItem* previous_item);
00078       
00080       virtual void removeLightPressed();
00081 
00083       virtual void typeSelected();
00084 
00086       virtual void intensityChanged();
00087 
00089       virtual void positionTypeChanged();
00090 
00091       protected:
00092 
00093       void setPosition_(const Vector3& v);
00094       void setDirection_(const Vector3& v);
00095       void setAttenuation_(const Vector3& a);
00096       Vector3 getDirection_() throw(Exception::InvalidFormat);
00097       Vector3 getPosition_() throw(Exception::InvalidFormat);
00098       Vector3 getAttenuation_() throw(Exception::InvalidFormat);
00099       void setControlsEnabled_(bool state);
00100       Index getCurrentLightNumber_() const;
00101 
00102       void typeSelected_(Position type);
00103     
00104       //_ apply values to a light
00105       void saveSettingsToLight_();
00106 
00107       //_ show the values of a light, after selecting an other one
00108       void getValues_(Index light = -1);
00109 
00110       //_ empty all fields
00111       void clearFields_();
00112 
00113       Stage* stage_;
00114 
00115       //__ temporary copy of all lights
00116       vector<LightSource> lights_;
00117 
00118       //__ default lights
00119       vector<LightSource> default_lights_;
00120       
00121       bool ignore_;
00122       Index current_light_;
00123     };
00124 
00125   }
00126 }
00127 
00128 #endif