Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SUIT_DataBrowser.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 // File : SUIT_DataBrowser.h
21 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
22 //
23 #ifndef SUIT_DATABROWSER_H
24 #define SUIT_DATABROWSER_H
25 
26 #include "SUIT.h"
27 #include "SUIT_PopupClient.h"
28 #include "SUIT_DataObject.h"
29 #include <OB_Browser.h>
30 
31 class QShortcut;
32 
34 {
35  Q_OBJECT
36 
37 public:
38  SUIT_DataBrowser( QWidget* = 0 );
41 
42  enum {UpdateShortcut = 0, RenameShortcut};
43 
44  virtual QString popupClientType() const;
45 
46  SUIT_DataObject* root() const;
47  void setRoot( SUIT_DataObject* );
48 
49  bool autoUpdate() const;
50  void setAutoUpdate( const bool );
51 
52  bool updateModified() const;
53  void setUpdateModified( const bool );
54 
55  void updateTree( SUIT_DataObject* = 0, const bool = true );
56 
57  int shortcutKey(const int) const;
58  void setShortcutKey( const int, const int );
59 
60  DataObjectList getSelected() const;
61  void getSelected( DataObjectList& ) const;
62 
63  void setSelected( const SUIT_DataObject*, const bool = false );
64  void setSelected( const DataObjectList&, const bool = false );
65 
66  virtual void contextMenuPopup( QMenu* );
67 
68  void setAutoSizeFirstColumn( const bool on );
69  void setAutoSizeColumns( const bool on );
70  void setResizeOnExpandItem( const bool on );
71 
72  void ensureVisible( SUIT_DataObject* );
73  void ensureVisible( const DataObjectList& );
74 
75 protected:
76  virtual void contextMenuEvent( QContextMenuEvent* );
77 
78 private:
79  void init( SUIT_DataObject* );
80 
81 signals:
82  void requestUpdate();
83  void requestRename();
84  void clicked( SUIT_DataObject* );
85  void doubleClicked( SUIT_DataObject* );
86  void updated();
87 
88 private slots:
89  void onModelUpdated();
90  void onClicked( const QModelIndex& );
91  void onDblClicked( const QModelIndex& );
92  void onExpanded( const QModelIndex& );
93  void onStartEditing();
94 
95 private:
96  typedef QMap<int, QShortcut*> ShortcutMap;
98 
102 };
103 
104 #endif // SUIT_BROWSER_H