• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kalzium

color.h

Go to the documentation of this file.
00001 /**********************************************************************
00002   Color - Base class for handling color changes in OpenGL
00003 
00004   Copyright (C) 2006 Benoit Jacob
00005   Copyright (C) 2007 Geoffrey R. Hutchison
00006 
00007   This file is part of the Avogadro molecular editor project.
00008   For more information, see <http://avogadro.sourceforge.net/>
00009 
00010   Avogadro is free software; you can redistribute it and/or modify
00011   it under the terms of the GNU General Public License as published by
00012   the Free Software Foundation; either version 2 of the License, or
00013   (at your option) any later version.
00014 
00015   Avogadro is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018   GNU General Public License for more details.
00019 
00020   You should have received a copy of the GNU General Public License
00021   along with this program; if not, write to the Free Software
00022   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00023   02110-1301, USA.
00024  **********************************************************************/
00025 
00026 #ifndef COLOR_H
00027 #define COLOR_H
00028 
00029 #include <avogadro/global.h>
00030 
00031 #include <QGLWidget> // for GLfloat
00032 #include <QColor> // for returning QColor
00033 
00034 namespace Avogadro {
00035 
00036   class Primitive;
00037   class ColorPrivate; // for future expansion
00038 
00047   class A_EXPORT Color
00048   {
00049   public:
00050     Color();
00051     virtual ~Color();
00052 
00058     Color( GLfloat red, GLfloat green, GLfloat blue,
00059         GLfloat alpha = 1.0 );
00060 
00066     Color( const Primitive * );
00067 
00072     Color& operator= (const QColor &);
00073 
00079     virtual void set(GLfloat red, GLfloat green, GLfloat blue,
00080                      GLfloat alpha = 1.0 );
00081 
00086     virtual void setToSelectionColor();
00087 
00093     virtual void set(const Primitive *);
00094 
00099     virtual void setAlpha(double alpha);
00100 
00105     inline virtual void apply()
00106     {
00107       glColor4fv( &m_red );
00108     }
00109 
00115     virtual void applyAsMaterials();
00116 
00120     virtual void applyAsFlatMaterials();
00121 
00125     inline QColor color() { return QColor(static_cast<int>(m_red),
00126                                           static_cast<int>(m_blue),
00127                                           static_cast<int>(m_green),
00128                                           static_cast<int>(m_alpha)); }
00129 
00133     inline float red() { return m_red; }
00137     inline float green() { return m_green; }
00141     inline float blue() { return m_blue; }
00145     inline float alpha() { return m_alpha; }
00146 
00150     virtual void setName(const QString& name);
00154     virtual QString name() const;
00158     virtual QString type() const { return "Virtual Base Class"; }
00159 
00163     virtual QWidget *settingsWidget() { return NULL; }
00164 
00165   protected:
00182     GLfloat m_red, m_green, m_blue, m_alpha;
00183 
00187     QString m_name;
00188 
00192     ColorPrivate *d;
00193   };
00194 
00195 }
00196 
00197 #endif

kalzium

Skip menu "kalzium"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal