Code Search for Developers
 
 
  

borderarea.h from NeoEngineNG at Krugle


Show borderarea.h syntax highlighted

/***************************************************************************
                    borderarea.h  -  Object with border areas
                             -------------------
    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, borderarea.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 __NEOWTKBORDERAREA_H
#define __NEOWTKBORDERAREA_H


#include "base.h"
#include "object.h"

#include <neoengine/material.h>

#ifdef HAVE_NEOCHUNKIO
#  include <neochunkio/complex.h>
#  include "chunktype.h"
#endif


/**
  * \file borderarea.h
  * Object with border areas
  */


namespace NeoWTK
{


// External classes
class Area;


/*! Forward declarations */
class BorderAreaChunk;


/**
  * \class BorderArea
  * \brief Object with border areas
  * A BorderArea object has 9 areas (4 corners, 4 borders, 1 center area).
  * Corners and borders are Area objects sharing a single material.
  * Center area is set externally by user class
  * \author Mattias Jansson (mattias@realityrift.com)
  */
class NEOWTK_API BorderArea : public Object
{
#ifdef HAVE_NEOCHUNKIO
	friend class BorderAreaChunk;
#endif

	public:

		/**
		* \enum BORDERAREA
		* \brief Defines for the available areas
		*/
		enum BORDERAREA
		{
		  TOP_LEFT_CORNER                             = 0,
		  TOP_RIGHT_CORNER                            = 1,
		  BOTTOM_LEFT_CORNER                          = 2,
		  BOTTOM_RIGHT_CORNER                         = 3,

		  TOP_BORDER                                  = 4,
		  LEFT_BORDER                                 = 5,
		  RIGHT_BORDER                                = 6,
		  BOTTOM_BORDER                               = 7,

		  CENTER                                      = 8,

		  NUMAREAS                                    = 9
		};



	protected:

		/*! Material for corners and borders */
		NeoEngine::MaterialPtr                        m_pkMaterial;


	public:

		/**
		* \param pkParent                             Parent object
		* \param pkCenter                             Center area object
		* \param pkObject                             Reference object to copy data from
		* \param bCreateAreas                         Create child areas if true
		*/
		                                              BorderArea( Object *pkParent, Area *pkCenter = 0, BorderArea *pkObject = 0, bool bCreateAreas = true );

		/**
		*/
		virtual                                      ~BorderArea();

		/**
		* 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 );

		/**
		* Set size and recalculate areas
		* \param rkSize                               Size
		* \return                                     New size
		*/
		virtual const Coord                          &SetSize( const Coord &rkSize );

		/**
		* Set material
		* \param pkMat                                Material to use for corners and borders
		*/
		virtual void                                  SetMaterial( const NeoEngine::MaterialPtr &pkMat );

		/**
		* \param eArea                                Area ID
		* \return                                     Area object
		*/
		virtual Area                                 *GetArea( BORDERAREA eArea );

		/**
		* Recalculate position and sizes of subobjects. Call this method if you manually
		* change size of position of any subobject. Corners and borders positions and sizes are
		* determined from the sizes of the topleft and bottomright corners.
		*/
		virtual void                                  RecalcAreas();

		/**
		* Set center area object. This will delete previous area object
		* \param pkCenter                             New center area
		*/
		virtual void                                  SetCenterArea( Area *pkCenter );

		/**
		* 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 BorderAreaChunk
  * \brief Base chunk for border area objects
  * \author Mattias Jansson (mattias@realityrift.com)
  */
class NEOWTK_API BorderAreaChunk : public ObjectChunk
{
	public:

		/**
		* Initialize chunk
		* \param usType                               Chunk type
		* \param rstrType                             Chunk type as string
		* \param rstrID                               Chunk ID string
		*/
		                                              BorderAreaChunk( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID = "" ) : ObjectChunk( usType, rstrType, rstrID ) {}

		/**
		* Deallocate data and subchunks
		*/
		virtual                                      ~BorderAreaChunk() {}

		/**
		* 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 BorderAreaChunk( usType, rstrType, rstrID ); }
};


#endif /*! HAVE_NEOCHUNKIO */


}; /*! namespace NeoWTK */


#endif




See more files for this project here

NeoEngineNG

NeoenEngine NG (Next Generation) is the evolution of neoengine one,it\'s a different development from NeoEngine2, it\'s a direct inherits from NeoEngine one.\n

Project homepage: http://sourceforge.net/projects/neoengineng
Programming language(s): C,C++
License: other

  Makefile.am
  SConscript
  area.cpp
  area.h
  attribute.cpp
  attribute.h
  base.cpp
  base.h
  borderarea.cpp
  borderarea.h
  button.cpp
  button.h
  chunktype.h
  coord.cpp
  coord.h
  core.cpp
  core.h
  dll.cpp
  editbox.cpp
  editbox.h
  msg.cpp
  msg.h
  msghook.cpp
  msghook.h
  neowtk-static.dev
  neowtk.cbp
  neowtk.dev
  neowtk.dsp
  neowtk.layout
  neowtk.vcproj
  object.cpp
  object.h
  textarea.cpp
  textarea.h
  widgetlib.cpp
  widgetlib.h