00001 #ifndef COLOR_CLASS 00002 #define COLOR_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : color * 00007 * Author : Chris Koeritz * 00008 * * 00009 * Purpose: * 00010 * * 00011 * Represents the attribute of color for a windowing sytem. * 00012 * * 00013 ******************************************************************************* 00014 * Copyright (c) 1991-$now By Author. This program is free software; you can * 00015 * redistribute it and/or modify it under the terms of the GNU General Public * 00016 * License as published by the Free Software Foundation; either version 2 of * 00017 * the License or (at your option) any later version. This is online at: * 00018 * http://www.fsf.org/copyleft/gpl.html * 00019 * Please send any updates to: fred@gruntose.com * 00020 \*****************************************************************************/ 00021 00022 #include "dll_wp_passive.h" 00023 00024 class WP_PASSIVE_CLASS_STYLE color 00025 { 00026 public: 00027 color(int red = 0, int green = 0, int blue = 0); 00028 ~color(); 00029 00030 int red() const; 00031 int green() const; 00032 int blue() const; 00033 00034 void red(int red); 00035 void green(int green); 00036 void blue(int blue); 00037 // observes or modifies the components of the color. because modifying 00038 // a color changes its screen interpretation, the rgb modifiers also 00039 // invalidate the color's palette index; the color must be added to the 00040 // palette again to be revalidated. 00041 00042 bool operator == (const color &to_compare) const; 00043 bool operator != (const color &to_compare) const; 00044 00045 int index() const; 00046 // returns the index of this color in the system color table. this is 00047 // not accurate until the color has been added to the color table; the 00048 // default index is a negative number. 00049 00050 void index(int new_index); 00051 // sets the index for this color in the color map. 00052 00053 istring text_form() const; 00054 00055 private: 00056 int _red, _green, _blue; 00057 int _index; 00058 }; 00059 00060 #endif 00061
1.5.1