diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /vgui2/dme_controls/AttributeMDLPickerPanel.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'vgui2/dme_controls/AttributeMDLPickerPanel.cpp')
| -rw-r--r-- | vgui2/dme_controls/AttributeMDLPickerPanel.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/vgui2/dme_controls/AttributeMDLPickerPanel.cpp b/vgui2/dme_controls/AttributeMDLPickerPanel.cpp new file mode 100644 index 0000000..82860eb --- /dev/null +++ b/vgui2/dme_controls/AttributeMDLPickerPanel.cpp @@ -0,0 +1,62 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//===========================================================================// + +#include "dme_controls/AttributeMDLPickerPanel.h" +#include "filesystem.h" +#include "vgui_controls/Button.h" +#include "vgui_controls/FileOpenDialog.h" +#include "dme_controls/AttributeTextEntry.h" +#include "matsys_controls/MDLPicker.h" +#include "tier1/KeyValues.h" + + +using namespace vgui; + + +//----------------------------------------------------------------------------- +// Constructor +//----------------------------------------------------------------------------- +CAttributeMDLPickerPanel::CAttributeMDLPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) : + BaseClass( parent, info ) +{ +} + +CAttributeMDLPickerPanel::~CAttributeMDLPickerPanel() +{ +} + + +//----------------------------------------------------------------------------- +// Called when it's time to show the MDL picker +//----------------------------------------------------------------------------- +void CAttributeMDLPickerPanel::ShowPickerDialog() +{ + // Open file + CMDLPickerFrame *pMDLPickerDialog = new CMDLPickerFrame( this, "Select .MDL File" ); + pMDLPickerDialog->AddActionSignalTarget( this ); + pMDLPickerDialog->DoModal( ); +} + + +//----------------------------------------------------------------------------- +// Called when it's time to show the MDL picker +//----------------------------------------------------------------------------- +void CAttributeMDLPickerPanel::OnMDLSelected( KeyValues *pKeyValues ) +{ + const char *pMDLName = pKeyValues->GetString( "mdl", NULL ); + if ( !pMDLName || !pMDLName[ 0 ] ) + return; + + // Apply to text panel + m_pData->SetText( pMDLName ); + SetDirty(true); + if ( IsAutoApply() ) + { + Apply(); + } +}
\ No newline at end of file |