Gui/Application.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef APPLICATION_H
00025 #define APPLICATION_H
00026
00027 #include <QPixmap>
00028 #include <string>
00029 #include <vector>
00030
00031 #define putpix()
00032
00033 #include <App/Application.h>
00034
00035 class QCloseEvent;
00036
00037 namespace Gui{
00038 class BaseView;
00039 class CommandManager;
00040 class Document;
00041 class MacroManager;
00042 class MDIView;
00043 class MainWindow;
00044 class MenuItem;
00045 class ViewProvider;
00046
00051 class GuiExport Application
00052 {
00053 public:
00055 Application(bool GUIenabled);
00057 ~Application();
00058
00061
00062 void open(const char* FileName, const char* Module);
00064 void importFrom(const char* FileName, const char* DocName, const char* Module);
00066 void exportTo(const char* FileName, const char* DocName, const char* Module);
00068
00069
00072
00073 bool sendMsgToActiveView(const char* pMsg, const char** ppReturn=0);
00075 bool sendHasMsgToActiveView(const char* pMsg);
00077 void attachView(Gui::BaseView* pcView);
00079 void detachView(Gui::BaseView* pcView);
00081 void viewActivated(Gui::MDIView* pcView);
00083 void onUpdate(void);
00085 void updateActive(void);
00087
00090
00091 boost::signal<void (const Gui::Document&)> signalNewDocument;
00093 boost::signal<void (const Gui::Document&)> signalDeleteDocument;
00095 boost::signal<void (const Gui::Document&)> signalRelabelDocument;
00097 boost::signal<void (const Gui::Document&)> signalRenameDocument;
00099 boost::signal<void (const Gui::Document&)> signalActiveDocument;
00101 boost::signal<void (const Gui::ViewProvider&)> signalNewObject;
00103 boost::signal<void (const Gui::ViewProvider&)> signalDeletedObject;
00105 boost::signal<void (const Gui::ViewProvider&, const App::Property&)> signalChangedObject;
00107 boost::signal<void (const Gui::ViewProvider&)> signalRenamedObject;
00109 boost::signal<void (const Gui::ViewProvider&)> signalActivatedObject;
00111 boost::signal<void (const char*)> signalActivateWorkbench;
00113 boost::signal<void (const char*)> signalAddWorkbench;
00115 boost::signal<void (const char*)> signalRemoveWorkbench;
00117 boost::signal<void (const Gui::MDIView*)> signalActivateView;
00119
00122 protected:
00124 void slotNewDocument(const App::Document&);
00125 void slotDeleteDocument(const App::Document&);
00126 void slotRelabelDocument(const App::Document&);
00127 void slotRenameDocument(const App::Document&);
00128 void slotActiveDocument(const App::Document&);
00129 void slotNewObject(const ViewProvider&);
00130 void slotDeletedObject(const ViewProvider&);
00131 void slotChangedObject(const ViewProvider&, const App::Property& Prop);
00132 void slotRenamedObject(const ViewProvider&);
00133 void slotActivatedObject(const ViewProvider&);
00134
00135 public:
00137 void onLastWindowClosed(Gui::Document* pcDoc);
00139 Gui::Document* activeDocument(void) const;
00141 void setActiveDocument(Gui::Document* pcDocument);
00145 Gui::Document* getDocument(const char* name) const;
00149 Gui::Document* getDocument(const App::Document* pDoc) const;
00151 void showViewProvider(App::DocumentObject*);
00153 void hideViewProvider(App::DocumentObject*);
00155 Gui::ViewProvider* getViewProvider(App::DocumentObject*) const;
00157
00159 bool isClosing(void);
00160
00163
00164 bool activateWorkbench(const char* name);
00165 QPixmap workbenchIcon(const QString&) const;
00166 QString workbenchToolTip(const QString&) const;
00167 QString workbenchMenuText(const QString&) const;
00168 QStringList workbenches(void) const;
00169 void setupContextMenu(const char* recipient, MenuItem*) const;
00171
00174
00175 Gui::MacroManager *macroManager(void);
00177 Gui::CommandManager &commandManager(void);
00179 void runCommand(bool bForce, const char* sCmd,...);
00180 bool runPythonCode(const char* cmd, bool gui=false, bool pyexc=true);
00182 void createStandardOperations();
00184
00187
00188 static Application* Instance;
00189 static void initApplication(void);
00190 static void initTypes(void);
00191 static void runApplication(void);
00192 void tryClose( QCloseEvent * e );
00194
00195 public:
00196
00197
00198
00199
00200 PYFUNCDEF_S(sActivateWorkbenchHandler);
00201 PYFUNCDEF_S(sAddWorkbenchHandler);
00202 PYFUNCDEF_S(sRemoveWorkbenchHandler);
00203 PYFUNCDEF_S(sGetWorkbenchHandler);
00204 PYFUNCDEF_S(sListWorkbenchHandlers);
00205 PYFUNCDEF_S(sActiveWorkbenchHandler);
00206 PYFUNCDEF_S(sAddResPath);
00207 PYFUNCDEF_S(sAddLangPath);
00208 PYFUNCDEF_S(sAddIconPath);
00209 PYFUNCDEF_S(sAddIcon);
00210
00211 PYFUNCDEF_S(sSendActiveView);
00212
00213 PYFUNCDEF_S(sUpdateGui);
00214 PYFUNCDEF_S(sUpdateLocale);
00215 PYFUNCDEF_S(sGetLocale);
00216 PYFUNCDEF_S(sCreateDialog);
00217 PYFUNCDEF_S(sAddPreferencePage);
00218
00219 PYFUNCDEF_S(sRunCommand);
00220 PYFUNCDEF_S(sAddCommand);
00221
00222 PYFUNCDEF_S(sHide);
00223 PYFUNCDEF_S(sShow);
00224 PYFUNCDEF_S(sHideObject);
00225 PYFUNCDEF_S(sShowObject);
00226
00227 PYFUNCDEF_S(sOpen);
00228 PYFUNCDEF_S(sInsert);
00229 PYFUNCDEF_S(sExport);
00230
00231 PYFUNCDEF_S(sActiveDocument);
00232 PYFUNCDEF_S(sGetDocument);
00233
00234 static PyMethodDef Methods[];
00235
00236 private:
00237 struct ApplicationP* d;
00239 PyObject* _pcWorkbenchDictionary;
00240 };
00241
00242 }
00243
00244 #endif