This repository has been archived on 2024-06-13. You can view files and clone it, but cannot push or open issues or pull requests.
2020-08-04 13:13:01 -04:00

63 lines
1.8 KiB
C++

//========= 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/Button.h>
#include <vgui_controls/MessageBox.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;
};
} // namespace vgui
#endif // QUERYBOX_H