25 #define MAX_DEBUG_LABEL_LEN 32
28 #define YUILogComponent "ui"
31 #include "YUISymbols.h"
44 , isHeading( isHeading )
45 , isOutputField( isOutputField )
46 , useBoldFont( false )
57 const std::string & text,
63 YUI_CHECK_NEW( priv );
87 return priv->isHeading;
93 return priv->isOutputField;
99 return priv->useBoldFont;
105 priv->useBoldFont = bold;
122 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
123 propSet.
add(
YProperty( YUIProperty_Value, YStringProperty ) );
124 propSet.
add(
YProperty( YUIProperty_Text, YStringProperty ) );
166 std::string label =
text();
168 if ( label.size() > MAX_DEBUG_LABEL_LEN )
170 label.resize( MAX_DEBUG_LABEL_LEN );
171 label.append(
"..." );
174 for ( std::string::size_type i=0; i < label.size(); i++ )
176 if ( label[i] ==
'\n' ) label[i] =
' ';
177 if ( label[i] ==
'\"' ) label[i] =
' ';
188 if ( priv->isHeading )
return "YLabel_Heading";
189 else if ( priv->isOutputField )
return "YLabel_OutputField";
190 else return "YLabel";
bool useBoldFont() const
Return 'true' if a bold font should be used.
void add(const YProperty &prop)
Add a property to this property set.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
std::string text() const
Return the text the widget displays.
A set of properties to check names and types against.
virtual ~YLabel()
Destructor.
bool isEmpty() const
Returns 'true' if this property set does not contain anything.
std::string stringVal() const
Methods to get the value of this property.
YPropertyType type() const
Returns the type of this property value.
YLabelPrivate(const std::string &text, bool isHeading, bool isOutputField)
Constructor.
Class for widget properties.
bool isHeading() const
Return 'true' if this is a Heading widget, i.e., it should display its text in a bold and/or larger f...
YLabel(YWidget *parent, const std::string &text, bool isHeading=false, bool isOutputField=false)
Constructor.
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
virtual void setText(const std::string &newText)
Set the text the widget displays.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
virtual std::string debugLabel() const
Returns a descriptive label of this widget instance for debugging.
bool isOutputField() const
Return 'true' if this is an OutputField widget, i.e., it should display its text similar to an InputF...
Transport class for the value of simple properties.
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
virtual void setUseBoldFont(bool bold=true)
Switch bold font on or off.
virtual const YPropertySet & propertySet()
Return this class's property set.