00001
00002
00003
00004 #include "gui/DisplayRep.h"
00005
00006 namespace gui {
00007
00008 class DisplayRep::Dummy : public DisplayRep {
00009
00010
00011 friend class DisplayRep;
00012 void update(){}
00013 };
00014
00015 DisplayRep&
00016 DisplayRep::nested()
00017 {
00018 DisplayRep& inner = *new Dummy;
00019 addDisplayList(&(inner));
00020 return inner;
00021 }
00022
00023 void
00024 DisplayRep::clear()
00025 {
00026 deleteRepresentation();
00027 }
00028 bool
00029 DisplayRep::empty()const
00030 {
00031 return !hasRepresentation();
00032 }
00033
00034
00035 void
00036 DisplayRep::append(DisplayRep& other)
00037 {
00038 other.update();
00039 DisplayList::append(&other);
00040 }
00041
00042 void
00043 DisplayRep::append(const DisplayRep& other)
00044 {
00045 append(const_cast<DisplayRep&>(other));
00046 }
00047
00048 void
00049 DisplayRep::setColor(const std::string& color_name)
00050 {
00051 int i=0;
00052 while(pallete[i].name ) {
00053 if( std::string(pallete[i].name) == color_name ){
00054 set_col_index(i);
00055 return;
00056 }
00057 i++;
00058 }
00059 set_color("black");
00060 }
00061
00062 DisplayRep::ColorInfo
00063 DisplayRep::pallete[]= {
00064 { "white", 255, 255, 255},
00065 { "black", 0, 0, 0 },
00066 { "wheat", 245, 222, 179},
00067 { "violet", 238, 130, 238},
00068 { "turquoise", 64, 224, 208},
00069 { "thistle", 216, 191, 216},
00070 { "tan", 210, 180, 140},
00071 { "sienna", 160, 82, 45},
00072 { "salmon", 250, 128, 114},
00073 { "red", 255, 0, 0},
00074 { "plum", 221, 160, 221},
00075 { "pink", 255, 192, 203},
00076 { "orchid", 218, 112, 214},
00077 { "orange", 255, 165, 0},
00078 { "maroon", 176, 48, 96},
00079 { "magenta", 255, 0, 255},
00080 { "khaki", 240, 230, 140},
00081 { "grey", 128, 128, 128},
00082 { "green", 0, 255, 0},
00083 { "gold", 255, 215, 0},
00084 { "brown", 165, 42, 42},
00085 { "cyan", 0, 255, 255},
00086 { "coral", 255, 127, 80},
00087 { "navy", 0, 0, 128},
00088 { "blue", 0, 0, 255},
00089 { "yellow", 255, 255, 0},
00090 { "aquamarine",127, 255, 212},
00091 { 0, 0, 0,0}
00092 };
00093
00094 }