File indexing completed on 2024-04-21 04:02:47

0001 //
0002 // C++ Interface: cwindowlist
0003 //
0004 // Description: 
0005 //
0006 /*
0007 Copyright 2004-2011 Tomas Mecir <kmuddy@kmuddy.com>
0008 
0009 This program is free software; you can redistribute it and/or
0010 modify it under the terms of the GNU General Public License as
0011 published by the Free Software Foundation; either version 2 of 
0012 the License, or (at your option) any later version.
0013 
0014 This program is distributed in the hope that it will be useful,
0015 but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 GNU General Public License for more details.
0018 
0019 You should have received a copy of the GNU General Public License
0020 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #ifndef CWINDOWLIST_H
0024 #define CWINDOWLIST_H
0025 
0026 #include "cactionbase.h"
0027 
0028 #include <qstringlist.h>
0029 #include <qfont.h>
0030 
0031 #include <map>
0032 
0033 class cTextChunk;
0034 class dlgOutputWindow;
0035 
0036 /**
0037 This class manages output windows.
0038 
0039 @author Tomas Mecir
0040 */
0041 
0042 class cWindowList: public cActionBase {
0043 public:
0044   /** constructor */
0045   cWindowList (int sess);
0046   /** destructor */
0047   ~cWindowList () override;
0048 
0049   /** does this window exist? */
0050   bool exists (const QString &name);
0051   /** adds a window, returns true if successful */
0052   bool add (const QString &name, bool autoadd = false);
0053   /** removes a window, returns true if successful */
0054   bool remove (const QString &name);
0055 
0056   /** returns a list of windows - kinda slow */
0057   QStringList windowList ();
0058 
0059   bool show (const QString &name);
0060   bool hide (const QString &name);
0061   /** show if hidden, hide if shown :) */
0062   void toggle (const QString &name);
0063   bool isShown (const QString &name);
0064 
0065   void textToWindow (const QString &name, cTextChunk *chunk);
0066 
0067   void save ();
0068 
0069   void adjustFonts(QFont font);
0070   void applySettings (bool allowblinking, int indentvalue);
0071 
0072 protected:
0073   void load ();
0074   void eventNothingHandler (QString event, int session) override;
0075 
0076   std::map<QString, dlgOutputWindow *> windows;
0077   QStringList toerase;
0078 
0079 private:
0080   QString directory;
0081   QString name, file;
0082 };
0083 
0084 #endif