// Filename: chatInput.h
// Created by:  mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license.  You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////

#ifndef CHATINPUT_H
#define CHATINPUT_H

#include "pandabase.h"

#include "dataNode.h"
#include "pointerTo.h"
#include "textNode.h"
#include "allTransitionsWrapper.h"

////////////////////////////////////////////////////////////////////
//       Class : ChatInput
// Description : Reads keyboard input in as that of a chat.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA ChatInput : public DataNode {
PUBLISHED:
  ChatInput(TextNode* text_node, const string& name = "");
  void reset(void);

  INLINE void set_max_chars(int max_chars);
  INLINE void clear_max_chars();
  INLINE bool has_max_chars() const;
  INLINE int get_max_chars() const;

  INLINE void set_max_lines(int max_lines);
  INLINE void clear_max_lines();
  INLINE bool has_max_lines() const;
  INLINE int get_max_lines() const;

  INLINE void set_max_width(float max_width);
  INLINE void clear_max_width();
  INLINE bool has_max_width() const;
  INLINE float get_max_width() const;

  INLINE const string &get_string() const;

  void append(const string &str);
  bool append_character(char ch);

////////////////////////////////////////////////////////////////////
// From parent class DataNode
////////////////////////////////////////////////////////////////////
public:
  virtual void
  transmit_data(AllTransitionsWrapper &data);
  AllTransitionsWrapper _attrib;
  // inputs
  static TypeHandle _button_events_type;

protected:
  PT(TextNode) _text_node;
  string _str;
  int _max_chars;
  int _max_lines;
  float _max_width;

  enum Flags {
    F_max_chars   = 0x001,
    F_max_lines   = 0x002,
    F_max_width   = 0x004,
  };
  int _flags;

public:
  virtual TypeHandle get_type() const {
    return get_class_type();
  }
  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  static TypeHandle get_class_type() {
    return _type_handle;
  }
  static void init_type();

private:
  static TypeHandle _type_handle;
};

#include "chatInput.I"

#endif
