libyui-ncurses  2.57.2
NCItemSelector.cc
1 /*
2  Copyright (C) 2019 SUSE LLC
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: NCItemSelector.cc
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #include <boost/algorithm/string.hpp>
26 #include <algorithm>
27 #include <vector>
28 
29 #define YUILogComponent "ncurses"
30 #include <yui/YUILog.h>
31 #include "NCItemSelector.h"
32 #include "YNCursesUI.h"
33 
34 using std::string;
35 using std::vector;
36 
37 
38 
39 NCItemSelectorBase::NCItemSelectorBase( YWidget * parent, bool enforceSingleSelection )
40  : YItemSelector( parent, enforceSingleSelection )
41  , NCPadWidget( parent )
42  , _prefSize( 50, 5 ) // width, height
43  , _prefSizeDirty( true )
44  , _selectorWidth( string( "|[x] |" ).size() )
45 {
46  // yuiDebug() << endl;
47  InitPad();
48 }
49 
50 
52  const YItemCustomStatusVector & customStates )
53  : YItemSelector( parent, customStates )
54  , NCPadWidget( parent )
55  , _prefSize( 50, 5 ) // width, height
56  , _prefSizeDirty( true )
57  , _selectorWidth( 0 )
58 {
59  // yuiDebug() << endl;
60  InitPad();
61 
62  // Find the longest text indicator
63 
64  for ( int i=0; i < customStatusCount(); ++i )
65  {
66  int len = customStatus( i ).textIndicator().size();
67 
68  if ( _selectorWidth < len )
69  _selectorWidth = len;
70  }
71 
72  _selectorWidth += string( "| |" ).size();
73 }
74 
75 
77 {
78  // yuiDebug() << endl;
79 }
80 
81 
83 {
84  wsze psze( defPadSze() );
85  NCTablePad * npad = new NCTablePad( psze.H, psze.W, *this );
86  npad->bkgd( listStyle().item.plain );
87  npad->SetSepChar( ' ' );
88  npad->AssertMinCols( 2 );
89  npad->SetHotCol( 1 );
90 
91  return npad;
92 }
93 
94 
96 {
97  return preferredSize().W;
98 }
99 
100 
102 {
103  return preferredSize().H;
104 }
105 
106 
108 {
109  if ( _prefSizeDirty )
110  {
111  const int minHeight = 5; // 2 frame lines + 3 lines for content
112  const int minWidth = 20;
113  int visibleItemsCount = std::min( itemsCount(), visibleItems() );
114 
115  _prefSize.W = 0;
116  _prefSize.H = 0;
117 
118  for ( int i=0; i < visibleItemsCount; ++i )
119  {
120  if ( _prefSize.H > i ) // need a separator line?
121  ++_prefSize.H; // for the separator line
122 
123  ++_prefSize.H; // For the item label
124 
125  vector<string> lines = descriptionLines( itemAt( i ) );
126  _prefSize.H += lines.size();
127 
128  for ( const string & line: lines ) // as wide as the longest line
129  _prefSize.W = std::max( _prefSize.W, (int) line.size() + _selectorWidth );
130  }
131 
132  _prefSize.H += 2; // for the frame lines
133  _prefSize.W = std::max( _prefSize.W, minWidth );
134  _prefSize.H = std::max( _prefSize.H, minHeight );
135  _prefSizeDirty = false;
136  }
137 
138  return _prefSize;
139 }
140 
141 
142 void NCItemSelectorBase::setSize( int newwidth, int newheight )
143 {
144  wRelocate( wpos( 0 ), wsze( newheight, newwidth ) );
145 }
146 
147 
149 {
150  if ( ! grabFocus() )
151  return YWidget::setKeyboardFocus();
152 
153  return true;
154 }
155 
156 
158 {
159  NCWidget::setEnabled( do_bv );
160  YItemSelector::setEnabled( do_bv );
161 }
162 
163 
165 {
166  _prefSizeDirty = true;
167  YItemSelector::setVisibleItems( newVal );
168 }
169 
170 
172 {
173  if ( !myPad()->Lines() )
174  return 0;
175 
176  NCTableTag * tag = tagCell( currentLine() );
177 
178  return tag ? tag->origItem() : 0;
179 }
180 
181 
183 {
184  int lineNo = findItemLine( item );
185 
186  if ( lineNo >= 0 )
187  myPad()->ScrlLine( lineNo );
188 }
189 
190 
191 void NCItemSelectorBase::addItem( YItem * item )
192 {
193  if ( item )
194  {
195  YItemSelector::addItem( item );
196  createItemWidget( item );
197  }
198 }
199 
200 
202 {
203  if ( item )
204  {
205  vector<NCTableCol*> cells( 2U, 0 );
206 
207  _prefSizeDirty = true;
208  int lineNo = myPad()->Lines();
209 
210  if ( lineNo > 0 )
211  {
212  // Add a blank line as a separator from the previous item
213  //
214  // ...but only if there is any previous item that had a description.
215  // If there are only items without description, we don't need separator lines.
216 
217  cells[0] = new NCTableCol( "", NCTableCol::SEPARATOR );
218  cells[1] = new NCTableCol( "", NCTableCol::SEPARATOR );
219  myPad()->Append( cells, lineNo );
220  ++lineNo;
221  }
222 
223  // yuiDebug() << "Adding new item " << item->label() << " at line #" << lineNo << endl;
224 
225  // Add the item label with "[ ]" or "( )" for selection
226 
227  cells[0] = createTagCell( item );
228  cells[1] = new NCTableCol( item->label() );
229 
230  cells[1]->stripHotkey();
231 
232  NCTableLine * tableLine = new NCTableLine( cells, lineNo );
233  myPad()->Append( tableLine );
234 
235  if ( enforceSingleSelection() && item->selected() )
236  myPad()->ScrlLine( lineNo );
237 
238  ++lineNo;
239 
240  // Add the item description (possible multi-line)
241 
242  vector<string> lines = descriptionLines( item );
243 
244  for ( const string & line: lines )
245  {
246  cells[0] = new NCTableCol( "", NCTableCol::PLAIN );
247  cells[1] = new NCTableCol( line, NCTableCol::PLAIN );
248  myPad()->Append( cells, lineNo );
249  ++lineNo;
250  }
251  }
252 }
253 
254 
256 {
257  NCTableLine * tableLine = myPad()->ModifyLine( index );
258 
259  if ( ! tableLine )
260  return 0;
261 
262  return dynamic_cast<NCTableTag *> ( tableLine->GetCol( 0 ) );
263 }
264 
265 
266 int NCItemSelectorBase::findItemLine( YItem * wantedItem ) const
267 {
268  for ( int lineNo = 0; lineNo < (int) myPad()->Lines(); ++lineNo )
269  {
270  NCTableTag * tag = tagCell( lineNo );
271 
272  if ( tag && tag->origItem() == wantedItem )
273  return lineNo;
274  }
275 
276  return -1;
277 }
278 
279 
280 string NCItemSelectorBase::description( YItem * item ) const
281 {
282  string desc;
283 
284  if ( item )
285  {
286  YDescribedItem * descItem = dynamic_cast<YDescribedItem *>( item );
287 
288  if ( descItem )
289  desc = descItem->description();
290  }
291 
292  return desc;
293 }
294 
295 
296 vector<string>
298 {
299  vector<string> lines;
300 
301  // This temporary variable is only needed to work around a bug in older boost versions:
302  // https://github.com/boostorg/algorithm/commit/c6f784cb
303 
304  string desc = description( item );
305  boost::split( lines, desc, boost::is_any_of( "\n" ) );
306 
307  return lines;
308 }
309 
310 
312 {
313  YItemSelector::deleteAllItems();
314  myPad()->ClearTable();
315  DrawPad();
316 }
317 
318 
319 void NCItemSelectorBase::selectItem( YItem *item, bool selected )
320 {
321  if ( item )
322  {
323  YItemSelector::selectItem( item, selected );
324 
325  NCTableTag * tag = (NCTableTag *) item->data();
326  YUI_CHECK_PTR( tag );
327 
328  tag->SetSelected( selected );
329 
330  DrawPad();
331  }
332 }
333 
334 
336 {
337  YItemSelector::deselectAllItems();
338 
339  for ( int i = 0; i < linesCount(); i++ )
340  {
341  NCTableTag * tag = tagCell( i );
342 
343  if ( tag )
344  tag->SetSelected( false );
345  }
346 
347  DrawPad();
348 }
349 
350 
351 YItem *
353 {
354  YItem * item = 0;
355 
356  while ( currentLine() < linesCount() - 1 )
357  {
358  YItem * item = currentItem();
359 
360  if ( item )
361  return item;
362 
363  // yuiDebug() << "Scrolling down" << endl;
364  myPad()->ScrlDown();
365  }
366 
367  if ( ! item ) // That was the last one
368  item = scrollUpToPreviousItem();
369 
370  return item;
371 }
372 
373 
374 YItem *
376 {
377  while ( true )
378  {
379  YItem * item = currentItem();
380 
381  if ( item )
382  return item;
383 
384  if ( currentLine() == 0 )
385  return 0;
386 
387  // yuiDebug() << "Scrolling up" << endl;
388  myPad()->ScrlUp();
389  }
390 
391  /**NOTREACHED**/
392  return 0;
393 }
394 
395 
398 {
399  NCursesEvent ret;
400  YItem * changedItem = 0;
401  YItem * curItem = currentItem();
402 
403  switch ( key )
404  {
405  case KEY_SPACE:
406  case KEY_RETURN: // Cycle item status and stay on this item
407 
408  if ( ! curItem )
409  curItem = scrollUpToPreviousItem();
410 
411  if ( curItem )
412  {
414  changedItem = curItem;
415  }
416 
417  break;
418 
419 
420  case '+': // Select this item and go to the next item
421 
422  if ( ! curItem )
423  curItem = scrollUpToPreviousItem();
424 
425  if ( curItem &&
426  curItem->status() != 1 &&
427  statusChangeAllowed( curItem->status(), 1 ) )
428  {
430  changedItem = curItem;
431  }
432 
433  if ( ! enforceSingleSelection() )
434  {
435  myPad()->ScrlDown();
436  curItem = scrollDownToNextItem();
437  }
438 
439  break;
440 
441 
442  case '-': // Deselect this item and go to the next item
443 
444  if ( ! curItem )
445  curItem = scrollUpToPreviousItem();
446 
447  if ( curItem &&
448  curItem->status() > 0 &&
449  statusChangeAllowed( curItem->status(), 0 ) )
450  {
451  setItemStatus( curItem, 0 );
452  changedItem = curItem;
453  }
454 
455  if ( ! enforceSingleSelection() )
456  {
457  myPad()->ScrlDown();
458  curItem = scrollDownToNextItem();
459  }
460 
461  break;
462 
463  // Those keys have different meanings in this widget:
464  // Scroll up and down by item, not by line.
465 
466  case KEY_UP: // Scroll up one item
467  myPad()->ScrlUp();
469  break;
470 
471  case KEY_DOWN: // Scroll down one item
472  myPad()->ScrlDown();
474  break;
475 
476  case KEY_END: // Scroll to the last item
477  myPad()->ScrlToLastLine();
478  // We want to be on the last item, not on the last line
480  break;
481 
482  // The Home key (scroll to the first item) is handled in the base
483  // class: Since the first is on the first line, so we can simply let
484  // the base class scroll to the first line.
485 
486 
487  // We would have liked to use KEY_SHIFT_UP and KEY_SHIFT_DOWN for
488  // scrolling up or down by line rather by item, but unfortunately
489  // NCurses does not support that at all; there are no predefined keys
490  // for any of that (but oddly enough KEY_SLEFT and KEY_SRIGHT for
491  // shifted arrow left or right), and there is no way to query the
492  // status of the modifier keys.
493  //
494  // See also /usr/include/ncurses/ncurses.h .
495  //
496  // There are lots of articles on StackOverflow etc. about this topic,
497  // but there is not a single portable solution; not even portable
498  // between the various terminal emulators (xterm, KDE konsole,
499  // gnome-terminal, xfce4-terminal) or the Linux console, let alone all
500  // the various other terminal types out there.
501  //
502  // So we have to resort to different keys. Not sure how many users will
503  // even realize that, but maybe some users actually try to use
504  // 'vi'-like keys like 'j' or 'k'.
505 
506  case 'j': // For 'vi' fans: Scroll down one line
507  myPad()->ScrlDown();
508  break;
509 
510  case 'k': // For 'vi' fans: Scroll up one line
511  myPad()->ScrlUp();
512  break;
513 
514  case KEY_HOTKEY:
515 
516  changedItem = curItem;
517  curItem = findItemWithHotkey( _hotKey );
518 
519  if ( curItem )
520  {
521  setCurrentItem( curItem );
522 
523  if ( ! changedItem )
524  changedItem = curItem;
525 
527  }
528 
529  break;
530 
531  default:
532  handleInput( key ); // Call base class input handler
533  break;
534  }
535 
536  if ( notify() && changedItem )
537  ret = valueChangedNotify( changedItem );
538 
539  return ret;
540 }
541 
542 
544 {
545  if ( notify() )
546  {
547  NCursesEvent event = valueChangedNotify( item );
548  event.selection = (YMenuItem *) item;
549  event.widget = this;
550 
551  YNCursesUI::ui()->sendEvent( event );
552  }
553 }
554 
555 
557 {
558  // Any of the items might have its keyboard shortcut changed, but we don't
559  // know which one. So let's simply re-create the widgets again.
560 
561  myPad()->ClearTable();
562 
563  for ( YItemIterator it = itemsBegin(); it != itemsEnd(); ++it )
564  {
565  createItemWidget( *it );
566  }
567 
568  DrawPad();
569 }
570 
571 
573 {
574  if ( ! findItemWithHotkey( key ) )
575  return false;
576 
577  _hotKey = key;
578 
579  return true;
580 }
581 
582 
583 // ----------------------------------------------------------------------
584 
585 
586 
587 NCItemSelector::NCItemSelector( YWidget * parent, bool enforceSingleSelection )
588  : NCItemSelectorBase( parent, enforceSingleSelection )
589 {
590  // yuiDebug() << endl;
591 }
592 
593 
595 {
596  // yuiDebug() << endl;
597 }
598 
599 
600 NCTableTag *
602 {
603  NCTableTag * tag = new NCTableTag( item, item->selected(), enforceSingleSelection() );
604  YUI_CHECK_NEW( tag );
605 
606  return tag;
607 }
608 
609 
612 {
613  if ( enforceSingleSelection() && item && item->selected() )
614  deselectAllItemsExcept( item );
615 
616  yuiDebug() << "Sending ValueChanged event for " << (YItemSelector* ) this << endl;
617 
618  return NCursesEvent::ValueChanged;
619 }
620 
621 
623 {
624  YItem *item = currentItem();
625 
626  if ( item )
627  {
628  if ( enforceSingleSelection() )
629  {
630  selectItem( item, true );
631  deselectAllItemsExcept( item );
632  }
633  else // Multi-selection
634  {
635  selectItem( item, !( item->selected() ) );
636  }
637  }
638 }
639 
640 
641 bool NCItemSelector::statusChangeAllowed( int fromStatus, int toStatus )
642 {
643  if ( fromStatus == toStatus ) // No use setting to the same status as before
644  return false;
645 
646  if ( toStatus < 0 || toStatus > 1 )
647  return false;
648 
649  if ( enforceSingleSelection() )
650  return toStatus == 1; // Allow only setting 0 -> 1
651  else
652  return true;
653 }
654 
655 
656 void NCItemSelector::deselectAllItemsExcept( YItem * exceptItem )
657 {
658  for ( YItemIterator it = itemsBegin(); it != itemsEnd(); ++it )
659  {
660  if ( *it != exceptItem )
661  {
662  (*it)->setSelected( false );
663  NCTableTag * tag = (NCTableTag *) (*it)->data();
664 
665  if ( tag )
666  tag->SetSelected( false );
667  }
668  }
669 
670  DrawPad();
671 }
672 
673 
674 YItem* NCItemSelectorBase::findItemWithHotkey( int key ) const
675 {
676  for ( YItemConstIterator it = itemsBegin(); it != itemsEnd(); it++ )
677  {
678  NClabel label = NCstring( (*it)->label() );
679  label.stripHotkey();
680 
681  if ( label.hasHotkey() && tolower( label.hotkey() ) == tolower( key ) )
682  return *it;
683  }
684 
685  return nullptr;
686 }
wsze
Screen dimension (screen size) in the order height, width: (H, W)
Definition: position.h:154
NCItemSelectorBase::activateItem
virtual void activateItem(YItem *item)
Activate selected item.
Definition: NCItemSelector.cc:543
NCItemSelectorBase::tagCell
virtual NCTableTag * tagCell(int index) const
Return the tag cell (the cell with the "[x]" or "(x)" selector) for the item with the specified index...
Definition: NCItemSelector.cc:255
NCstring
A string with an optional hot key.
Definition: NCstring.h:36
YNCursesUI::ui
static YNCursesUI * ui()
Access the global Y2NCursesUI.
Definition: YNCursesUI.h:93
YNCursesUI::sendEvent
void sendEvent(NCursesEvent event)
Send an event to the UI.
Definition: YNCursesUI.cc:456
NCItemSelectorBase::HasHotkey
virtual bool HasHotkey(int key)
Whether any item has the given hot-key .
Definition: NCItemSelector.cc:572
NCTablePadBase::ClearTable
void ClearTable()
Clear all content.
Definition: NCTablePadBase.cc:51
NCItemSelectorBase::myPad
virtual NCTablePad * myPad() const
Return the pad for this widget; overloaded to narrow the type.
Definition: NCItemSelector.h:273
NCTableCol
One cell in an NCTableLine with a label and a cell-specific style.
Definition: NCTableItem.h:422
NCItemSelectorBase::CreatePad
virtual NCPad * CreatePad()
Create the pad for this widget.
Definition: NCItemSelector.cc:82
NCItemSelectorBase::currentItem
virtual YItem * currentItem() const
Return the current item, i.e.
Definition: NCItemSelector.cc:171
NCItemSelectorBase::deselectAllItems
virtual void deselectAllItems()
Deselect all items.
Definition: NCItemSelector.cc:335
NCItemSelectorBase::createItemWidget
void createItemWidget(YItem *item)
Create a widget for the given item.
Definition: NCItemSelector.cc:201
NCItemSelectorBase::preferredHeight
virtual int preferredHeight()
Return the preferred height for this widget.
Definition: NCItemSelector.cc:101
NCItemSelector::cycleCurrentItemStatus
virtual void cycleCurrentItemStatus()
Cycle the status of the current item through its possible values.
Definition: NCItemSelector.cc:622
NCItemSelectorBase::descriptionLines
std::vector< std::string > descriptionLines(YItem *item) const
Return the description text for an item as multiple lines.
Definition: NCItemSelector.cc:297
NCWidget::setEnabled
virtual void setEnabled(bool do_bv)=0
Pure virtual to make sure every widget implements it.
Definition: NCWidget.cc:392
NCPad::ScrlLine
int ScrlLine(int line)
Scroll to a line, keeping the column.
Definition: NCPad.h:206
NClabel
Multi-line string, with optional hotkey, drawable.
Definition: NCtext.h:82
NCItemSelectorBase::setEnabled
virtual void setEnabled(bool do_bv)
Enable or disable this widget.
Definition: NCItemSelector.cc:157
NCItemSelector::createTagCell
virtual NCTableTag * createTagCell(YItem *item)
Create a tag cell for an item.
Definition: NCItemSelector.cc:601
NCTablePad
An NCPad for an NCTable.
Definition: NCTablePad.h:62
NCTablePadBase::Lines
unsigned Lines() const
Return the number of table lines (logical, not screen)
Definition: NCTablePadBase.h:122
NCTablePadBase::Append
void Append(NCTableLine *item)
Add one item to the end of _items.
Definition: NCTablePadBase.h:147
NCItemSelectorBase::statusChangeAllowed
virtual bool statusChangeAllowed(int fromStatus, int toStatus)
Return 'true' if a status change (by user interaction) from status 'fromStatus' to status 'toStatus' ...
Definition: NCItemSelector.h:210
NCItemSelectorBase::NCItemSelectorBase
NCItemSelectorBase(YWidget *parent, bool enforceSingleSelection)
Standard constructor.
Definition: NCItemSelector.cc:39
NCTablePadBase::ModifyLine
NCTableLine * ModifyLine(unsigned idx)
Return line at idx for read-write operations and mark it as modified.
Definition: NCTablePadBase.cc:93
NCItemSelectorBase::selectItem
virtual void selectItem(YItem *item, bool selected)
Select or deselect an item.
Definition: NCItemSelector.cc:319
NCItemSelectorBase::cycleCurrentItemStatus
virtual void cycleCurrentItemStatus()=0
Cycle the status of the current item through its possible values.
NCItemSelector::~NCItemSelector
virtual ~NCItemSelector()
Destructor.
Definition: NCItemSelector.cc:594
NCItemSelectorBase::setSize
virtual void setSize(int newWidth, int newHeight)
Set the size of this widget.
Definition: NCItemSelector.cc:142
NCItemSelectorBase::setVisibleItems
virtual void setVisibleItems(int newVal)
Set the number of visible items for this widget.
Definition: NCItemSelector.cc:164
NCItemSelectorBase::addItem
virtual void addItem(YItem *item)
Add an item to this widget.
Definition: NCItemSelector.cc:191
NCPad
A virtual window with a real viewport (which is NCursesWindow) and a scrolling mechanism.
Definition: NCPad.h:113
NCItemSelector::statusChangeAllowed
virtual bool statusChangeAllowed(int fromStatus, int toStatus)
Return 'true' if a status change (by user interaction) from status 'fromStatus' to status 'toStatus' ...
Definition: NCItemSelector.cc:641
NCItemSelector::valueChangedNotify
virtual NCursesEvent valueChangedNotify(YItem *item)
Notification that a status value was just changed in the input handler and the 'notify' flag is set.
Definition: NCItemSelector.cc:611
wpos
Screen position pair in the order line, column: (L, C)
Definition: position.h:110
NCItemSelectorBase
Definition: NCItemSelector.h:38
NCItemSelectorBase::shortcutChanged
virtual void shortcutChanged()
Notification that some shortcut was changed.
Definition: NCItemSelector.cc:556
NCItemSelectorBase::scrollDownToNextItem
YItem * scrollDownToNextItem()
If the cursor is not on the first line of an item (the line with the "[x]" selector),...
Definition: NCItemSelector.cc:352
NCursesWindow::bkgd
int bkgd(const chtype ch)
Set the background property and apply it to the window.
Definition: ncursesw.h:1445
NCItemSelectorBase::scrollUpToPreviousItem
YItem * scrollUpToPreviousItem()
If the cursor is not on the first line of an item (the line with the "[x]" selector),...
Definition: NCItemSelector.cc:375
NCItemSelectorBase::~NCItemSelectorBase
virtual ~NCItemSelectorBase()
Destructor.
Definition: NCItemSelector.cc:76
NCItemSelector::NCItemSelector
NCItemSelector(YWidget *parent, bool enforceSingleSelection)
Constructor.
Definition: NCItemSelector.cc:587
NCTableLine::GetCol
NCTableCol * GetCol(unsigned idx)
Return a non-const pointer for read/write operations to the column (the cell) with the specified inde...
Definition: NCTableItem.cc:293
NCTableLine
One line in a NCTable with multiple cells and an optional tree hierarchy.
Definition: NCTableItem.h:68
NCItemSelectorBase::description
std::string description(YItem *item) const
Return the desription text for an item.
Definition: NCItemSelector.cc:280
NCItemSelectorBase::valueChangedNotify
virtual NCursesEvent valueChangedNotify(YItem *item)=0
Notification that a status value was just changed in the input handler and the 'notify' flag is set.
NCItemSelectorBase::wHandleInput
virtual NCursesEvent wHandleInput(wint_t key)
Handle keyboard input.
Definition: NCItemSelector.cc:397
NCItemSelectorBase::createTagCell
virtual NCTableTag * createTagCell(YItem *item)=0
Create a tag cell for an item.
NCItemSelector::deselectAllItemsExcept
void deselectAllItemsExcept(YItem *exceptItem)
Deselect all items except the specified one.
Definition: NCItemSelector.cc:656
NCItemSelectorBase::linesCount
int linesCount() const
Return the number of lines in this widget.
Definition: NCItemSelector.h:120
NCItemSelectorBase::setCurrentItem
virtual void setCurrentItem(YItem *item)
Set the current item, i.e.
Definition: NCItemSelector.cc:182
NCItemSelectorBase::preferredSize
virtual wsze preferredSize()
Return the preferred size for this widget.
Definition: NCItemSelector.cc:107
NCItemSelectorBase::deleteAllItems
virtual void deleteAllItems()
Delete all items.
Definition: NCItemSelector.cc:311
NCursesEvent
Definition: NCurses.h:73
NCItemSelectorBase::currentLine
int currentLine() const
Return number of the current line, i.e.
Definition: NCItemSelector.h:126
NCPadWidget
Base class for widgets with scrollable contents.
Definition: NCPadWidget.h:40
NCItemSelectorBase::findItemLine
int findItemLine(YItem *item) const
Return the line number that contains the first line of 'item' or -1 if not found.
Definition: NCItemSelector.cc:266
NCItemSelectorBase::preferredWidth
virtual int preferredWidth()
Return the preferred width for this widget.
Definition: NCItemSelector.cc:95
NCTableTag
A column (one cell) used as a selection marker: [ ]/[x] or ( )/(x).
Definition: NCTableItem.h:647
NCItemSelectorBase::setKeyboardFocus
virtual bool setKeyboardFocus()
Set the keyboard focus to this widget.
Definition: NCItemSelector.cc:148