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

actions.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA application object action declarations
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/actions.h,v 1.4 2003/01/24 15:47:40 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 actions occured by user interactions and useful in
00029 // conjunction with yasa objects
00031 #ifndef YASAGUI_ACTIONS_INCLUDE
00032 #define YASAGUI_ACTIONS_INCLUDE
00033 
00034 #include <qaction.h>
00035 #include <qpopupmenu.h>
00036 #include "yasagui/yasagui.h"
00037 #include "list.h"
00038 #include "filedialog.h"
00039 
00040 
00042 class QListViewItem;
00043 class YActionHandler;
00044 class YFrame;
00045 class YEnvironment;
00046 class YMDIWindow;
00047 
00049 class YActions : public QObject
00050 {   Q_OBJECT
00051     enum ACTION_TYPE    {   ACTIVATE=0,
00052                             MAX_ACTIONS };
00053     // Commands are useful for Toolbars and Menus where the context is changing but nothing else
00054     QArray<QAction*>    setactions;
00055 protected:
00056     YActionHandler      &actionhandler;
00057     virtual int         _CreateMenu(YObject *object, QPopupMenu *menu) const;
00058     virtual int         _CreateTreeItems(YObject *object, QListViewItem *parent, QListViewItem *after=0) const
00059                         {   return 0;   object=0; parent=0; after=0;    }
00060     virtual int         _Activate(YObject *object);
00061 public:                 YActions(YActionHandler &ah);
00062     enum COMMAND_TYPE   {   ZOOM_IN,
00063                             ZOOM_OUT,
00064                             EXECUTE,
00065                         };
00066     virtual int         InitInstance();
00067     virtual void        UpdateActions();
00068     virtual int         Activate(YObject *object);
00071     virtual int         DoWindowCommand(YObject *, YActions::COMMAND_TYPE, YMDIWindow *){   return YASAE_NOT_IMPLEMENTED;   }
00072     virtual int         DoTreeCommand(YObject *, YActions::COMMAND_TYPE)                {   return YASAE_NOT_IMPLEMENTED;   }
00073     static int          CreateMenu(YObject *object, QPopupMenu *parent);
00074     static int          CreateTreeItems(YObject *object, QListViewItem *parent, QListViewItem *after=0);
00075     virtual void        NewObjectCreated(YObject *object)               { Q_UNUSED(object); }
00076     virtual void        ObjectRemoved(YObject *object)                  { Q_UNUSED(object); }
00077 private slots:
00078     int                 _activate();
00079 };
00080 
00081 
00085 class YSetActions : public YActions
00086 {   Q_OBJECT
00087     enum{ ADD=0, REMOVE_ALL, MAX_ACTIONS };
00088     QArray<QAction*>    setactions;
00089 protected:
00090     virtual int         _CreateMenu(YObject *object, QPopupMenu *menu) const;
00091 public:                 YSetActions(YActionHandler &ah) : YActions(ah), setactions(MAX_ACTIONS)         {}
00092     virtual int         InitInstance();
00093     virtual void        UpdateActions();
00094     virtual YObject*    Add(YObject *set);
00095     virtual int         RemoveAll(YObject *set) const;
00096     virtual void        NewObjectCreated(YObject *object);
00097     virtual void        ObjectRemoved(YObject *object);
00098 public slots:
00099     YObject*            AddEntry();
00100     int                 RemoveAllEntries();
00101 signals:
00102     void                NewItem(YObject *object);       // There was an item created. Not not neccessary a project item !
00103     void                ItemRemoved(YObject *object);
00104 };
00105 
00107 class YEntryActions : public YActions
00108 {   Q_OBJECT
00109     enum{ RENAME=0, REMOVE, MAX_ACTIONS };
00110     QArray<QAction*>    entryactions;
00111 protected:
00112     virtual int         _CreateMenu(YObject *object, QPopupMenu *parent) const;
00113 public:                 YEntryActions(YActionHandler &ah) : YActions(ah), entryactions(MAX_ACTIONS)     {}
00114     virtual int         InitInstance();
00115     virtual void        UpdateActions();
00116     virtual int         Remove(YObject *entry) const;
00117     virtual int         Rename(YObject *entry) const;
00118 public slots:
00119     int                 RenameEntry();
00120     int                 RemoveEntry();
00121 };
00122 
00124 class YProjectSetActions : public YSetActions
00125 {   Q_OBJECT
00126     enum{ CLEANUP=0, MAX_ACTIONS };
00127     QArray<QAction*>    projectsetactions;
00128 public:                 YProjectSetActions(YActionHandler &ah) : YSetActions(ah), projectsetactions(MAX_ACTIONS) {}
00129     virtual int         InitInstance();
00130 protected:
00131     virtual int         _Activate(YObject *object);
00132     virtual int         _CreateMenu(YObject *object, QPopupMenu *parent) const;
00133 public slots:
00134     void                CleanupProjects();
00135 };
00136 
00138 class YProjectActions : public YEntryActions
00139 {   Q_OBJECT
00140     enum{ CLEANUP=0, MAX_ACTIONS };
00141     QArray<QAction*>    projectactions;
00142 public:                 YProjectActions(YActionHandler &ah) : YEntryActions(ah), projectactions(MAX_ACTIONS)    {}
00143     virtual int         Rename(YObject *entry) const;
00144     virtual int         Remove(YObject *entry) const;
00145     virtual int         InitInstance();
00146 protected:
00147     virtual int         _Activate(YObject *object);
00148     virtual int         _CreateMenu(YObject *object, QPopupMenu *parent) const;
00149 public slots:
00150     void                CleanupProject();
00151 };
00154 class YResultsActions : public YEntryActions
00155 {   Q_OBJECT
00156 public:                 YResultsActions(YActionHandler &ah) : YEntryActions(ah)                         {}
00157 };
00159 class YTimingResultActions : public YEntryActions
00160 {   Q_OBJECT
00161 public:                 YTimingResultActions(YActionHandler &ah) : YEntryActions(ah)                    {}
00162     virtual int         DoWindowCommand(YObject *object, YActions::COMMAND_TYPE command, YMDIWindow *window);
00163 protected:
00164     virtual int         _Activate(YObject *object);
00165 };
00167 class YStatisticResultActions : public YEntryActions
00168 {   Q_OBJECT
00169 public:                 YStatisticResultActions(YActionHandler &ah) : YEntryActions(ah)                 {}
00170 protected:
00171     virtual int         _Activate(YObject *object);
00172 };
00173 
00175 class YTaskSetActions : public YSetActions
00176 {   Q_OBJECT
00177 public:                 YTaskSetActions(YActionHandler &ah) : YSetActions(ah)
00178                         {}
00179 };
00181 class YTaskActions : public YEntryActions
00182 {   Q_OBJECT
00183 public:                 YTaskActions(YActionHandler &ah) : YEntryActions(ah)
00184                         {}
00185 protected:
00186     virtual int         _Activate(YObject *object);
00187 };
00188 
00190 class YMutexSetActions : public YSetActions
00191 {   Q_OBJECT
00192 public:                 YMutexSetActions(YActionHandler &ah) : YSetActions(ah)
00193                         {}
00194 };
00196 class YMutexActions : public YEntryActions
00197 {   Q_OBJECT
00198 public:                 YMutexActions(YActionHandler &ah) : YEntryActions(ah)
00199                         {}
00200 protected:
00201     virtual int         _Activate(YObject *object);
00202 };
00203 
00205 class YEnvironmentSetActions : public YSetActions
00206 {   Q_OBJECT
00207 public:                 YEnvironmentSetActions(YActionHandler &ah) : YSetActions(ah)
00208                         {}
00209 };
00211 class YEnvironmentActions : public YEntryActions
00212 {   Q_OBJECT
00213     enum{ EXECUTE=0, TIMINGS, STATISTICS, LOGFILE, CLEANUP,  MAX_ACTIONS };
00214     QArray<QAction*>    eactions;
00215 public:                 YEnvironmentActions(YActionHandler &ah) : YEntryActions(ah), eactions(MAX_ACTIONS)
00216                         {}
00217     int                 InitInstance();
00218     int                 _CreateMenu(YObject *object, QPopupMenu *menu) const;
00219     void                UpdateActions();
00220     virtual int         Rename(YObject *entry) const;
00221     virtual int         Remove(YObject *object) const;
00222     virtual int         ShowLogFile(YEnvironment *object);
00223     virtual int         ShowTimingResults(YEnvironment *object);
00224     virtual int         ShowStatisticResults(YEnvironment *e);
00225     virtual int         DoTreeCommand(YObject *treeobject, YActions::COMMAND_TYPE command);
00226 protected:
00227     virtual int         _Activate(YObject *object);
00228 public slots:
00229     void                ExecuteEnvironment();
00230     void                CleanupEnvironment();
00231     void                ShowTimingResults();
00232     void                ShowStatisticResults();
00233     void                ShowLogFile();
00234 };
00236 class YSchedulerSetActions : public YSetActions
00237 {   Q_OBJECT
00238 public:                 YSchedulerSetActions(YActionHandler &ah) : YSetActions(ah)
00239                         {}
00240 };
00242 class YSchedulerActions : public YEntryActions
00243 {   Q_OBJECT
00244 public:                 YSchedulerActions(YActionHandler &ah) : YEntryActions(ah)
00245                         {}
00246 };
00247 
00249 class YFilePathActions : public YEntryActions
00250 {   Q_OBJECT
00251     QFont               font;                                       
00252 public:                 YFilePathActions(YActionHandler &ah) : YEntryActions(ah),
00253                         font("Courier", 10)
00254                         {
00255                             font.setFixedPitch(true);
00256                         }
00257     QFont&              GetFont()                                   { return font; }
00258 protected:
00259     virtual int         _Activate(YObject *object);
00260 };
00262 class YFilePathSetActions : public YSetActions
00263 {   Q_OBJECT
00264     YFileDialog         dialog;
00265 public:                 YFilePathSetActions(YActionHandler &ah, const QString &addcaption, const QString &postfix) :
00266                         YSetActions(ah),
00267                         dialog(".", addcaption, postfix, QFileDialog::ExistingFiles )
00268                         {}
00269     virtual YObject*    Add(YObject *set);
00270 };
00272 class YSourceSetActions : public YFilePathSetActions
00273 {   Q_OBJECT
00274 public:                 YSourceSetActions(YActionHandler &ah) :
00275                         YFilePathSetActions(ah, MSGP_ADD_SOURCE_FILE, SOURCE_FILE_FILTER)
00276                         {}
00277 };
00279 class YHeaderSetActions : public YFilePathSetActions
00280 {   Q_OBJECT
00281 public:                 YHeaderSetActions(YActionHandler &ah) :
00282                         YFilePathSetActions(ah, MSGP_ADD_HEADER_FILE, HEADER_FILE_FILTER)
00283                         {}
00284 };
00285 
00286 
00287 
00288 
00290 #endif                                                                          // ifndef YASAGUI_ACTIONS_INCLUDE

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