Planeshift

eediterrortoolbox.h

Go to the documentation of this file.
00001 /*
00002  * Author: Andrew Robberts
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef EEDIT_ERROR_TOOLBOX_WINDOW_HEADER
00021 #define EEDIT_ERROR_TOOLBOX_WINDOW_HEADER
00022 
00023 #include <csutil/array.h>
00024 #include "eedittoolbox.h"
00025 #include "paws/pawswidget.h"
00026 
00027 class pawsButton;
00028 class pawsMessageTextBox;
00029 class pawsCheckBox;
00030 
00035 class EEditError
00036 {
00037 public:
00038     EEditError(const char * _desc, int _colour, int _severity, bool _isEffectError)
00039         : colour(_colour), severity(_severity), isEffectError(_isEffectError)
00040     {
00041         if (_desc == 0 || _desc[0] == '\0')
00042             desc = " ";
00043         else
00044             desc = _desc;
00045     }
00046 
00047     csString    desc;
00048     int         colour;
00049     int         severity;
00050     bool        isEffectError;
00051 };
00052 
00055 class EEditErrorToolbox : public EEditToolbox, public pawsWidget, public scfImplementation0<EEditErrorToolbox>
00056 {
00057 public:
00058     EEditErrorToolbox();
00059     virtual ~EEditErrorToolbox();
00060 
00066     void AddError(int severity, const char * msgId, const char * description);
00067 
00071     void SetLoadingEffects(bool isLoadingEffects);
00072 
00075     void Clear();
00076 
00079     void ResetFilter();
00080     
00081     // inheritted from EEditToolbox
00082     virtual void Update(unsigned int elapsed);
00083     virtual size_t GetType() const;
00084     virtual const char * GetName() const;
00085     
00086     // inheritted from pawsWidget
00087     virtual bool PostSetup(); 
00088     virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
00089     virtual void Show();
00090     
00091 private:
00092 
00096     void DisplayError(const EEditError & error);
00097     
00098     pawsMessageTextBox * errorText;
00099     pawsButton *         clearButton;
00100     pawsButton *         hideButton;
00101     pawsCheckBox *       onlyEffectErrors;
00102     pawsCheckBox *       showErrors;
00103     pawsCheckBox *       showWarnings;
00104     pawsCheckBox *       showNotifications;
00105 
00106     bool loadingEffects;
00107 
00108     csArray<EEditError> errors;
00109 };
00110 
00111 CREATE_PAWS_FACTORY(EEditErrorToolbox);
00112 
00115 #endif