source-engine-2018-hl2_src/public/dme_controls/attributeassetpickerpanel.h
FluorescentCIAAfricanAmerican 3bf9df6b27 1
2020-04-22 12:56:21 -04:00

94 lines
3.5 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#ifndef ATTRIBUTEASSETPICKERPANEL_H
#define ATTRIBUTEASSETPICKERPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "dme_controls/AttributeBasePickerPanel.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CBaseAssetPickerFrame;
//-----------------------------------------------------------------------------
// CAttributeAssetPickerPanel
//-----------------------------------------------------------------------------
class CAttributeAssetPickerPanel : public CAttributeBasePickerPanel
{
DECLARE_CLASS_SIMPLE( CAttributeAssetPickerPanel, CAttributeBasePickerPanel );
public:
CAttributeAssetPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
~CAttributeAssetPickerPanel();
private:
virtual CBaseAssetPickerFrame *CreateAssetPickerFrame() = 0;
MESSAGE_FUNC_PARAMS( OnAssetSelected, "AssetSelected", kv );
virtual void ShowPickerDialog();
};
//-----------------------------------------------------------------------------
// Macro to quickly make new attribute types
//-----------------------------------------------------------------------------
#define DECLARE_ATTRIBUTE_ASSET_PICKER( _className ) \
class _className : public CAttributeAssetPickerPanel \
{ \
DECLARE_CLASS_SIMPLE( _className, CAttributeAssetPickerPanel ); \
public: \
_className( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) : \
BaseClass( parent, info ) {} \
private: \
virtual CBaseAssetPickerFrame *CreateAssetPickerFrame(); \
}
#define IMPLEMENT_ATTRIBUTE_ASSET_PICKER( _className, _popupTitle, _assetType, _assetExt, _assetSubDir, _assetTextType ) \
CBaseAssetPickerFrame *_className::CreateAssetPickerFrame() \
{ \
return new CAssetPickerFrame( this, _popupTitle, _assetType, _assetExt, _assetSubDir, _assetTextType ); \
}
//-----------------------------------------------------------------------------
// Macro to quickly make new attribute types
//-----------------------------------------------------------------------------
#define DECLARE_ATTRIBUTE_ASSET_PREVIEW_PICKER( _className ) \
class _className : public CAttributeAssetPickerPanel \
{ \
DECLARE_CLASS_SIMPLE( _className, CAttributeAssetPickerPanel ); \
public: \
_className( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) : \
BaseClass( parent, info ) {} \
private: \
virtual CBaseAssetPickerFrame *CreateAssetPickerFrame(); \
}
#define IMPLEMENT_ATTRIBUTE_ASSET_PREVIEW_PICKER( _className, _pickerClassName, _popupTitle ) \
CBaseAssetPickerFrame *_className::CreateAssetPickerFrame() \
{ \
return new _pickerClassName( this, _popupTitle ); \
}
//-----------------------------------------------------------------------------
// Assets
//-----------------------------------------------------------------------------
DECLARE_ATTRIBUTE_ASSET_PICKER( CAttributeBspPickerPanel );
DECLARE_ATTRIBUTE_ASSET_PREVIEW_PICKER( CAttributeVmtPickerPanel );
DECLARE_ATTRIBUTE_ASSET_PREVIEW_PICKER( CAttributeVtfPickerPanel );
#endif // ATTRIBUTEASSETPICKERPANEL_H