/*===========================================================================
 *
 * TEXTBOX.CPP - 2 April 1999, Dave Humphrey (uesp@m0use.net)
 *
 * Implementation for the CTextBox class, a custom edit box class with
 * added features such as internal number conversion, etc...
 *
 *=========================================================================*/

	/* Include Files */
#include "stdafx.h"
#include "TextBox.h"

	/* Debug Stuff */
#ifdef _DEBUG
  #define new DEBUG_NEW
  #undef THIS_FILE
  static char THIS_FILE[] = __FILE__;
#endif



/*===========================================================================
 *
 * Class CTextBox Constructor
 *
 *=========================================================================*/
CTextBox::CTextBox() {
 }
/*===========================================================================
 *		End of Class CTextBox Constructor
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Destructor
 *
 *=========================================================================*/
CTextBox::~CTextBox() {
 }
/*===========================================================================
 *		End of Class CTextBox Destructor
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - boolean GetBoolean (void);
 *
 * Returns the textbox string as a boolean value.
 *
 *=========================================================================*/
boolean CTextBox::GetBoolean (void) {
  CString InputText;

  GetWindowText(InputText);
  return (StringToBoolean(InputText));
 }
/*===========================================================================
 *		End of Class Method CTextBox::GetBoolean()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - float GetFloat (void);
 *
 * Returns the textbox string as a floating point value.
 *
 *=========================================================================*/
float CTextBox::GetFloat (void) {
  CString InputText;

  GetWindowText(InputText);
  return ((float)atof(InputText));
 }
/*===========================================================================
 *		End of Class Method CTextBox::GetFloat()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - int GetInt (void);
 *
 * Returns the textbox string as an integer value.
 *
 *=========================================================================*/
int CTextBox::GetInt (void) {
  CString InputText;

  GetWindowText(InputText);
  return (atoi(InputText));
 }
/*===========================================================================
 *		End of Class Method CTextBox::GetInt()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - long GetLong (void);
 *
 * Returns the textbox string as an integer value.
 *
 *=========================================================================*/
long CTextBox::GetLong (void) {
  CString InputText;

  GetWindowText(InputText);
  return (atol(InputText));
 }
/*===========================================================================
 *		End of Class Method CTextBox::GetLong()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - void SetTextBoolean (Value);
 *
 * Sets the editbox text to the given boolean value.
 *
 *=========================================================================*/
void CTextBox::SetTextBoolean (const boolean Value) {
  SetWindowText(BooleanToString(Value));
 }
/*===========================================================================
 *		End of Class Method CTextBox::SetTextBoolean()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - void SetTextFloat (Value);
 *
 * Sets the editbox text to the given floating point value.
 *
 *=========================================================================*/
void CTextBox::SetTextFloat (const float Value) {
  char OutputString[101];

  sprintf(OutputString, "%g", Value);
  SetWindowText(OutputString);
 }
/*===========================================================================
 *		End of Class Method CTextBox::SetTextFloat()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - void SetTextInt (Value);
 *
 * Sets the editbox text to the given integer value.
 *
 *=========================================================================*/
void CTextBox::SetTextInt (const int Value) {
  char OutputString[101];

  sprintf(OutputString, "%d", Value);
  SetWindowText(OutputString);
 }
/*===========================================================================
 *		End of Class Method CTextBox::SetTextInt()
 *=========================================================================*/


/*===========================================================================
 *
 * Class CTextBox Method - void SetTextLong (Value);
 *
 * Sets the editbox text to the given integer value.
 *
 *=========================================================================*/
void CTextBox::SetTextLong (const long Value) {
  char OutputString[101];

  sprintf(OutputString, "%ld", Value);
  SetWindowText(OutputString);
 }
/*===========================================================================
 *		End of Class Method CTextBox::SetTextLong()
 *=========================================================================*/


/*===========================================================================
 *
 * Begin Class CTextBox Message Map
 *
 *=========================================================================*/
BEGIN_MESSAGE_MAP(CTextBox, CEdit)
  //{{AFX_MSG_MAP(CTextBox)
  //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*===========================================================================
 *		End of Class CTextBox Message Map
 *=========================================================================*/