Counter Strike : Global Offensive Source Code
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.

63 lines
1.4 KiB

  1. //
  2. // mxToolKit (c) 1999 by Mete Ciragan
  3. //
  4. // file: mxMessageBox.cpp
  5. // implementation: Win32 API
  6. // last modified: Mar 14 1999, Mete Ciragan
  7. // copyright: The programs and associated files contained in this
  8. // distribution were developed by Mete Ciragan. The programs
  9. // are not in the public domain, but they are freely
  10. // distributable without licensing fees. These programs are
  11. // provided without guarantee or warrantee expressed or
  12. // implied.
  13. //
  14. #include "mxtk/mxMessageBox.h"
  15. #include "mxtk/mxWindow.h"
  16. #include <windows.h>
  17. #include <commdlg.h>
  18. #include <string.h>
  19. int
  20. mxMessageBox (mxWindow *parent, const char *msg, const char *title, int style)
  21. {
  22. HWND hwndParent = 0;
  23. if (parent)
  24. hwndParent = (HWND) parent->getHandle ();
  25. UINT uType = 0;
  26. if (style & MX_MB_OK)
  27. uType |= MB_OK;
  28. else if (style & MX_MB_YESNO)
  29. uType |= MB_YESNO;
  30. else if (style & MX_MB_YESNOCANCEL)
  31. uType |= MB_YESNOCANCEL;
  32. if (style & MX_MB_INFORMATION)
  33. uType |= MB_ICONINFORMATION;
  34. else if (style & MX_MB_ERROR)
  35. uType |= MB_ICONHAND;
  36. else if (style & MX_MB_WARNING)
  37. uType |= MB_ICONEXCLAMATION;
  38. else if (style & MX_MB_QUESTION)
  39. uType |= MB_ICONQUESTION;
  40. int ret = MessageBox (hwndParent, msg, title, uType);
  41. switch (ret)
  42. {
  43. case IDOK:
  44. case IDYES:
  45. return 0;
  46. case IDNO:
  47. return 1;
  48. case IDCANCEL:
  49. return 2;
  50. }
  51. return 0;
  52. }