Code Search for Developers
 
 
  

msghook.h from NeoEngineNG at Krugle


Show msghook.h syntax highlighted

/***************************************************************************
               msghook.h  -  Action executed on specific message
                             -------------------
    begin                : Tue Dec 17 2002
    copyright            : (C) 2002 by Mattias Jansson
    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, msghook.h

 The Initial Developer of the Original Code is Mattias Jansson.
 Portions created by Mattias Jansson are Copyright (C) 2002
 Reality Rift Studios. All Rights Reserved.

 ***************************************************************************/

#ifndef __NEOWTKMSGHOOK_H
#define __NEOWTKMSGHOOK_H


#include "base.h"
#include "msg.h"

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


/**
  * \file msghook.h
  * Object used to hook into a wtk object message processing pipeline
  */


namespace NeoWTK
{


// Forward declarations
class MsgHook;


/**
  * \brief Interface for message hook procedures
  * \author Mattias Jansson (mattias@realityrift.com)
  */
class NEOWTK_API MsgHookMethod
{
	public:

		/**
		* Execute action
		* \param pkHook                               Hook object we are invoked by
		* \param pkMsg                                Message that triggered hook
		*/
		virtual void                                  ProcessHook( MsgHook *pkHook, Msg *pkMsg ) = 0;
};


/**
  * \brief Object used to hook into a wtk object message processing pipeline
  * \author Mattias Jansson (mattias@realityrift.com)
  */
class NEOWTK_API MsgHook
{
	public:

		/*! Message ID or MSGID_INVALID if any */
		Msg::MSGID                                    m_eID;

		/*! Required sender object or null if any */
		Object                                       *m_pkSender;

		/*! Required receiver object or null if any */
		Object                                       *m_pkReceiver;

		/*! Method */
		MsgHookMethod                                *m_pkProcessor;

		/*! Flag indicating if we should delete processor object in dtor (default false) */
		bool                                          m_bDeleteProcessor;


		/**
		*/
		                                              MsgHook();

		/**
		* \param eID                                  Message ID to listen to, Msg::INVALID if any
		* \param pkSender                             Required sender object, null if any
		* \param pkReceiver                           Required receiver object, null if any
		* \param pkProcessor                          Hook method object
		* \param bDeleteProcessor                     Flag indicating if processor method object in dtor, default false
		*/
		                                              MsgHook( Msg::MSGID eID, Object *pkSender, Object *pkReceiver, MsgHookMethod *pkProcessor, bool bDeleteProcessor = false );

		/**
		*/
		virtual                                      ~MsgHook();

		/**
		* \param pkMsg                                Message object
		* \return                                     true if message match hook parameters, false if not
		*/
		virtual bool                                  IsHook( Msg *pkMsg );
};


#ifdef HAVE_NEOCHUNKIO


/**
  * \brief Chunk for message hooks
  * \author Mattias Jansson (mattias@realityrift.com)
  */
class NEOWTK_API MsgHookChunk : public NeoChunkIO::ComplexChunk
{
	public:


		/*! Message hook object */
		MsgHook                                      *m_pkHook;


		/**
		* Initialize chunk
		* \param usType                               Chunk type
		* \param rstrType                             Chunk type as string
		* \param rstrID                               Chunk ID string
		*/ 
		                                              MsgHookChunk( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID = "" ) : NeoChunkIO::ComplexChunk( usType, rstrType, rstrID ), m_pkHook( 0 ) { m_usFindType = NeoWTK::ChunkType::MSGHOOK; }
		
		/**
		* Deallocate data and subchunks
		*/
		virtual                                      ~MsgHookChunk();

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


#endif


};


#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