kstars
colorscheme.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 colorscheme.h - description 00003 ------------------- 00004 begin : Wed May 8 2002 00005 copyright : (C) 2002 by Jason Harris 00006 email : kstars@30doradus.org 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef COLORSCHEME_H 00019 #define COLORSCHEME_H 00020 00021 #include <qmap.h> 00022 #include <qstringlist.h> 00023 00024 class KConfig; 00025 00039 class ColorScheme { 00040 00041 public: 00042 00046 ColorScheme(); 00047 00050 ColorScheme( const ColorScheme &cs ); 00051 00054 ~ColorScheme(); 00055 00058 bool hasColorNamed( const QString &name ) const { return ( ! Palette[ name ].isEmpty() ); } 00059 00065 QString colorNamed( const QString &name ) const; 00066 00070 QString colorAt( int i ) const; 00071 00075 QString nameAt( int i ) const; 00076 00080 QString keyAt( int i ) const; 00081 00086 QString nameFromKey( const QString &key ) const; 00087 00092 void setColor( const QString &key, const QString &color ); 00093 00098 bool load( const QString &filename ); 00099 00104 bool save( const QString &name ); 00105 00108 QString fileName() const { return FileName; } 00109 00113 void copy( const ColorScheme &cs ); 00114 00117 void loadFromConfig( KConfig* ); 00118 00121 void saveToConfig( KConfig* ); 00122 00124 unsigned int numberOfColors() const { return (int)Palette.size(); } 00125 00127 int starColorMode() const { return StarColorMode; } 00128 00130 int starColorIntensity() const { return StarColorIntensity; } 00131 00133 void setStarColorMode( int mode ) { StarColorMode = mode; } 00134 00136 void setStarColorIntensity( int intens) { StarColorIntensity = intens; } 00137 00138 private: 00139 int StarColorMode, StarColorIntensity; 00140 QString FileName; 00141 QStringList KeyName, Name, Default; 00142 QMap<QString,QString> Palette; 00143 00144 }; 00145 00146 #endif