llconsole.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLCONSOLE_H
00033 #define LL_LLCONSOLE_H
00034 
00035 #include "llfixedbuffer.h"
00036 #include "llview.h"
00037 #include "v4color.h"
00038 #include <deque>
00039 
00040 class LLFontGL;
00041 
00042 class LLConsole : public LLFixedBuffer, public LLView
00043 {
00044 private:
00045         F32                     mLinePersistTime; // Age at which to stop drawing.
00046         F32                     mFadeTime; // Age at which to start fading
00047         std::deque<LLColor4>    mColors;
00048         LLFontGL*       mFont;
00049         S32                     mLastBoxHeight;
00050         S32                     mLastBoxWidth;
00051 
00052         struct LineInfo
00053         {
00054                 LineInfo(const LLWString &wln, F32 sz, const LLColor4& clr, F32 time)
00055                         : wline(wln), size(sz), color(clr), add_time(time)
00056                 {
00057                         
00058                 }
00059                 LLWString wline;
00060                 F32 size;
00061                 LLColor4 color;
00062                 F32 add_time;
00063         };
00064         typedef std::list<LineInfo> line_queue_t;
00065         line_queue_t mLineQueue;
00066         
00067 public:
00068         // Font size:
00069         // -1 = monospace, 0 means small, font size = 1 means big
00070         LLConsole(const std::string& name, const U32 max_lines, const LLRect &rect, 
00071                 S32 font_size_index, F32 persist_time );
00072         virtual ~LLConsole();
00073 
00074 
00075         // each line lasts this long after being added
00076         void                    setLinePersistTime(F32 seconds);
00077 
00078         void                    reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00079 
00080         // -1 = monospace, 0 means small, font size = 1 means big
00081         void                    setFontSize(S32 size_index);
00082 
00083         void                    addLine(const LLString& utf8line, F32 size, const LLColor4 &color);
00084         void                    addLine(const LLWString& wline, F32 size, const LLColor4 &color);
00085         void                    addQueuedLines();
00086         
00087         // Overrides
00088         /*virtual*/ void        draw();
00089         /*virtual*/ void        addLine(const LLString& utf8line);
00090         /*virtual*/ void        addLine(const LLWString& line);
00091         /*virtual*/ void        removeExtraLines();
00092 };
00093 
00094 extern LLConsole* gConsole;
00095 
00096 #endif

Generated on Fri May 16 08:33:16 2008 for SecondLife by  doxygen 1.5.5