BALL  1.5.0
modularWidget.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_WIDGETS_MODULARWIDGET_H
6 #define BALL_VIEW_WIDGETS_MODULARWIDGET_H
7 
8 #ifndef BALL_CONCEPT_EMBEDDABLE_H
10 #endif
11 
12 #ifndef BALL_VIEW_KERNEL_CONNECTIONOBJECT_H
14 #endif
15 
16 #ifndef BALL_VIEW_KERNEL_UIOPERATIONMODE_H
18 #endif
19 
20 #include <QtGui/QKeySequence>
21 #include <QtWidgets/QToolBar>
22 
23 class QObject;
24 class QMenuBar;
25 class QWidget;
26 class QAction;
27 
28 namespace BALL
29 {
30  class INIFile;
31  class FragmentDB;
32 
33  namespace VIEW
34  {
35  class Preferences;
36  class MainControl;
37 
61  : public Embeddable,
62  public ConnectionObject
63  {
64  public:
65 
68 
69 
72 
77  ModularWidget(const char* name = "<ModularWidget>");
78 
81  ModularWidget(const ModularWidget& widget);
82 
84 
87 
91  virtual ~ModularWidget();
92 
94  virtual void destroy()
95  { clear(); };
96 
100  virtual void clear();
101 
103 
106 
114  static void registerWidget(ModularWidget* mwidget);
115 
123  virtual void initializeWidget(MainControl& main_control);
124 
133  virtual void finalizeWidget(MainControl& main_control);
134 
140  virtual bool canHandle(const String& /*fileformat*/) const { return false;}
141 
146  virtual bool openFile(const String& /*filename*/) { return false;}
147 
149 
152 
158  virtual void checkMenu(MainControl& main_control);
159 
161  QAction* insertMenuEntry(Position parent_id, const QString& name, const QObject* receiver = 0,
162  const char* slot = 0, const String& description = "", QKeySequence accel = QKeySequence(),
163  const QString& menu_hint = QString(""),
165 
169  BALL_DEPRECATED void setMenuHelp(QAction* /* action */, const String& /* url */);
170 
174  BALL_DEPRECATED virtual void registerForHelpSystem(const QObject* /* object */, const String& /* url */);
175 
180  virtual void addToolBarEntries(QToolBar* main_tb);
181 
188  void setIcon(QAction* action, const String& filename, bool add_to_main_toolbar = true);
189 
190 
192 
195 
202  virtual void initializePreferencesTab(Preferences& preferences);
203 
210  virtual void finalizePreferencesTab(Preferences& preferences);
211 
223  virtual void applyPreferences(){};
224 
230  virtual void fetchPreferences(INIFile& inifile);
231 
237  virtual void writePreferences(INIFile& inifile);
238 
240 
243 
247  bool lockComposites();
248 
250  bool unlockComposites();
251 
253 
256 
260  MainControl* getMainControl() const;
261 
266  virtual void setStatusbarText(const String& text, bool important = false);
267 
269  virtual void setStatusbarText(const QString& text, bool important = false);
270 
272  String getWorkingDir();
273 
275  void setWorkingDir(const String& dir);
276 
281  FragmentDB& getFragmentDB() const;
282 
284 
287 
295  virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
296 
298 
299  void setWorkingDirFromFilename_(String filename);
300 
304  BALL_DEPRECATED virtual void showHelp(const String& /* url */);
305 
306  protected:
307 
308  //_ id in the menubar entry "WINDOWS" for every widget
310 
311  //_ should there be an entry to switch the window on and off?
313 
314  //_ should the widget be visible, if no config file entry exists?
316 
317  QList<QAction*> main_toolbar_actions_;
318  };
319 
320  } // namespace VIEW
321 } // namespace BALL
322 
323 #endif // BALL_VIEW_WIDGETS_MODULARWIDGET_H
QList< QAction * > main_toolbar_actions_
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31
BALL_VIEW_EXPORT MainControl * getMainControl()
virtual void applyPreferences()
virtual bool canHandle(const String &) const
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
Definition: constants.h:12
#define BALL_DEPRECATED
Definition: COMMON/global.h:64
virtual bool openFile(const String &)
#define BALL_CREATE(name)
Definition: create.h:62