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.

108 lines
1.6 KiB

  1. //
  2. // mxToolKit (c) 1999 by Mete Ciragan
  3. //
  4. // file: mxMatSysWindow.cpp
  5. // implementation: Win32 API
  6. // last modified: Apr 21 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/mxMatSysWindow.h"
  15. #include <windows.h>
  16. class mxMatSysWindow_i
  17. {
  18. public:
  19. HDC hdc;
  20. HGLRC hglrc;
  21. };
  22. mxMatSysWindow::mxMatSysWindow (mxWindow *parent, int x, int y, int w, int h, const char *label, int style)
  23. : mxWindow (parent, x, y, w, h, label, style)
  24. {
  25. d_this = new mxMatSysWindow_i;
  26. bool error = false;
  27. if ((d_this->hdc = GetDC ((HWND) getHandle ())) == NULL)
  28. {
  29. error = true;
  30. goto done;
  31. }
  32. setDrawFunc (0);
  33. done:
  34. if (error)
  35. delete this;
  36. }
  37. mxMatSysWindow::~mxMatSysWindow ()
  38. {
  39. if (d_this->hdc)
  40. ReleaseDC ((HWND) getHandle (), d_this->hdc);
  41. delete d_this;
  42. }
  43. int
  44. mxMatSysWindow::handleEvent (mxEvent *event)
  45. {
  46. return 0;
  47. }
  48. void
  49. mxMatSysWindow::redraw ()
  50. {
  51. // makeCurrent ();
  52. if (d_drawFunc)
  53. d_drawFunc ();
  54. else
  55. draw ();
  56. // swapBuffers ();
  57. }
  58. void
  59. mxMatSysWindow::draw ()
  60. {
  61. }
  62. int
  63. mxMatSysWindow::makeCurrent ()
  64. {
  65. return 1;
  66. }
  67. int
  68. mxMatSysWindow::swapBuffers ()
  69. {
  70. return 0;
  71. }
  72. void
  73. mxMatSysWindow::setDrawFunc (void (*func) (void))
  74. {
  75. d_drawFunc = func;
  76. }