BALL  1.4.1
modularWidget.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_VIEW_WIDGETS_MODULARWIDGET_H
00006 #define BALL_VIEW_WIDGETS_MODULARWIDGET_H
00007 
00008 #ifndef BALL_CONCEPT_EMBEDDABLE_H
00009 # include <BALL/CONCEPT/embeddable.h>
00010 #endif
00011 
00012 #ifndef BALL_VIEW_KERNEL_CONNECTIONOBJECT_H
00013 # include <BALL/VIEW/KERNEL/connectionObject.h>
00014 #endif
00015 
00016 #include <QtGui/QKeySequence>
00017 #include <QtGui/QToolBar>
00018 
00019 class QObject;
00020 class QMenuBar;
00021 class QWidget;
00022 class QAction;
00023 
00024 namespace BALL
00025 {
00026   class INIFile;
00027   class FragmentDB;
00028 
00029   namespace VIEW
00030   {
00031     class Preferences;
00032     class MainControl;
00033 
00057     class BALL_VIEW_EXPORT ModularWidget
00058       : public Embeddable,  
00059         public ConnectionObject
00060     {
00061       public:
00062       
00063       BALL_EMBEDDABLE(ModularWidget,Embeddable)
00064       BALL_CREATE(ModularWidget)
00065       
00066       
00069 
00074       ModularWidget(const char* name = "<ModularWidget>");
00075         
00078       ModularWidget(const ModularWidget& widget);
00079         
00081 
00084 
00088       virtual ~ModularWidget();
00089 
00091       virtual void destroy()
00092         { clear(); };
00093 
00097       virtual void clear();
00098 
00100 
00103       
00110       static void registerWidget(ModularWidget* mwidget)
00111         throw(Exception::NullPointer);
00112         
00120       virtual void initializeWidget(MainControl& main_control);
00121       
00130       virtual void finalizeWidget(MainControl& main_control);
00131 
00137       virtual bool canHandle(const String& /*fileformat*/) const { return false;}
00138 
00143       virtual bool openFile(const String& /*filename*/) { return false;}
00144 
00146 
00149   
00155       virtual void checkMenu(MainControl& main_control);
00156 
00158       QAction* insertMenuEntry (Position parent_id, const String& name, const QObject* receiver = 0, 
00159                            const char* slot = 0, const String& description = "", QKeySequence accel = QKeySequence());
00160 
00164       void setMenuHint(const String& hint);
00165 
00170       void setMenuHelp(const String& url);
00171 
00175       virtual void registerForHelpSystem(const QObject* object, const String& url);
00176 
00181       virtual void addToolBarEntries(QToolBar* main_tb);
00182 
00186       void setIcon(const String& filename, bool add_to_main_toolbar = true);
00187 
00188 
00190 
00193       
00200       virtual void initializePreferencesTab(Preferences& preferences);
00201       
00208       virtual void finalizePreferencesTab(Preferences& preferences);
00209       
00221       virtual void applyPreferences(){};
00222 
00228       virtual void fetchPreferences(INIFile& inifile);
00229       
00235       virtual void writePreferences(INIFile& inifile);
00236 
00238 
00241       
00245       bool lockComposites();
00246 
00248       bool unlockComposites();
00249 
00251 
00254 
00258       MainControl* getMainControl() const;
00259 
00264       virtual void setStatusbarText(const String& text, bool important = false);
00265 
00267       virtual void setStatusbarText(const QString& text, bool important = false);
00268 
00270       String getWorkingDir();
00271 
00273       void setWorkingDir(const String& dir);
00274 
00279       FragmentDB& getFragmentDB() const;
00280 
00282 
00285 
00293       virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00294 
00296 
00297       void setWorkingDirFromFilename_(String filename);
00298 
00299       virtual void showHelp(const String& url);
00300 
00301       protected:
00302 
00303       //_ id in the menubar entry "WINDOWS" for every widget
00304       QAction* window_menu_entry_;
00305 
00306       //_ should there be an entry to switch the window on and off?
00307       bool show_window_enty_;
00308 
00309       //_ should the widget be visible, if no config file entry exists?
00310       bool default_visible_;
00311 
00312       QAction* last_action_;
00313       QList<QAction*> main_toolbar_actions_;
00314     }; 
00315   
00316   } // namespace VIEW
00317 } // namespace BALL
00318 
00319 #endif // BALL_VIEW_WIDGETS_MODULARWIDGET_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines