Show editbox.h syntax highlighted
/***************************************************************************
editbox.h - Textbox with borders and input processing
-------------------
begin : Sun Mar 2 2003
copyright : (C) 2003 by Reality Rift Studios
email : mattias@realityrift.com
***************************************************************************
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the NeoEngine, NeoWTK, editbox.h
The Initial Developer of the Original Code is Mattias Jansson.
Portions created by Mattias Jansson are Copyright (C) 2003
Reality Rift Studios. All Rights Reserved.
***************************************************************************/
#ifndef __NEOWTKEDITBOX_H
#define __NEOWTKEDITBOX_H
#include "base.h"
#include "borderarea.h"
#ifdef HAVE_NEOCHUNKIO
# include <neochunkio/complex.h>
# include "chunktype.h"
#endif
/**
* \file editbox.h
* Textbox with borders and input processing
*/
namespace NeoWTK
{
// External classes
class TextArea;
// Forward declarations
class EditBoxChunk;
/**
* \class EditBox
* \brief Textbox with borders and input processing
* \author Mattias Jansson (mattias@realityrift.com)
*/
class NEOWTK_API EditBox : public BorderArea
{
#ifdef HAVE_NEOCHUNKIO
friend class EditBoxChunk;
#endif
protected:
/*! Textarea object */
TextArea *m_pkTextArea;
/*! Cursor object */
Object *m_pkCursor;
/*! Input focus flag */
bool m_bInputFocus;
/*! Cursor blink time */
float m_fCursorBlinkTime;
public:
/**
* \param pkParent Parent object
* \param pkObject Reference object to copy values from
* \param bCreateAreas Create child areas if true
*/
EditBox( Object *pkParent, EditBox *pkObject = 0, bool bCreateAreas = true );
/**
*/
virtual ~EditBox();
/**
* Render object, recurses on children
* \param pkFrustum Currently ignored
* \param bForce Force rendering
* \return true if rendered, false if not
*/
virtual bool Render( NeoEngine::Frustum *pkFrustum = 0, bool bForce = false );
/**
* Update object
* \param fDeltaTime Deltatime passed since last update
*/
virtual void Update( float fDeltaTime );
/**
* Process message
* \param pkMsg Message object
* \return Message specific return code, 0 indicates message was unprocessed
*/
virtual unsigned int ProcessMsg( Msg *pkMsg );
/**
* Duplicate and/or copy this object
* \param pkParent Parent object to attach to
* \param pkObject Object to copy data into, if null will allocate new object
* \return New object that is duplicate of this object
*/
virtual Object *Duplicate( Object *pkParent = 0, Object *pkObject = 0 );
};
#ifdef HAVE_NEOCHUNKIO
/**
* \class EditBoxChunk
* \brief Base chunk for edit box objects
* \author Mattias Jansson (mattias@realityrift.com)
*/
class NEOWTK_API EditBoxChunk : public BorderAreaChunk
{
public:
/**
* Initialize chunk
* \param usType Chunk type
* \param rstrType Chunk type as string
* \param rstrID Chunk ID string
*/
EditBoxChunk( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID = "" ) : BorderAreaChunk( usType, rstrType, rstrID ) {}
/**
* Deallocate data and subchunks
*/
virtual ~EditBoxChunk() {}
/**
* Parse chunk data
* \param uiFlags Parse flags
* \param pkFileManager File manager
* \return <0 if error, >0 if successful (0 reserved)
*/
virtual int ParseData( unsigned int uiFlags, NeoEngine::FileManager *pkFileManager );
/**
* Allocate new chunk
* \param usType Type identifier
* \param rstrType Type identifier as string
* \param rstrID ID string
* \return New chunk
*/
static NeoChunkIO::Chunk *Allocator( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID ) { return new EditBoxChunk( usType, rstrType, rstrID ); }
};
#endif /*! HAVE_NEOCHUNKIO */
}; /*! namespace NeoWTK */
#endif
See more files for this project here