aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/vgui_controls/InputDialog.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /mp/src/public/vgui_controls/InputDialog.h
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/public/vgui_controls/InputDialog.h')
-rw-r--r--mp/src/public/vgui_controls/InputDialog.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/mp/src/public/vgui_controls/InputDialog.h b/mp/src/public/vgui_controls/InputDialog.h
new file mode 100644
index 00000000..7ef8d08f
--- /dev/null
+++ b/mp/src/public/vgui_controls/InputDialog.h
@@ -0,0 +1,106 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#ifndef INPUTDIALOG_H
+#define INPUTDIALOG_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include <vgui_controls/Controls.h>
+#include <vgui_controls/Frame.h>
+
+namespace vgui
+{
+
+class Label;
+class Button;
+class TextEntry;
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Utility dialog base class - just has context kv and ok/cancel buttons
+//-----------------------------------------------------------------------------
+class BaseInputDialog : public Frame
+{
+ DECLARE_CLASS_SIMPLE( BaseInputDialog, Frame );
+
+public:
+ BaseInputDialog( vgui::Panel *parent, const char *title );
+ ~BaseInputDialog();
+
+ void DoModal( KeyValues *pContextKeyValues = NULL );
+
+protected:
+ virtual void PerformLayout();
+ virtual void PerformLayout( int x, int y, int w, int h ) {}
+
+ // command buttons
+ virtual void OnCommand( const char *command );
+
+ void CleanUpContextKeyValues();
+ KeyValues *m_pContextKeyValues;
+
+private:
+ vgui::Button *m_pCancelButton;
+ vgui::Button *m_pOKButton;
+};
+
+//-----------------------------------------------------------------------------
+// Purpose: Utility dialog, used to ask yes/no questions of the user
+//-----------------------------------------------------------------------------
+class InputMessageBox : public BaseInputDialog
+{
+ DECLARE_CLASS_SIMPLE( InputMessageBox, BaseInputDialog );
+
+public:
+ InputMessageBox( vgui::Panel *parent, const char *title, char const *prompt );
+ ~InputMessageBox();
+
+protected:
+ virtual void PerformLayout( int x, int y, int w, int h );
+
+private:
+ vgui::Label *m_pPrompt;
+};
+
+//-----------------------------------------------------------------------------
+// Purpose: Utility dialog, used to let user type in some text
+//-----------------------------------------------------------------------------
+class InputDialog : public BaseInputDialog
+{
+ DECLARE_CLASS_SIMPLE( InputDialog, BaseInputDialog );
+
+public:
+ InputDialog( vgui::Panel *parent, const char *title, char const *prompt, char const *defaultValue = "" );
+ ~InputDialog();
+
+ void SetMultiline( bool state );
+
+ /* action signals
+
+ "InputCompleted"
+ "text" - the text entered
+
+ "InputCanceled"
+ */
+ void AllowNumericInputOnly( bool bOnlyNumeric );
+
+protected:
+ virtual void PerformLayout( int x, int y, int w, int h );
+
+ // command buttons
+ virtual void OnCommand(const char *command);
+
+private:
+ vgui::Label *m_pPrompt;
+ vgui::TextEntry *m_pInput;
+};
+
+} // namespace vgui
+
+
+#endif // INPUTDIALOG_H