OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
panel_bar.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_PANEL_BAR_PANEL_BAR
20 #define OST_GUI_PANEL_BAR_PANEL_BAR
21 
22 
23 #include <ost/gui/module_config.hh>
24 #include <ost/gui/widget_pool.hh>
25 #include <ost/gui/widget.hh>
26 #include <ost/gui/thin_splitter.hh>
27 
28 #include "button_box.hh"
29 
30 
31 #include <QStackedLayout>
32 #include <QWidget>
33 #include <QString>
34 #include <QAction>
35 #include <QActionGroup>
36 namespace ost { namespace gui {
37 
38 class PanelWidgetContainer;
39 
41 {
42  WidgetState(Widget * w,bool v=true, QString n=""):
43  widget(w), visible(v), name(n)
44  { }
46  bool visible;
47  QString name;
48 };
49 
54  Q_OBJECT
55 public:
56  PanelBar(QWidget* parent);
57  virtual ~PanelBar();
58 
59  virtual bool Save(const QString& prefix);
60  virtual bool Restore(const QString& prefix);
61 
66  virtual void AddWidget(Widget* widget, bool hidden);
67 
68  // \brief Add a view mode to this widget
69  // Adds a view mode to this class. The view mode will automaticaly added to the view mode menu see /ref PanelBar::AddGetViewModeMenu() for more information.
70  // \param pwc View Mode to be added
71  void AddViewMode(PanelWidgetContainer * pwc);
75  QMenu* GetViewModeMenu();
76 
81  int GetIndex(Widget* widget);
82 
85  void DragEnter();
88  void EndDrag();
89 
93  QAction* GetShowAction();
94 
95 public slots:
101  void InsertWidget(Widget * widget, int index, bool is_hidden=false);
104  void ToggleViewMode();
105 
107  void ToggleHide();
108 
112  void RemoveWidget(Widget* widget);
113 
114 private slots:
115  void ChangeViewMode(QAction* action);
116  void ToggleVisibility(Widget*);
117  void ShowActionTrigger();
118  void SetViewMode(int index);
119 private:
120  void UpdateShow();
121 
122  QStackedLayout* layout_;
123  QActionGroup* view_modes_;
124  QMenu* view_mode_menu_;
125  PanelWidgetContainer* current_view_mode_;
126  QList<WidgetState> widget_states_;
127  Widget* drop_box_;
128  QAction* show_action_;
129 };
130 
131 }}
132 
133 #endif
Panel Bar which may contain other Widgets A PanelBar might have different ViewModes which are PanelWi...
Definition: panel_bar.hh:53
#define DLLEXPORT_OST_GUI
A PanelWidgetContainer can display various widgets A PanelWidgetContainer is a abstract class which i...
Base class for widgets.
Definition: widget.hh:40
WidgetState(Widget *w, bool v=true, QString n="")
Definition: panel_bar.hh:42