summaryrefslogtreecommitdiff
path: root/gameui/LabeledCommandComboBox.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 /gameui/LabeledCommandComboBox.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'gameui/LabeledCommandComboBox.h')
-rw-r--r--gameui/LabeledCommandComboBox.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/gameui/LabeledCommandComboBox.h b/gameui/LabeledCommandComboBox.h
new file mode 100644
index 0000000..104ce2e
--- /dev/null
+++ b/gameui/LabeledCommandComboBox.h
@@ -0,0 +1,59 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef LABELEDCOMMANDCOMBOBOX_H
+#define LABELEDCOMMANDCOMBOBOX_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui_controls/ComboBox.h>
+#include <vgui_controls/Label.h>
+#include <vgui_controls/Panel.h>
+#include "utlvector.h"
+
+class CLabeledCommandComboBox : public vgui::ComboBox
+{
+ DECLARE_CLASS_SIMPLE( CLabeledCommandComboBox, vgui::ComboBox );
+
+public:
+ CLabeledCommandComboBox(vgui::Panel *parent, const char *panelName);
+ ~CLabeledCommandComboBox();
+
+ virtual void DeleteAllItems();
+ virtual void AddItem(char const *text, char const *engineCommand);
+ virtual void ActivateItem(int itemIndex);
+ const char *GetActiveItemCommand();
+
+ void SetInitialItem(int itemIndex);
+
+ void ApplyChanges();
+ void Reset();
+ bool HasBeenModified();
+
+ enum
+ {
+ MAX_NAME_LEN = 256,
+ MAX_COMMAND_LEN = 256
+ };
+
+private:
+ MESSAGE_FUNC_CHARPTR( OnTextChanged, "TextChanged", text );
+
+ struct COMMANDITEM
+ {
+ char name[ MAX_NAME_LEN ];
+ char command[ MAX_COMMAND_LEN ];
+ int comboBoxID;
+ };
+
+ CUtlVector< COMMANDITEM > m_Items;
+ int m_iCurrentSelection;
+ int m_iStartSelection;
+};
+
+#endif // LABELEDCOMMANDCOMBOBOX_H