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.

77 lines
1.8 KiB

  1. #pragma once
  2. #include "afxwin.h"
  3. #include "color.h"
  4. namespace vgui
  5. {
  6. class EditablePanel;
  7. typedef unsigned long HCursor;
  8. }
  9. class CVGuiWnd
  10. {
  11. public:
  12. CVGuiWnd(void);
  13. ~CVGuiWnd(void);
  14. public:
  15. void SetMainPanel( vgui::EditablePanel * pPanel );
  16. vgui::EditablePanel *GetMainPanel(); // returns VGUI main panel
  17. vgui::EditablePanel *CreateDefaultPanel();
  18. void SetParentWindow(CWnd *pParent);
  19. CWnd *GetParentWnd(); // return CWnd handle
  20. void SetCursor(vgui::HCursor cursor);
  21. void SetCursor(const char *filename);
  22. void SetRepaintInterval( int msecs );
  23. int GetVGuiContext();
  24. // The Hammer 2D views basically ignore vgui input. They're only there to render on top of.
  25. // When we pass true here, CMatSystemSurface::RunFrame ignores all the input events.
  26. // If we pass false (as the model browser does), then it does process input events and send them to the vgui panels.
  27. // Eventually, we could change the 2D views' input events to come from the input system instead of from MFC.
  28. virtual bool IsModal()
  29. {
  30. return false;
  31. }
  32. protected:
  33. void DrawVGuiPanel(); // overridden to draw this view
  34. long WindowProcVGui( UINT message, WPARAM wParam, LPARAM lParam ); //
  35. vgui::EditablePanel *m_pMainPanel;
  36. CWnd *m_pParentWnd;
  37. int m_hVGuiContext;
  38. bool m_bIsDrawing;
  39. Color m_ClearColor;
  40. bool m_bClearZBuffer;
  41. };
  42. class CVGuiPanelWnd: public CWnd, public CVGuiWnd
  43. {
  44. protected:
  45. DECLARE_DYNCREATE(CVGuiPanelWnd)
  46. public:
  47. // Generated message map functions
  48. //{{AFX_MSG(CVGuiViewModel)
  49. BOOL OnEraseBkgnd(CDC* pDC);
  50. //}}AFX_MSG
  51. virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );
  52. // See CVGuiWnd's function for a description but this basically tells Hammer to actually pass vgui messages to our panel.
  53. virtual bool IsModal()
  54. {
  55. return true;
  56. }
  57. DECLARE_MESSAGE_MAP()
  58. };