26 #define YUILogComponent "ui"
29 #include "YUISymbols.h"
30 #include "YMenuButton.h"
31 #include "YMenuItem.h"
32 #include "YShortcut.h"
54 YUI_CHECK_NEW( priv );
77 item->
setIndex( ++(priv->nextSerialNo) );
91 item->
setIndex( ++(priv->nextSerialNo) );
103 priv->nextSerialNo = 0;
123 if ( item->
index() == wantedIndex )
141 bool used[
sizeof( char ) << 8 ];
142 for (
unsigned i=0; i <
sizeof( char ) << 8; i++ )
144 std::vector<YMenuItem*> conflicts;
161 conflicts.push_back(item);
162 yuiMilestone() <<
"No or invalid shortcut found " << item->
label() << endl;
164 else if (used[(
unsigned)shortcut])
166 conflicts.push_back(item);
167 yuiWarning() <<
"Conflicting shortcut found " << item->
label() << endl;
171 used[(unsigned)shortcut] =
true;
176 yuiWarning() <<
"non menu item used in call " << (*it)->label() << endl;
187 for (; index < clean.size(); ++index)
191 if (ch != 0 && !used[(
unsigned)ch])
194 used[(unsigned)ch] =
true;
202 yuiMilestone() <<
"New label used: " << clean << endl;
227 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
228 propSet.
add(
YProperty( YUIProperty_Items, YOtherProperty ) );
229 propSet.
add(
YProperty( YUIProperty_IconPath, YStringProperty ) );
243 else if ( propertyName == YUIProperty_Items )
return false;
260 else if ( propertyName == YUIProperty_Items )
return YPropertyValue( YOtherProperty );
277 std::vector<std::string>::iterator path_end,
288 if( item->
label() == *path_begin )
290 if ( std::next(path_begin) == path_end ) {
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.
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.
std::string cleanShortcutString()
Returns the shortcut string ( from the widget's shortcut property ) without any "&" markers.
YItemCollection::const_iterator YItemConstIterator
Const iterator over YItemCollection.
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.