Main Page | Class Hierarchy | Class List | File List | Class Members

Flu_Chat_Buffer.h

00001 // $Id: Flu_Chat_Buffer.h,v 1.5 2003/08/20 16:29:40 jbryan Exp $
00002 
00003 /***************************************************************
00004  *                FLU - FLTK Utility Widgets 
00005  *  Copyright (C) 2002 Ohio Supercomputer Center, Ohio State University
00006  *
00007  * This file and its content is protected by a software license.
00008  * You should have received a copy of this license with this file.
00009  * If not, please contact the Ohio Supercomputer Center immediately:
00010  * Attn: Jason Bryan Re: FLU 1224 Kinnear Rd, Columbus, Ohio 43212
00011  * 
00012  ***************************************************************/
00013 
00014 
00015 
00016 #ifndef _FLU_CHAT_BUFFER_H
00017 #define _FLU_CHAT_BUFFER_H
00018 
00019 /* fltk includes */
00020 #include <FL/Fl.H>
00021 #include <FL/Fl_Widget.H>
00022 #include <FL/Fl_Scrollbar.H>
00023 #include "FLU/Flu_Enumerations.h"
00024 
00026 
00027 class FLU_EXPORT Flu_Chat_Buffer : public Fl_Widget
00028 {
00029 
00030   class FLU_EXPORT MessageInfo
00031   {
00032   public:
00033     char type;
00034     char *handle;
00035     char *message;
00036     int handleW, messageW, height;
00037   };
00038 
00039  public:
00040 
00042   Flu_Chat_Buffer( int x, int y, int w, int h, const char *label = 0 );
00043 
00045   virtual ~Flu_Chat_Buffer();
00046 
00048   void addSystemMessage( const char *msg );
00049 
00051   void addRemoteMessage( const char *handle, const char *msg );
00052 
00054   void addLocalMessage( const char *handle, const char *msg );
00055 
00057   void clear( int maximumLines = 500 );
00058 
00060 
00061   inline void setSystemStyle( Fl_Font f, Fl_Color c )
00062     { systemFont = f; systemColor = c; }
00063 
00065 
00066   inline void setRemoteHandleStyle( Fl_Font f, Fl_Color c )
00067     { remoteHandleFont = f; remoteHandleColor = c; }
00068 
00070 
00071   inline void setLocalHandleStyle( Fl_Font f, Fl_Color c )
00072     { localHandleFont = f; localHandleColor = c; }
00073 
00075 
00076   inline void setRemoteMessageStyle( Fl_Font f, Fl_Color c )
00077     { remoteMessageFont = f; remoteMessageColor = c; }
00078 
00081   inline void setLocalMessageStyle( Fl_Font f, Fl_Color c )
00082     { localMessageFont = f; localMessageColor = c; }
00083 
00085   virtual void resize( int x, int y, int w, int h );
00086 
00087  protected:
00088 
00089   inline static void _scrollbarCB( Fl_Widget* w, void* arg )
00090     { ((Flu_Chat_Buffer*)arg)->scrollbarCB(); }
00091   void scrollbarCB();
00092 
00093   Fl_Font systemFont, remoteHandleFont, localHandleFont,
00094     remoteMessageFont, localMessageFont;
00095   Fl_Color systemColor, remoteHandleColor, localHandleColor,
00096     remoteMessageColor, localMessageColor;
00097 
00098   MessageInfo *buffer;
00099   int maxLines, totalLines, currentLine;
00100   bool recomputeFootprint;
00101 
00102   virtual void draw();
00103 
00104   Fl_Scrollbar *scrollbar;
00105 
00106   void _addMessage( char type, char *handle, char *msg );
00107   void _computeMessageFootprint();
00108 
00109 };
00110 
00111 #endif

Generated on Fri Nov 5 12:41:32 2004 for FLTK Utility Library and Widget Collection (FLU) by doxygen 1.3.5