libyui-ncurses  2.44.1
 All Classes Functions Variables
NCTree.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
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: NCTree.h
20 
21  Author: Michael Andres <ma@suse.de>
22 
23 /-*/
24 
25 #ifndef NCTree_h
26 #define NCTree_h
27 
28 #include <iosfwd>
29 
30 #include <yui/YTree.h>
31 #include "NCPadWidget.h"
32 #include "NCTreePad.h"
33 #include "NCTablePad.h"
34 
35 class NCTreeLine;
36 
37 
38 class NCTree : public YTree, public NCPadWidget
39 {
40 private:
41  friend std::ostream & operator<<( std::ostream & STREAM, const NCTree & OBJ );
42 
43  NCTree & operator=( const NCTree & );
44  NCTree( const NCTree & );
45 
46  int idx;
47  bool multiSel;
48 
49  void CreateTreeLines( NCTreeLine * p, NCTreePad * pad, YItem * item );
50 
51 protected:
52 
53  virtual NCTreePad * myPad() const
54  { return dynamic_cast<NCTreePad*>( NCPadWidget::myPad() ); }
55 
56  const NCTreeLine * getTreeLine( unsigned idx ) const;
57  NCTreeLine * modifyTreeLine( unsigned idx );
58 
59  virtual const char * location() const { return "NCTree"; }
60 
61  virtual NCPad * CreatePad();
62  virtual void DrawPad();
63 
64  virtual void startMultipleChanges() { startMultidraw(); }
65  virtual void doneMultipleChanges() { stopMultidraw(); }
66 
67 public:
68 
69  NCTree( YWidget * parent, const std::string & label, bool multiselection=false, bool recursiveselection=false );
70  virtual ~NCTree();
71 
72  virtual int preferredWidth();
73  virtual int preferredHeight();
74 
75  virtual void setSize( int newWidth, int newHeight );
76 
77  virtual void setLabel( const std::string & nlabel );
78  virtual void rebuildTree();
79 
80  virtual YTreeItem * getCurrentItem() const;
81 
82  virtual YTreeItem * currentItem();
83 
84  virtual void deselectAllItems();
85 
86  virtual void selectItem( YItem *item, bool selected );
87  virtual void selectItem( int index );
88 
89  virtual NCursesEvent wHandleInput( wint_t key );
90 
91  virtual void setEnabled( bool do_bv );
92 
93  virtual bool setKeyboardFocus()
94  {
95  if ( !grabFocus() )
96  return YWidget::setKeyboardFocus();
97 
98  return true;
99  }
100 
101  void deleteAllItems();
102 };
103 
104 
105 #endif // NCTree_h
virtual NCTreePad * myPad() const
Definition: NCTree.h:53
Definition: NCPad.h:93
virtual NCPad * myPad() const
Definition: NCPadWidget.h:62
virtual void setEnabled(bool do_bv)
Definition: NCTree.cc:323
Definition: NCTree.h:38