Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Creates a Message box with a question in it and yes/no buttons
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef QUERYBOX_H
  8. #define QUERYBOX_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <KeyValues.h>
  13. #include <vgui_controls/MessageBox.h>
  14. #include <vgui_controls/Button.h>
  15. namespace vgui
  16. {
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Creates A Message box with a question in it and yes/no buttons
  19. //-----------------------------------------------------------------------------
  20. class QueryBox : public MessageBox
  21. {
  22. DECLARE_CLASS_SIMPLE( QueryBox, MessageBox );
  23. public:
  24. QueryBox(const char *title, const char *queryText,vgui::Panel *parent = NULL );
  25. QueryBox(const wchar_t *wszTitle, const wchar_t *wszQueryText,vgui::Panel *parent = NULL);
  26. ~QueryBox();
  27. // Layout the window for drawing
  28. virtual void PerformLayout();
  29. // Set the keyvalues to send when ok button is hit
  30. void SetOKCommand(KeyValues *keyValues);
  31. // Set the keyvalues to send when the cancel button is hit
  32. void SetCancelCommand(KeyValues *keyValues);
  33. // Set the text on the Cancel button
  34. void SetCancelButtonText(const char *buttonText);
  35. void SetCancelButtonText(const wchar_t *wszButtonText);
  36. // Set a value of the ok command
  37. void SetOKCommandValue(const char *keyName, int value);
  38. protected:
  39. virtual void OnKeyCodeTyped( KeyCode code );
  40. virtual void OnKeyCodePressed( KeyCode code );
  41. virtual void OnCommand(const char *command);
  42. Button *m_pCancelButton;
  43. private:
  44. KeyValues *m_pCancelCommand;
  45. KeyValues *m_pOkCommand;
  46. };
  47. }
  48. #endif // QUERYBOX_H