00001 /******************************************************************************** 00002 * * 00003 * Functor Target * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2004-2006 by Niall Douglas. All Rights Reserved. * 00007 * NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL * 00008 ********************************************************************************* 00009 * This code is free software; you can redistribute it and/or modify it under * 00010 * the terms of the GNU Library General Public License v2.1 as published by the * 00011 * Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not * 00012 * "upgrade" this code to the GPL without my prior written permission. * 00013 * Please consult the file "License_Addendum2.txt" accompanying this file. * 00014 * * 00015 * This code is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * 00018 ********************************************************************************* 00019 * $Id: * 00020 ********************************************************************************/ 00021 00022 #if !defined(FXFUNCTORTARGET_H) && !defined(FX_DISABLEGUI) 00023 #define FXFUNCTORTARGET_H 00024 00025 #include "FXObject.h" 00026 00027 namespace FX { 00028 00033 #ifdef _MSC_VER 00034 #pragma warning(push) 00035 #pragma warning(disable: 4251) 00036 #endif 00037 00053 class FXAPI FXFunctorTarget : public FXObject 00054 { // Keep similar to FXDECLARE() 00055 public: 00056 static const FX::FXMetaClass metaClass; 00057 static FX::FXObject* manufacture() { return new FXFunctorTarget; } 00058 virtual long handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr); 00059 virtual const FX::FXMetaClass* getMetaClass() const { return &metaClass; } 00060 00061 // The type of the functor 00062 typedef Generic::Functor<Generic::TL::create<long, FXObject *, FXSelector, void *>::value> MsgHandlerSpec; 00063 private: 00064 MsgHandlerSpec handler; 00065 public: 00066 enum 00067 { 00068 ID_LAST=1 00069 }; 00070 FXFunctorTarget() {} 00072 FXFunctorTarget(MsgHandlerSpec functor) : handler(std::move(functor)) { } 00074 const MsgHandlerSpec &functor() const { return handler; } 00076 void setFunctor(MsgHandlerSpec functor) { handler=functor; } 00077 }; 00078 00079 #ifdef _MSC_VER 00080 #pragma warning(pop) 00081 #endif 00082 00083 } // namespace 00084 00085 #endif