Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

AIDA_InfoStyle.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00004 //                                                                     //
00005 //  This library is free software; you can redistribute it and/or      //
00006 //  modify it under the terms of the GNU Lesser General Public         //
00007 //  License as published by the Free Software Foundation; either       //
00008 //  version 2.1 of the License, or (at your option) any later version. //
00009 //                                                                     //
00010 //  This library is distributed in the hope that it will be useful,    //
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of     //
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   //
00013 //  Lesser General Public License for more details.                    //
00014 //                                                                     //
00015 //  You should have received a copy of the GNU Lesser General Public   //
00016 //  License along with this library (see file COPYING); if not, write  //
00017 //  to the Free Software Foundation, Inc., 59 Temple Place, Suite      //
00018 //  330, Boston, MA 02111-1307 USA, or contact the author.             //
00019 //                                                                     //
00021 
00030 // 
00031 // Created by user sang on Sun Oct  6 17:47:12 2002
00032 // 
00033 
00034 
00035 
00036 #include "AIDA_InfoStyle.h"
00037 #include "AIDA_TextStyle.h"
00038 #include "GracePlotter/LegendBoxStyle.h"
00039 
00040 #include <iostream>
00041 
00042 
00043 
00044 namespace Anaphe {
00045 namespace AIDA_Plotter_Grace {
00046 
00047 
00048 
00049 
00051 //                                        //
00052 // Constructors, destructor and operator= //
00053 //                                        //
00055 
00056 AIDA_InfoStyle::AIDA_InfoStyle()
00057   : rep   (0),
00058     ownRep(false)
00059 {
00060   // no-op
00061 }
00062 
00063 
00064 
00065 AIDA_InfoStyle::AIDA_InfoStyle(LegendBoxStyle* x, bool b)
00066   : rep   (x),
00067     ownRep(b)
00068 {
00069   // no-op
00070 }
00071 
00072 
00073 
00074 AIDA_InfoStyle::~AIDA_InfoStyle()
00075 {
00076   if (ownRep) delete rep;
00077 }
00078 
00079 
00080 
00081 
00082 
00084 //                //
00085 // Public methods //
00086 //                //
00088 
00089 void AIDA_InfoStyle::reset()
00090 {
00091   if (!rep) { 
00092     crisis();
00093     return;
00094   }
00095   rep->reset();
00096 }
00097 
00098 
00099 
00100 
00101 bool AIDA_InfoStyle::setParameter(const std::string& paramName, 
00102                                     const std::string& options)
00103 {
00104   if (!rep) { 
00105     crisis();
00106     return false;
00107   }
00108   return rep->setParameter(paramName,options);
00109 }
00110 
00111 
00112 
00113 
00114 std::string AIDA_InfoStyle::parameterValue(const std::string& param) const
00115 {
00116   if (!rep) { 
00117     crisis();
00118     return "";
00119   }
00120   return rep->parameterValue(param);
00121 }
00122 
00123 
00124 
00125 
00126 std::vector<std::string> AIDA_InfoStyle::availableParameters() const
00127 {
00128   if (!rep) { 
00129     crisis();
00130     return std::vector<std::string>();
00131   }
00132   return rep->availableParameters();
00133 }
00134 
00135 
00136 
00137 
00138 std::vector<std::string> 
00139 AIDA_InfoStyle::availableParameterOptions(const std::string& paramName) const
00140 {
00141   if (!rep) { 
00142     crisis();
00143     return std::vector<std::string>();
00144   }
00145   return rep->availableOptions(paramName);
00146 }
00147 
00148 
00149 
00150 
00151 AIDA::ITextStyle& AIDA_InfoStyle::textStyle()
00152 {
00153   static AIDA_TextStyle pr;
00154   if (!rep) { 
00155     crisis();
00156     return pr;
00157   }
00158   TextStyle& gts = rep->textStyle();
00159   pr.setRep(gts,false);
00160   return pr;
00161 }
00162 
00163 
00164 
00165 
00166 bool AIDA_InfoStyle::setTextStyle(const AIDA::ITextStyle& textStyle)
00167 {
00168   if (!rep) { 
00169     crisis();
00170     return false;
00171   }
00172   const AIDA_TextStyle* pr = dynamic_cast<const AIDA_TextStyle*>(&textStyle);
00173   if (!pr) return false;
00174   AIDA_TextStyle* ncpr = const_cast<AIDA_TextStyle*>(pr);
00175   const TextStyle* tsrep = ncpr->theRep();
00176   if (tsrep == 0) return false;
00177   else {
00178     rep->setTextStyle(*tsrep);
00179     return true;
00180   }
00181 }
00182 
00183 
00184 
00185 
00186 void AIDA_InfoStyle::setRep(LegendBoxStyle& s, bool ownership)
00187 {
00188   if (ownRep) delete rep;
00189   rep = &s;
00190   ownRep = ownership;
00191 }
00192 
00193 
00194 
00195 LegendBoxStyle* AIDA_InfoStyle::theRep()
00196 {
00197   return rep;
00198 }
00199 
00200 
00201 
00203 //                 //
00204 // Private methods //
00205 //                 //
00207 
00208 void AIDA_InfoStyle::crisis() const
00209 {
00210   std::cout << "*** AIDA_Plotter_Grace SEVERE ERROR: proxy failure in AIDA_InfoStyle" << std::endl; 
00211 }
00212 
00213 
00214 
00215 
00216 } // end of namespace AIDA_Plotter_Grace
00217 } // end of namespace Anaphe
00218 

Generated on Tue Jan 28 13:30:45 2003 for Anaphe_AIDA_Plotter_Grace by doxygen1.2.16