summaryrefslogtreecommitdiff
path: root/vgui2/dme_controls/AttributeBasePickerPanel.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /vgui2/dme_controls/AttributeBasePickerPanel.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'vgui2/dme_controls/AttributeBasePickerPanel.cpp')
-rw-r--r--vgui2/dme_controls/AttributeBasePickerPanel.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/vgui2/dme_controls/AttributeBasePickerPanel.cpp b/vgui2/dme_controls/AttributeBasePickerPanel.cpp
new file mode 100644
index 0000000..0f7007a
--- /dev/null
+++ b/vgui2/dme_controls/AttributeBasePickerPanel.cpp
@@ -0,0 +1,59 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#include "dme_controls/AttributeBasePickerPanel.h"
+#include "filesystem.h"
+#include "vgui_controls/Button.h"
+#include "vgui_controls/FileOpenDialog.h"
+#include "dme_controls/AttributeTextEntry.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+
+using namespace vgui;
+
+
+//-----------------------------------------------------------------------------
+// Constructor
+//-----------------------------------------------------------------------------
+CAttributeBasePickerPanel::CAttributeBasePickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) :
+ BaseClass( parent, info )
+{
+ m_pOpen = new vgui::Button( this, "Open", "...", this, "open" );
+}
+
+void CAttributeBasePickerPanel::OnCommand( char const *cmd )
+{
+ if ( !Q_stricmp( cmd, "open" ) )
+ {
+ ShowPickerDialog();
+ }
+ else
+ {
+ BaseClass::OnCommand( cmd );
+ }
+}
+
+void CAttributeBasePickerPanel::PerformLayout()
+{
+ BaseClass::PerformLayout();
+
+ int x, y, w, h;
+ m_pType->GetBounds( x, y, w, h );
+
+ int inset = 25;
+ m_pType->SetWide( w - inset );
+
+ x += w;
+ x -= inset;
+
+ h -= 2;
+
+ m_pOpen->SetBounds( x, y, inset, h );
+}