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 /public/vgui_controls/QueryBox.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/vgui_controls/QueryBox.h')
| -rw-r--r-- | public/vgui_controls/QueryBox.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/public/vgui_controls/QueryBox.h b/public/vgui_controls/QueryBox.h new file mode 100644 index 0000000..40e6e46 --- /dev/null +++ b/public/vgui_controls/QueryBox.h @@ -0,0 +1,62 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Creates a Message box with a question in it and yes/no buttons +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef QUERYBOX_H +#define QUERYBOX_H + +#ifdef _WIN32 +#pragma once +#endif + +#include <KeyValues.h> +#include <vgui_controls/MessageBox.h> +#include <vgui_controls/Button.h> + +namespace vgui +{ + +//----------------------------------------------------------------------------- +// Purpose: Creates A Message box with a question in it and yes/no buttons +//----------------------------------------------------------------------------- +class QueryBox : public MessageBox +{ + DECLARE_CLASS_SIMPLE( QueryBox, MessageBox ); + +public: + QueryBox(const char *title, const char *queryText,vgui::Panel *parent = NULL ); + QueryBox(const wchar_t *wszTitle, const wchar_t *wszQueryText,vgui::Panel *parent = NULL); + ~QueryBox(); + + // Layout the window for drawing + virtual void PerformLayout(); + + // Set the keyvalues to send when ok button is hit + void SetOKCommand(KeyValues *keyValues); + + // Set the keyvalues to send when the cancel button is hit + void SetCancelCommand(KeyValues *keyValues); + + // Set the text on the Cancel button + void SetCancelButtonText(const char *buttonText); + void SetCancelButtonText(const wchar_t *wszButtonText); + + // Set a value of the ok command + void SetOKCommandValue(const char *keyName, int value); + +protected: + virtual void OnKeyCodeTyped( KeyCode code ); + virtual void OnKeyCodePressed( KeyCode code ); + virtual void OnCommand(const char *command); + Button *m_pCancelButton; + +private: + KeyValues *m_pCancelCommand; + KeyValues *m_pOkCommand; +}; + +} +#endif // QUERYBOX_H |