File indexing completed on 2024-04-28 15:35:16
0001 /*************************************************************************** 0002 * Copyright (C) 2004 by Tomas Mecir * 0003 * kmuddy@kmuddy.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU Library General Public License as * 0007 * published by the Free Software Foundation; either version 2 of the * 0008 * License, or (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU Library General Public License for more details. * 0014 ***************************************************************************/ 0015 #ifndef CRESULTHANDLER_H 0016 #define CRESULTHANDLER_H 0017 0018 #include <list> 0019 #include <string> 0020 0021 using namespace std; 0022 0023 #include "libmxp.h" 0024 0025 /** 0026 This class handles a list of results, that are to be sent to the application. 0027 0028 @author Tomas Mecir 0029 */ 0030 0031 class cResultHandler { 0032 public: 0033 /** constructor */ 0034 cResultHandler (); 0035 /** destructor */ 0036 ~cResultHandler (); 0037 0038 /** return next result */ 0039 mxpResult *nextResult (); 0040 /** do we have any results pending? */ 0041 bool haveResults (); 0042 0043 /** delete last returned result */ 0044 void deleteReturned (); 0045 0046 void addToList (mxpResult *res); 0047 0048 /** reset the class by deleting all pending results */ 0049 void reset (); 0050 0051 //result creation methods coming now 0052 //the string->char* conversion takes place here 0053 0054 /** type 0 */ 0055 mxpResult *createNothing (); 0056 /** type 1 */ 0057 mxpResult *createText (const string &text); 0058 /** type 2 */ 0059 mxpResult *createLineTag (int tag); 0060 /** type 3 */ 0061 mxpResult *createFlag (bool begin, const string &flag); 0062 /** type 4 */ 0063 mxpResult *createVariable (const string &name, const string &value, bool erase = false); 0064 /** type 5 */ 0065 mxpResult *createFormatting (unsigned char mask, unsigned char attributes, RGB fg, RGB bg, 0066 const string &font, int size); 0067 /** type 6 */ 0068 mxpResult *createLink (const string &name, const string &url, const string &text, 0069 const string &hint); 0070 /** type 7 */ 0071 mxpResult *createSendLink (const string &name, const string &command, const string &text, 0072 const string &hint, bool prompt, bool ismenu); 0073 /** type 8 */ 0074 mxpResult *createExpire (const string &name); 0075 /** type 9 */ 0076 mxpResult *createSendThis (const string &command); 0077 /** type 10 */ 0078 mxpResult *createHorizLine (); 0079 /** type 11 */ 0080 mxpResult *createSound (bool isSOUND, const string &fname, int vol, int count, int priority, 0081 bool contifrereq, const string &type, const string &url); 0082 /** type 12 */ 0083 mxpResult *createWindow (const string &name, const string &title, int left, int top, 0084 int width, int height, bool scrolling, bool floating); 0085 /** type 13 */ 0086 mxpResult *createInternalWindow (const string &name, const string &title, alignType align, 0087 bool scrolling); 0088 /** type 14 */ 0089 mxpResult *createCloseWindow (const string &name); 0090 /** type 15 */ 0091 mxpResult *createSetWindow (const string &name); 0092 /** type 16 */ 0093 mxpResult *createMoveCursor (int x, int y); 0094 /** type 17 */ 0095 mxpResult *createEraseText (bool restofframe); 0096 /** type 18 */ 0097 mxpResult *createRelocate (const string &server, int port); 0098 /** type 19 */ 0099 mxpResult *createSendLogin (bool username); 0100 /** type 20 */ 0101 mxpResult *createImage (const string &fname, const string &url, const string &type, int height, 0102 int width, int hspace, int vspace, alignType align); 0103 /** type 21 */ 0104 mxpResult *createImageMap (const string &name); 0105 /** type 22 */ 0106 mxpResult *createGauge (const string &variable, const string &maxvariable, 0107 const string &caption, RGB color); 0108 /** type 23 */ 0109 mxpResult *createStat (const string &variable, const string &maxvariable, 0110 const string &caption); 0111 0112 /** type -1 */ 0113 mxpResult *createError (const string &error); 0114 /** type -2 */ 0115 mxpResult *createWarning (const string &warning); 0116 0117 /** delete this result */ 0118 void deleteResult (mxpResult *res); 0119 protected: 0120 0121 /** result that was most recently sent to the app */ 0122 mxpResult *returnedResult; 0123 list<mxpResult *> results; 0124 }; 0125 0126 #endif