#ifndef __OXNAMELIST_H
#define __OXNAMELIST_H

#define C_PING     1
#define C_WHOIS    2
#define C_MESSAGE  3

#include <xclass/OXMenu.h>

class OXNameList;

class OXName : public OXMenuTitle {

friend class OXNameList;

public:
  OXName(const OXWindow *p, OHotString *s, OXPopupMenu *menu, 
	      GC norm = _defaultGC,
	      XFontStruct *font = _defaultFontStruct,
	      unsigned int options = 0);

  void SetState(int state);
  void DoSendMessage();
  void Associate(const OXWindow *w) { _msgWindow = w; } 

  friend class OXClient;

protected:
  void _DoRedraw();
  const OXWindow * _msgWindow;
};

class OXNameList : public OXVerticalFrame {
public:
  OXNameList(const OXWindow *p, OXPopupMenu * popup, int w, int h,
	    unsigned int options = VERTICAL_FRAME);
  ~OXNameList();

  void AddPopup(OHotString *s, OXPopupMenu *menu, OLayoutHints *l);

  virtual int HandleButton(XButtonEvent *event);
  virtual int HandleMotion(XMotionEvent *event);

  OXName * GetName(char *s);
  void AddName(char *s);
  void RemoveName(char *s);
  void ChangeName(char *o, char *n);

  void Associate(const OXWindow *w) { _msgWindow = w; } 

protected:
  OXName *_current;
  int _stick; 
  OXPopupMenu * _popup;
  const OXWindow * _msgWindow;
};


#endif  // __OXNAMELIST_H
