00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_WIDGETS_MODULARWIDGET_H
00008 #define BALL_VIEW_WIDGETS_MODULARWIDGET_H
00009
00010 #ifndef BALL_CONCEPT_EMBEDDABLE_H
00011 # include <BALL/CONCEPT/embeddable.h>
00012 #endif
00013
00014 #ifndef BALL_VIEW_KERNEL_CONNECTIONOBJECT_H
00015 # include <BALL/VIEW/KERNEL/connectionObject.h>
00016 #endif
00017
00018 #include <QtGui/QKeySequence>
00019 #include <QtGui/QToolBar>
00020
00021 class QObject;
00022 class QMenuBar;
00023 class QWidget;
00024 class QAction;
00025
00026 namespace BALL
00027 {
00028 class INIFile;
00029 class FragmentDB;
00030
00031 namespace VIEW
00032 {
00033 class Preferences;
00034 class MainControl;
00035
00059 class BALL_VIEW_EXPORT ModularWidget
00060 : public Embeddable,
00061 public ConnectionObject
00062 {
00063 public:
00064
00065 BALL_EMBEDDABLE(ModularWidget,Embeddable)
00066 BALL_CREATE(ModularWidget)
00067
00068
00071
00076 ModularWidget(const char* name = "<ModularWidget>");
00077
00080 ModularWidget(const ModularWidget& widget);
00081
00083
00086
00090 virtual ~ModularWidget();
00091
00093 virtual void destroy()
00094 { clear(); };
00095
00099 virtual void clear();
00100
00102
00105
00112 static void registerWidget(ModularWidget* mwidget)
00113 throw(Exception::NullPointer);
00114
00122 virtual void initializeWidget(MainControl& main_control);
00123
00132 virtual void finalizeWidget(MainControl& main_control);
00133
00139 virtual bool canHandle(const String& ) const { return false;}
00140
00145 virtual bool openFile(const String& ) { return false;}
00146
00148
00151
00157 virtual void checkMenu(MainControl& main_control);
00158
00160 QAction* insertMenuEntry (Position parent_id, const String& name, const QObject* receiver = 0,
00161 const char* slot = 0, const String& description = "", QKeySequence accel = QKeySequence());
00162
00166 void setMenuHint(const String& hint);
00167
00172 void setMenuHelp(const String& url);
00173
00177 virtual void registerForHelpSystem(const QObject* object, const String& url);
00178
00183 virtual void addToolBarEntries(QToolBar* main_tb);
00184
00188 void setIcon(const String& filename, bool add_to_main_toolbar = true);
00189
00190
00192
00195
00202 virtual void initializePreferencesTab(Preferences& preferences);
00203
00210 virtual void finalizePreferencesTab(Preferences& preferences);
00211
00223 virtual void applyPreferences(){};
00224
00230 virtual void fetchPreferences(INIFile& inifile);
00231
00237 virtual void writePreferences(INIFile& inifile);
00238
00240
00243
00247 bool lockComposites();
00248
00250 bool unlockComposites();
00251
00253
00256
00260 MainControl* getMainControl() const;
00261
00266 virtual void setStatusbarText(String text, bool important = false);
00267
00269 String getWorkingDir();
00270
00272 void setWorkingDir(const String& dir);
00273
00278 FragmentDB& getFragmentDB() const;
00279
00281
00284
00292 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00293
00295
00296 void setWorkingDirFromFilename_(String filename);
00297
00298 virtual void showHelp(const String& url);
00299
00300 protected:
00301
00302
00303 QAction* window_menu_entry_;
00304
00305
00306 bool show_window_enty_;
00307
00308
00309 bool default_visible_;
00310
00311 QAction* last_action_;
00312 QList<QAction*> main_toolbar_actions_;
00313 };
00314
00315 }
00316 }
00317
00318 #endif // BALL_VIEW_WIDGETS_MODULARWIDGET_H