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         virtual EWidgetType getWidgetType() const;
00075         virtual LLString getWidgetTag() const;
00076 
00077         // each line lasts this long after being added
00078         void                    setLinePersistTime(F32 seconds);
00079 
00080         void                    reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00081 
00082         // -1 = monospace, 0 means small, font size = 1 means big
00083         void                    setFontSize(S32 size_index);
00084 
00085         void                    addLine(const LLString& utf8line, F32 size, const LLColor4 &color);
00086         void                    addLine(const LLWString& wline, F32 size, const LLColor4 &color);
00087         void                    addQueuedLines();
00088         
00089         // Overrides
00090         /*virtual*/ void        draw();
00091         /*virtual*/ void        addLine(const LLString& utf8line);
00092         /*virtual*/ void        addLine(const LLWString& line);
00093         /*virtual*/ void        removeExtraLines();
00094 };
00095 
00096 extern LLConsole* gConsole;
00097 
00098 #endif

Generated on Thu Jul 1 06:08:22 2010 for Second Life Viewer by  doxygen 1.4.7