2010-05-06 00:08:41 +00:00
|
|
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef NL_INTERFACE_POINTER_H
|
|
|
|
#define NL_INTERFACE_POINTER_H
|
|
|
|
|
|
|
|
#include "nel/misc/resource_ptr.h"
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
namespace NLGUI
|
|
|
|
{
|
|
|
|
class CInterfaceElement;
|
|
|
|
class CCtrlBase;
|
2012-06-15 21:30:27 +00:00
|
|
|
class CCtrlBaseButton;
|
2012-06-09 01:57:40 +00:00
|
|
|
class CInterfaceGroup;
|
2012-06-17 00:49:00 +00:00
|
|
|
class CViewText;
|
2012-06-21 20:20:02 +00:00
|
|
|
class CCtrlTextButton;
|
2012-06-09 01:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
using namespace NLGUI;
|
|
|
|
|
|
|
|
CInterfaceElement *getInterfaceResource(const std::string &key);
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
/** Interface element ptr
|
|
|
|
* This pointer uses the NLMISC::CResourcePtr
|
|
|
|
*/
|
|
|
|
template<class TPtr>
|
|
|
|
class CInterfacePtr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void *getResource (const std::string &key)
|
|
|
|
{
|
|
|
|
if (key.empty())
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return dynamic_cast<TPtr*>(getInterfaceResource(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In FINAL_VERSION, use an interface pointer without memory or cpu overhead because we don't need the runtime reloading feature. */
|
|
|
|
#if FINAL_VERSION
|
|
|
|
typedef NLMISC::CStaticResourcePtr<TPtr, std::string, CInterfacePtr<TPtr> > TInterfacePtr;
|
|
|
|
#else // FINAL_VERSION
|
|
|
|
typedef NLMISC::CResourcePtr<TPtr, std::string, CInterfacePtr<TPtr> > TInterfacePtr;
|
|
|
|
#endif // FINAL_VERSION
|
|
|
|
};
|
|
|
|
|
|
|
|
// Some pointers
|
2012-06-09 01:57:40 +00:00
|
|
|
typedef CInterfacePtr<CInterfaceElement>::TInterfacePtr CInterfaceElementPtr;
|
|
|
|
typedef CInterfacePtr<CInterfaceGroup>::TInterfacePtr CInterfaceGroupPtr;
|
2012-06-21 20:20:02 +00:00
|
|
|
typedef CInterfacePtr<CCtrlTextButton>::TInterfacePtr CCtrlTextButtonPtr;
|
2012-06-17 00:49:00 +00:00
|
|
|
typedef CInterfacePtr<CViewText>::TInterfacePtr CViewTextPtr;
|
2010-05-06 00:08:41 +00:00
|
|
|
typedef CInterfacePtr<class CViewTextMenu>::TInterfacePtr CViewTextMenuPtr;
|
2012-06-09 01:57:40 +00:00
|
|
|
typedef CInterfacePtr<CCtrlBase>::TInterfacePtr CCtrlBasePtr;
|
2012-06-15 21:30:27 +00:00
|
|
|
typedef CInterfacePtr<CCtrlBaseButton>::TInterfacePtr CCtrlBaseButtonPtr;
|
2010-05-06 00:08:41 +00:00
|
|
|
typedef CInterfacePtr<class CGroupContainer>::TInterfacePtr CGroupContainerPtr;
|
|
|
|
|
|
|
|
#endif // NL_INTERFACE_POINTER_H
|
|
|
|
|
|
|
|
/* End of interface_pointer.h */
|