/* $Id: ConversationWindow.h,v 1.9 1999/10/22 20:50:46 v2kea318 Exp $

$Log: ConversationWindow.h,v $
 * Revision 1.9  1999/10/22  20:50:46  v2kea318
 * Use the OO Thread interface for thread things.
 *
 * Revision 1.8  1999/10/14  16:41:47  v2kea318
 * Use the pseudo machine independant thread.h header to define all
 * thread related things.
 *
 * Revision 1.7  1999/08/16  17:02:31  v2kea318
 * Make the mut member a MutexRep object rather that a Mutex object.
 *
 * Revision 1.6  1999/08/05  19:35:51  v2kea318
 * Change the update method to include a string with the time stamp of
 * the message.
 *
 * Revision 1.5  1999/07/30  21:43:22  v2kea318
 * Use the Mutex class for the mutex.
 *
 * Revision 1.4  1999/07/30  20:40:50  v2kea318
 * Use Pthread.h instead of pthread.h to define threads.  This is a
 * temporary kludge because of some extraneous spaces in the standard
 * version.
 *
 * Revision 1.3  1999/07/30  17:55:48  v2kea318
 * Reformat the header file names for Standard C++ compliance.
 *
 * Revision 1.2  1999/07/01  21:47:46  v2kea318
 * Added a static method to realize the window.
 *
 * Revision 1.1  1999/07/01  17:02:56  v2kea318
 * Initial revision
 *
***************************************************************************

Define a conversation window manager class.  This window will display
all ongoing conversations in a single window.  Both outgoing and incoming
text will be displayed.

***************************************************************************/

#ifndef MSG_CONVERSATION_WINDOW_H
#define MSG_CONVERSATION_WINDOW_H

#include "Thread.h"
#include "MutexRep.h"
#include <string>
#include "msg_codes.h"
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>

class ConversationWindow {
public:
  // constructor(s)
  ConversationWindow(); 
private:
  ConversationWindow(const ConversationWindow& w);
public:
  // destructor.
  ~ConversationWindow() {}

  // update the conversation with a new entry.
  void update(msg_action_code type, const string& text, const string& user,
	      const string& timestamp);

  // force rebuild of the window.
  static void destroy_force_rebuild();

private:
  static Widget text_widget;      // the text widget in the window.
  static bool realized;
  static Pointer<Thread> loop_thread;

  // actually build the window.
  void build_window();
  void realize_window();

  // add a mutex for thread synchronization.
  static MutexRep mut;
  MutexRep get_mutex();
};

#endif
