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 );
std::string label() const
Return this item's label.
void add(const YProperty &prop)
Add a property to this property set.
static char shortcutMarker()
Static function: Returns the character used for marking keyboard shortcuts.
std::string cleanShortcutString()
Returns the shortcut string ( from the widget's shortcut property ) without any "&" markers.
void setIndex(int index)
Set this item's index.
YItemCollection::iterator YItemIterator
Mutable iterator over YItemCollection.
std::vector< YItem * > YItemCollection
Collection of pointers to YItem.
int index() const
Return the index of this item (as set with setIndex() ).
virtual YItemIterator childrenBegin()
Return an iterator that points to the first child item of this item.
A set of properties to check names and types against.
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.
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.
virtual bool hasChildren() const
Return 'true' if this item has any child items.
virtual YItemIterator childrenBegin()
Return an iterator that points to the first child item of this item.
YPropertyType type() const
Returns the type of this property value.
virtual YItemIterator childrenEnd()
Return an iterator that points after the last child item of this item.
virtual bool hasChildren() const
Return 'true' if this item has any child items.
static char normalized(char c)
Return the normalized version of shortcut character 'c', i.e.
Class for widget properties.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
Transport class for the value of simple properties.
virtual YItemIterator childrenEnd()
Return an iterator that points after the last child item of this item.
YItemCollection::const_iterator YItemConstIterator
Const iterator over YItemCollection.
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.