26 #define YUILogComponent "ncurses"
27 #include <yui/YUILog.h>
29 #include "NCCustomStatusItemSelector.h"
35 const YItemCustomStatusVector & customStates )
86 int oldStatus = item->status();
87 int newStatus = customStatus( oldStatus ).nextStatus();
89 yuiDebug() <<
"Cycling status of item \""
90 << item->label() <<
"\": "
91 << oldStatus <<
" -> " << newStatus
94 if ( newStatus != -1 && oldStatus != newStatus )
96 item->setStatus( newStatus );
105 if ( fromStatus == toStatus )
108 if ( ! validCustomStatusIndex( fromStatus ) || ! validCustomStatusIndex( toStatus ) )
111 return customStatus( fromStatus ).nextStatus() == toStatus;
119 event.selection = (YMenuItem *) item;
121 yuiDebug() <<
"Sending MenuEvent for item \"" << item->label() <<
"\"" << endl;
130 NCCustomStatusTableTag::NCCustomStatusTableTag( YItemSelector * parentSelector, YItem * item )
132 , _parentSelector( parentSelector )
134 YUI_CHECK_PTR( _parentSelector );
135 updateStatusIndicator();
141 YItem * item = origItem();
145 string statusText = _parentSelector->customStatus( item->status() ).textIndicator();
149 NCTableCol::SetLabel(
NCstring( statusText ) );
157 NCTableLine::STATE linestate,
158 unsigned colidx )
const
162 NCTableCol::DrawAt( w, at, tableStyle, linestate, colidx );
168 YItem * item = origItem();
170 return item ? item->status() : 0;
176 YItem * item = origItem();
180 item->setStatus( newStatus );
186 void NCCustomStatusTableTag::SetSelected(
bool sel )
192 bool NCCustomStatusTableTag::Selected()
const