00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 00011 00012 #ifndef TEXT_H 00013 #define TEXT_H 00014 00015 #include "ColorType.h" 00016 #include "LocationType.h" 00017 #include "PlotObject.h" 00018 00019 /** 00020 * A text object that can be displayed in a plot 00021 * 00022 * This subclass of Subject will notify upon the following conditions: 00023 * - The following methods are called: setLocation(), setText(), setColor(). 00024 * - Everything else documented in PlotObject. 00025 * 00026 * @see Text 00027 */ 00028 class Text : public PlotObject 00029 { 00030 public: 00031 /** 00032 * Emitted with any<LocationType> when the text is moved. 00033 */ 00034 SIGNAL_METHOD(Text, LocationChanged) 00035 /** 00036 * Emitted with any<ColorType> when the color is changed. 00037 */ 00038 SIGNAL_METHOD(Text, ColorChanged) 00039 /** 00040 * Emitted with any<std::string> when the text is changed. 00041 */ 00042 SIGNAL_METHOD(Text, TextChanged) 00043 00044 /** 00045 * Returns the texts x location 00046 * 00047 * @return The x location 00048 */ 00049 virtual double getXLocation() const = 0; 00050 00051 /** 00052 * Returns the texts y location 00053 * 00054 * @return The y location 00055 */ 00056 virtual double getYLocation() const = 0; 00057 00058 /** 00059 * Returns the text location 00060 * 00061 * @return The text location 00062 * 00063 * @see LocationType 00064 */ 00065 virtual const LocationType& getLocation() const = 0; 00066 00067 /** 00068 * Returns the text 00069 * 00070 * @return The text 00071 */ 00072 virtual std::string getText() const = 0; 00073 00074 /** 00075 * Returns the text color 00076 * 00077 * @return The text color 00078 */ 00079 virtual ColorType getColor() const = 0; 00080 00081 /** 00082 * Determines if this plot object resides at this point, most likely a mouse click 00083 * 00084 * @param point The location of the mouse click 00085 * @return True if the plot object is at this point 00086 */ 00087 virtual bool hit(LocationType point) const = 0; 00088 00089 /** 00090 * Sets the text location 00091 * 00092 * @param location The new location 00093 * 00094 * @see LocationType 00095 * 00096 * @notify This method will notify signalLocationChanged with any<LocationType>. 00097 */ 00098 virtual void setLocation(const LocationType& location) = 0; 00099 00100 /** 00101 * Sets the text location 00102 * 00103 * @param dX The x location 00104 * @param dY The y location 00105 * 00106 * @notify This method will notify signalLocationChanged with any<LocationType>. 00107 */ 00108 virtual void setLocation(double dX, double dY) = 0; 00109 00110 /** 00111 * Sets the text 00112 * 00113 * @param strText The new text 00114 * 00115 * @notify This method will notify signalTextChanged with any<std::string>. 00116 */ 00117 virtual void setText(const std::string& strText) = 0; 00118 00119 /** 00120 * Sets the text color 00121 * 00122 * @param clrText The new color 00123 * 00124 * @notify This method will notify signalColorChanged with any<ColorType>. 00125 */ 00126 virtual void setColor(const ColorType& clrText) = 0; 00127 00128 protected: 00129 /** 00130 * This should be destroyed by calling PlotView::deleteObject. 00131 */ 00132 virtual ~Text() {} 00133 }; 00134 00135 #endif