25 #define MAX_DEBUG_LABEL_LEN 32 28 #define YUILogComponent "ui" 31 #include "YUISymbols.h" 46 , isHeading( isHeading )
47 , isOutputField( isOutputField )
48 , useBoldFont( false )
65 YUI_CHECK_NEW( priv );
89 return priv->isHeading;
95 return priv->isOutputField;
101 return priv->useBoldFont;
107 priv->useBoldFont = bold;
124 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
125 propSet.
add(
YProperty( YUIProperty_Value, YStringProperty ) );
126 propSet.
add(
YProperty( YUIProperty_Text, YStringProperty ) );
168 string label =
text();
170 if ( label.size() > MAX_DEBUG_LABEL_LEN )
172 label.resize( MAX_DEBUG_LABEL_LEN );
173 label.append(
"..." );
176 for ( string::size_type i=0; i < label.size(); i++ )
178 if ( label[i] ==
'\n' ) label[i] =
' ';
179 if ( label[i] ==
'\"' ) label[i] =
' ';
190 if ( priv->isHeading )
return "YLabel_Heading";
191 else if ( priv->isOutputField )
return "YLabel_OutputField";
192 else return "YLabel";
bool isOutputField() const
Return 'true' if this is an OutputField widget, i.e., it should display its text similar to an InputF...
virtual void setText(const std::string &newText)
Set the text the widget displays.
bool isEmpty() const
Returns 'true' if this property set does not contain anything.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
bool useBoldFont() const
Return 'true' if a bold font should be used.
Transport class for the value of simple properties.
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
void add(const YProperty &prop)
Add a property to this property set.
A set of properties to check names and types against.
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...
virtual const YPropertySet & propertySet()
Return this class's property set.
std::string text() const
Return the text the widget displays.
virtual std::string debugLabel() const
Returns a descriptive label of this widget instance for debugging.
YLabel(YWidget *parent, const std::string &text, bool isHeading=false, bool isOutputField=false)
Constructor.
std::string stringVal() const
Methods to get the value of this property.
Class for widget properties.
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
virtual void setUseBoldFont(bool bold=true)
Switch bold font on or off.
virtual ~YLabel()
Destructor.
YLabelPrivate(const string &text, bool isHeading, bool isOutputField)
Constructor.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
YPropertyType type() const
Returns the type of this property value.