BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 <QtGui/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 
62  : public Embeddable,
63  public ConnectionObject
64  {
65  public:
66 
69 
70 
73 
78  ModularWidget(const char* name = "<ModularWidget>");
79 
82  ModularWidget(const ModularWidget& widget);
83 
85 
88 
92  virtual ~ModularWidget();
93 
95  virtual void destroy()
96  { clear(); };
97 
101  virtual void clear();
102 
104 
107 
114  static void registerWidget(ModularWidget* mwidget)
115  throw(Exception::NullPointer);
116 
124  virtual void initializeWidget(MainControl& main_control);
125 
134  virtual void finalizeWidget(MainControl& main_control);
135 
141  virtual bool canHandle(const String& /*fileformat*/) const { return false;}
142 
147  virtual bool openFile(const String& /*filename*/) { return false;}
148 
150 
153 
159  virtual void checkMenu(MainControl& main_control);
160 
162  QAction* insertMenuEntry(Position parent_id, const QString& name, const QObject* receiver = 0,
163  const char* slot = 0, const String& description = "", QKeySequence accel = QKeySequence(),
164  const QString& menu_hint = QString(""),
166 
173  void setMenuHelp(QAction* action, const String& url);
174 
178  virtual void registerForHelpSystem(const QObject* object, const String& url);
179 
184  virtual void addToolBarEntries(QToolBar* main_tb);
185 
192  void setIcon(QAction* action, const String& filename, bool add_to_main_toolbar = true);
193 
194 
196 
199 
206  virtual void initializePreferencesTab(Preferences& preferences);
207 
214  virtual void finalizePreferencesTab(Preferences& preferences);
215 
227  virtual void applyPreferences(){};
228 
234  virtual void fetchPreferences(INIFile& inifile);
235 
241  virtual void writePreferences(INIFile& inifile);
242 
244 
247 
251  bool lockComposites();
252 
254  bool unlockComposites();
255 
257 
260 
264  MainControl* getMainControl() const;
265 
270  virtual void setStatusbarText(const String& text, bool important = false);
271 
273  virtual void setStatusbarText(const QString& text, bool important = false);
274 
276  String getWorkingDir();
277 
279  void setWorkingDir(const String& dir);
280 
285  FragmentDB& getFragmentDB() const;
286 
288 
291 
299  virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
300 
302 
303  void setWorkingDirFromFilename_(String filename);
304 
305  virtual void showHelp(const String& url);
306 
307  protected:
308 
309  //_ id in the menubar entry "WINDOWS" for every widget
311 
312  //_ should there be an entry to switch the window on and off?
314 
315  //_ should the widget be visible, if no config file entry exists?
317 
318  QList<QAction*> main_toolbar_actions_;
319  };
320 
321  } // namespace VIEW
322 } // namespace BALL
323 
324 #endif // BALL_VIEW_WIDGETS_MODULARWIDGET_H
#define BALL_CREATE(name)
Definition: create.h:62
virtual bool openFile(const String &)
BALL_VIEW_EXPORT MainControl * getMainControl()
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31
virtual bool canHandle(const String &) const
virtual void applyPreferences()
QList< QAction * > main_toolbar_actions_