26 #define YUILogComponent "ui" 29 #include "YUISymbols.h" 30 #include "YMenuButton.h" 31 #include "YMenuItem.h" 32 #include "YShortcut.h" 52 YUI_CHECK_NEW( priv );
75 item->
setIndex( ++(priv->nextSerialNo) );
89 item->
setIndex( ++(priv->nextSerialNo) );
101 priv->nextSerialNo = 0;
121 if ( item->
index() == wantedIndex )
139 bool used[
sizeof( char ) << 8 ];
140 for (
unsigned i=0; i <
sizeof( char ) << 8; i++ )
142 std::vector<YMenuItem*> conflicts;
159 conflicts.push_back(item);
160 yuiMilestone() <<
"No or invalid shortcut found " << item->
label() << std::endl;
162 else if (used[(
unsigned)shortcut])
164 conflicts.push_back(item);
165 yuiWarning() <<
"Conflicting shortcut found " << item->
label() << std::endl;
169 used[(unsigned)shortcut] =
true;
174 yuiWarning() <<
"non menu item used in call " << (*it)->label() << std::endl;
185 for (; index < clean.size(); ++index)
189 if (ch != 0 && !used[(
unsigned)ch])
192 used[(unsigned)ch] =
true;
200 yuiMilestone() <<
"New label used: " << clean << std::endl;
225 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
226 propSet.
add(
YProperty( YUIProperty_Items, YOtherProperty ) );
227 propSet.
add(
YProperty( YUIProperty_IconPath, YStringProperty ) );
241 else if ( propertyName == YUIProperty_Items )
return false;
258 else if ( propertyName == YUIProperty_Items )
return YPropertyValue( YOtherProperty );
YItemCollection::iterator YItemIterator
Mutable iterator over YItemCollection.
virtual bool hasChildren() const
Return 'true' if this item has any child items.
virtual YItemIterator childrenEnd()
Return an iterator that points after the last child item of this item.
std::string label() const
Return this item's label.
bool isEmpty() const
Returns 'true' if this property set does not contain anything.
void setIndex(int index)
Set this item's index.
Transport class for the value of simple properties.
virtual YItemIterator childrenBegin()
Return an iterator that points to the first child item of this item.
std::vector< YItem * > YItemCollection
Collection of pointers to YItem.
void add(const YProperty &prop)
Add a property to this property set.
virtual bool hasChildren() const
Return 'true' if this item has any child items.
A set of properties to check names and types against.
int index() const
Return the index of this item (as set with setIndex() ).
static char normalized(char c)
Return the normalized version of shortcut character 'c', i.e.
std::string cleanShortcutString()
Returns the shortcut string ( from the widget's shortcut property ) without any "&" markers...
static char shortcutMarker()
Static function: Returns the character used for marking keyboard shortcuts.
std::string stringVal() const
Methods to get the value of this property.
Class for widget properties.
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.
YItemCollection::const_iterator YItemConstIterator
Const iterator over YItemCollection.
virtual YItemIterator childrenEnd()
Return an iterator that points after the last child item of this item.
static char findShortcut(const std::string &str, std::string::size_type start_pos=0)
Static function: Find the next shortcut marker in a string, beginning at starting position start_pos...
virtual YItemIterator childrenBegin()
Return an iterator that points to the first child item of this item.
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.