Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

mainwindow.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA application main window declarations
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/mainwindow.h,v 1.4 2003/01/24 15:47:41 bj Exp $
00009 //
00011 //
00012 // This program is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU General Public License as published by
00014 // the Free Software Foundation; either version 2 of the License, or
00015 // (at your option) any later version.
00016 //
00017 // This program is distributed in the hope that it will be useful,
00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU General Public License
00023 // along with this program (See the included file COPYING);
00024 // if not, write to the Free Software Foundation, Inc.,
00025 // 675 Mass Ave, Cambridge, MA 02139, USA.
00026 //
00028 // This file contains all information about the whole window (project manager, output, toolbars etc)
00030 #ifndef YASAGUI_MAINWINDOW_INCLUDE
00031 #define YASAGUI_MAINWINDOW_INCLUDE
00032 
00033 #include <qapplication.h>
00034 #include <qmainwindow.h>
00035 #include <qworkspace.h>
00036 #include <qaction.h>
00037 #include <qtoolbar.h>
00038 #include <yasagui/yasagui.h>
00039 #include <qsplitter.h>
00040 #include "translations.h"
00041 #include "config.h"
00042 #include "frame.h"
00043 //#include "settings.h"
00044 
00046 class YOutputView;
00047 class YApplication;
00048 class YMDIWindow;
00049 class YWorkSpaceTreeView;
00050 class YWorkSpace;
00051 
00052 
00054 class YMainWindow : public QMainWindow
00055 {
00056     enum{   NEW_WORKSPACE=0     , OPEN_WORKSPACE    , SAVE_WORKSPACE        , SAVE_WORKSPACE_AS     , CLOSE_WORKSPACE, EXIT ,
00057             CLOSE_WINDOW        , NEW_WINDOW        , NEW_FULLSCREEN_WINDOW , CLOSE_DOUBLE_WINDOWS  ,
00058             CLOSE_ALL_WINDOWS   , CASCADE_WINDOWS   , TILE_WINDOWS          , ABOUT_QT              , ABOUT_APP             ,
00059             EXECUTE             , ZOOM_IN           , ZOOM_OUT              , MAX_ACTIONS };
00060     Q_OBJECT
00061     QSplitter           *splittv;
00062     QSplitter           *splitth;
00063     QWorkspace          *workspace;
00064     YApplication        *application;
00065     YWorkSpaceTreeView  *workspacetreeview;
00066     YOutputView         *outputview;
00067     QArray<QAction*>    actions;
00068     QPopupMenu          *filemenu;
00069     QPopupMenu          *environmentmenu;
00070     QPopupMenu          *windowmenu;
00071     QPopupMenu          *helpmenu;
00072     QToolBar            *workspacetoolbar;
00073     QToolBar            *environmenttoolbar;
00074 
00075     int                 CreateActions();
00076     int                 CreateMenu();
00077     int                 CreateToolBar();
00078     int                 CreateStatusBar();
00079 public:
00080                         YMainWindow( QWidget* parent = 0, const char* name = 0, WFlags f = WType_TopLevel ) : QMainWindow( parent, name, f ),
00081                         splittv(0),
00082                         splitth(0),
00083                         workspace(0),
00084                         application(0),
00085                         workspacetreeview(0),
00086                         outputview(0),
00087                         actions(MAX_ACTIONS),
00088                         filemenu(0),
00089                         environmentmenu(0),
00090                         windowmenu(0),
00091                         helpmenu(0),
00092                         workspacetoolbar(0),
00093                         environmenttoolbar(0)
00094                         { }
00095                         ~YMainWindow();
00096     int                 InitInstance(YApplication *app);
00097     int                 Show();
00098     static YMDIWindow*  FindWindow(const QString &title, YObject *object);
00099     static bool         ForegroundWindow(const QString &title, YObject *object);
00100     QWidgetList         GetWindowList();
00101     QWorkspace*         GetMDIWorkSpace()               { return this ? workspace :0;       }
00102 
00103 public slots:
00104     void                CloseWindow();
00105     void                NewWindow();
00106     void                NewFullScreenWindow();
00107     void                UpdateWindowsMenu();                                    
00108     void                OpenQTAbout();
00109     void                OpenHelpWindow();
00110     void                CloseDoubleWindows();
00111     void                CloseAllWindows();
00112     void                WindowMenuActivated(int id );
00113     void                WorkSpaceActionsEnabled(YWorkSpace *workspace);
00114     void                WorkSpaceActionsDisabled(YWorkSpace *workspace);
00115     void                ZoomIn();
00116     void                ZoomOut();
00117     //void              ExecuteEnvironment();
00118     void                ExecuteCurrentEnvironment();
00119 protected:
00120     virtual void        resizeEvent(QResizeEvent *e);
00121 signals:
00122     void                StatusMessage(const QString&, int );                    // print given text to Statusbar
00123 };
00124 
00125 
00126 
00129 class YMDIWindow : public QMainWindow
00130 {   Q_OBJECT
00131 protected:
00132     YMainWindow         *mainwindow;                                            
00133     YFrame              *mainframe;
00134     virtual void        keyPressEvent (QKeyEvent *event);
00135 public:                 YMDIWindow(YMainWindow *parent, const QString title) :
00136                         QMainWindow( parent ? parent->GetMDIWorkSpace() : 0, title.latin1(), WDestructiveClose),
00137                         mainwindow(parent),
00138                         mainframe(0)
00139                         { }
00140                         ~YMDIWindow();
00141     virtual int         InitInstance(YFrameArgs &args);
00142     virtual int         Show();
00143     const QString&      GetTitle() const                {   return GetWindowArgs().GetTitle();      }
00144     YFrameArgs&         GetWindowArgs() const           {   return mainframe->GetFrameArgs();       }
00145     static int          OpenNewWindow(YFrameArgs *args, bool multiple=false, bool fullscreen=false);
00148     bool                CheckTitle(const QString &name) const
00149                         {
00150                             if ( caption().length() > GetTitle().length() )
00151                                 if ( caption().at( GetTitle().length() ) != QChar(':') )
00152                                     return false;
00153                             return name==caption().left( GetTitle().length() );
00154                         }
00155     YFrame*             GetMainFrame() const            {   return mainframe;                       }
00156 public slots:
00157     void                SetCaption(const QString &newname, YObject *object);
00158 signals:
00159     void                StatusMessage(const QString&, int );                
00160 };
00161 
00162 
00164 #endif                                                                          // ifndef YASAGUI_MAINWINDOW_INCLUDE

Generated on Thu Feb 13 23:43:54 2003 for Yasa by doxygen1.3-rc3