summaryrefslogtreecommitdiff
path: root/public/dme_controls/dmepicker.h
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 /public/dme_controls/dmepicker.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'public/dme_controls/dmepicker.h')
-rw-r--r--public/dme_controls/dmepicker.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/public/dme_controls/dmepicker.h b/public/dme_controls/dmepicker.h
new file mode 100644
index 0000000..2b98adf
--- /dev/null
+++ b/public/dme_controls/dmepicker.h
@@ -0,0 +1,101 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMEPICKER_H
+#define DMEPICKER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "vgui_controls/Frame.h"
+#include "datamodel/dmehandle.h"
+#include "tier1/utlstring.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+namespace vgui
+{
+ class Panel;
+ class TextEntry;
+}
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+struct DmePickerInfo_t
+{
+ DmElementHandle_t m_hElement;
+ const char *m_pChoiceString;
+};
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Main app window
+//-----------------------------------------------------------------------------
+class CDmePicker : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CDmePicker, vgui::EditablePanel );
+
+public:
+ CDmePicker( vgui::Panel *pParent );
+ ~CDmePicker();
+
+ // overridden frame functions
+ virtual void Activate( const CUtlVector< DmePickerInfo_t >& vec );
+
+ // Forward arrow keys to the list
+ virtual void OnKeyCodePressed( vgui::KeyCode code );
+
+ // Returns the selceted DmElement
+ CDmElement *GetSelectedDme( );
+
+private:
+ void RefreshDmeList();
+
+ MESSAGE_FUNC( OnTextChanged, "TextChanged" );
+
+ vgui::TextEntry *m_pFilterList;
+ vgui::ListPanel *m_pDmeBrowser;
+ CUtlString m_Filter;
+
+ friend class CDmePickerFrame;
+};
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Main app window
+//-----------------------------------------------------------------------------
+class CDmePickerFrame : public vgui::Frame
+{
+ DECLARE_CLASS_SIMPLE( CDmePickerFrame, vgui::Frame );
+
+public:
+ CDmePickerFrame( vgui::Panel *pParent, const char *pTitle );
+ ~CDmePickerFrame();
+
+ // Inherited from Frame
+ virtual void OnCommand( const char *pCommand );
+
+ // Purpose: Activate the dialog
+ // the message "DmeSelected" will be sent if one was picked
+ // Pass in a message to add as a subkey to the DmeSelected message
+ void DoModal( const CUtlVector< DmePickerInfo_t >& vec, KeyValues *pContextKeyValues = NULL );
+
+private:
+ void CleanUpMessage();
+
+ CDmePicker *m_pPicker;
+ vgui::Button *m_pOpenButton;
+ vgui::Button *m_pCancelButton;
+ KeyValues *m_pContextKeyValues;
+};
+
+
+#endif // DMEPICKER_H