casa
$Rev:20696$
|
Text label associated with a RegionShape. More...
#include <RegionShape.h>
Public Member Functions | |
RegionShapeLabel (String text="") | |
Constructor. | |
~RegionShapeLabel () | |
Destructor. | |
void | setText (const String &text) |
Sets this label's text to the given. | |
void | setFont (const String &font) |
Sets this label's font family to the given. | |
void | setSize (int size) |
Sets the label's font point size to the given. | |
void | setColor (const String &color) |
Sets the label's font color to the given. | |
void | setItalic (bool italic=true) |
Sets whether the label's font is italic or not. | |
void | setBold (bool bold=true) |
Sets whether the label's font is bold or not. | |
void | setAngle (double angle) |
Sets the rotation angle to the given (in degrees). | |
bool | isEmpty () const |
Returns true if this label has empty text, false otherwise. | |
const String & | text () const |
Returns the text for this label. | |
const String & | font () const |
Returns the font family for this label. | |
int | size () const |
Returns the point size for this label. | |
const String & | color () const |
Returns the color for this label. | |
bool | isItalic () const |
Returns true if this label's font is italic, false otherwise. | |
bool | isBold () const |
Returns true if this label's font is bold, false otherwise. | |
double | angle () const |
Returns this label's angle. | |
void | setFont (PixelCanvas *pc) const |
Sets the font on the given PixelCanvas. | |
int | width (PixelCanvas *pc) const |
Returns the result of pc->textWidth() after setting the font. | |
int | height (PixelCanvas *pc) const |
Returns the result of pc->textHeight() after setting the font. | |
bool | draw (PixelCanvas *pc, int x, int y, bool bottom=false, String *error=NULL) |
Draws itself on the given pixel canvas and returns whether the operation succeeded or not. | |
Static Public Attributes | |
static const String | DEFAULT_FONT |
Static Members //. | |
static const int | DEFAULT_POINTSIZE |
Private Attributes | |
String | m_text |
String | m_font |
int | m_pointSize |
String | m_color |
bool | m_italic |
bool | m_bold |
double | m_angle |
Text label associated with a RegionShape.
Definition at line 45 of file RegionShape.h.
casa::RegionShapeLabel::RegionShapeLabel | ( | String | text = "" | ) |
Constructor.
Destructor.
double casa::RegionShapeLabel::angle | ( | ) | const |
Returns this label's angle.
const String& casa::RegionShapeLabel::color | ( | ) | const |
Returns the color for this label.
bool casa::RegionShapeLabel::draw | ( | PixelCanvas * | pc, |
int | x, | ||
int | y, | ||
bool | bottom = false , |
||
String * | error = NULL |
||
) |
Draws itself on the given pixel canvas and returns whether the operation succeeded or not.
x and y are the screen pixel coordinates to draw the label. If bottom is false, the label is centered on (x, y); otherwise the label is drawn with (x, y) at its bottom center point.
const String& casa::RegionShapeLabel::font | ( | ) | const |
Returns the font family for this label.
int casa::RegionShapeLabel::height | ( | PixelCanvas * | pc | ) | const |
Returns the result of pc->textHeight() after setting the font.
bool casa::RegionShapeLabel::isBold | ( | ) | const |
Returns true if this label's font is bold, false otherwise.
bool casa::RegionShapeLabel::isEmpty | ( | ) | const |
Returns true if this label has empty text, false otherwise.
bool casa::RegionShapeLabel::isItalic | ( | ) | const |
Returns true if this label's font is italic, false otherwise.
void casa::RegionShapeLabel::setAngle | ( | double | angle | ) |
Sets the rotation angle to the given (in degrees).
This angle is in pixel coordinates. Rotation is counterclockwise.
void casa::RegionShapeLabel::setBold | ( | bool | bold = true | ) |
Sets whether the label's font is bold or not.
Note: only QtPixelCanvas currently supports bold.
void casa::RegionShapeLabel::setColor | ( | const String & | color | ) |
Sets the label's font color to the given.
Note: while there is no formal specification for color format, Strings should be accepted in common name format ("black") or hexadecimal format ("#000000").
void casa::RegionShapeLabel::setFont | ( | const String & | font | ) |
Sets this label's font family to the given.
How it is handled when being drawn depends on the underlying PixelCanvas implementation.
void casa::RegionShapeLabel::setFont | ( | PixelCanvas * | pc | ) | const |
Sets the font on the given PixelCanvas.
Note: bold/italic only work for QtPixelCanvas.
void casa::RegionShapeLabel::setItalic | ( | bool | italic = true | ) |
Sets whether the label's font is italic or not.
Note: only QtPixelCanvas currently supports bold.
void casa::RegionShapeLabel::setSize | ( | int | size | ) |
Sets the label's font point size to the given.
void casa::RegionShapeLabel::setText | ( | const String & | text | ) |
Sets this label's text to the given.
int casa::RegionShapeLabel::size | ( | ) | const |
Returns the point size for this label.
const String& casa::RegionShapeLabel::text | ( | ) | const |
Returns the text for this label.
int casa::RegionShapeLabel::width | ( | PixelCanvas * | pc | ) | const |
Returns the result of pc->textWidth() after setting the font.
const String casa::RegionShapeLabel::DEFAULT_FONT [static] |
const int casa::RegionShapeLabel::DEFAULT_POINTSIZE [static] |
Definition at line 52 of file RegionShape.h.
double casa::RegionShapeLabel::m_angle [private] |
Definition at line 140 of file RegionShape.h.
bool casa::RegionShapeLabel::m_bold [private] |
Definition at line 139 of file RegionShape.h.
String casa::RegionShapeLabel::m_color [private] |
Definition at line 137 of file RegionShape.h.
String casa::RegionShapeLabel::m_font [private] |
Definition at line 135 of file RegionShape.h.
bool casa::RegionShapeLabel::m_italic [private] |
Definition at line 138 of file RegionShape.h.
int casa::RegionShapeLabel::m_pointSize [private] |
Definition at line 136 of file RegionShape.h.
String casa::RegionShapeLabel::m_text [private] |
Definition at line 134 of file RegionShape.h.