uniformwidget.h

Go to the documentation of this file.
00001 //=============================================================================
00016 #ifndef __UNIFORMWIDGET_H_INCLUDED__
00017 #define __UNIFORMWIDGET_H_INCLUDED__
00018 
00019 #include <QtGui/QWidget>
00020 #include <QtGui/QComboBox>
00021 #include <QtGui/QPushButton>
00022 #include <QtGui/QLabel>
00023 #include <QtGui/QSpinBox>
00024 
00025 
00026 // forward declarations
00027 class CUniform;
00028 class CUniversalSlider;
00029 class IUniformState;
00030 
00031 
00032 //=============================================================================
00033 //  CUniformWidget
00034 //=============================================================================
00035 
00036 
00045 class CUniformWidget : public QWidget
00046 {
00047     Q_OBJECT
00048 public:
00054     CUniformWidget( IUniformState* us );
00055     virtual ~CUniformWidget( void ); 
00056 
00057 public slots:
00062     void updateUniformList( void );
00063 
00064 private slots:
00065     void componentChanged( int component );
00066     void setActiveUniform( int active );
00067     void setActiveMatrixColumn( int column );
00068     void selectColor( bool );
00069 
00070 private:
00071 
00072     void clearContent( void );
00073     void readContentFromState( void );
00074 
00075     // accesses the active uniform, selected by m_activeUniform
00076     void loadActiveUniform( CUniform & u );
00077     void saveActiveUniform( const CUniform & u );
00078 
00079     void updateColorButton( const CUniform & u );
00080     void updateMatrixColumnBox( const CUniform & u );
00081 
00082     void downloadUniform( CUniform & u, int component );
00083     void uploadUniform( const CUniform & u );
00084     void uploadUniformData( const CUniform & u );
00085 
00086     bool acceptsUniform( const CUniform & u );
00087 
00088     // maps combo box indices to uniform state indices
00089     int* m_indexMap; // [ m_numUniforms ]
00090     int  m_numUniforms;
00091 
00092     // skip signals if != 0
00093     int m_skipComponentChanged;
00094     int m_skipSetActiveUniform;
00095     int m_skipSetActiveMatrixColumn;
00096 
00097     // used to react to setActiveUniform
00098     int m_lastActiveUniform;
00099 
00100     // widgets
00101     QComboBox*          m_activeUniform;
00102     QSpinBox*           m_activeMatrixColumn;
00103     QPushButton*        m_colorButton;
00104     QLabel*             m_typeLabel; // type info of the active uniform
00105     CUniversalSlider*   m_components[ 4 ];
00106 
00107     // where the infos are applied to
00108     IUniformState*  m_uniformState;
00109 };
00110 
00111 
00112 #endif  // __UNIFORMWIDGET_H_INCLUDED__
00113 

Generated on Sun Mar 2 17:12:31 2008 for Shader Maker by  doxygen 1.5.4