Scope
ChannelView.h
1 #pragma once
2 
3 #include "direct2d/D2ChannelRender.h"
4 
5 namespace scope {
6  namespace gui {
7 
10  : public CWindowImpl<CChannelView> {
11 
12 protected:
15 
16 public:
17  BEGIN_MSG_MAP(CChannelView)
18  MSG_WM_CREATE(OnCreate)
19  MSG_WM_PAINT(OnPaint)
20  MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
21  MSG_WM_DISPLAYCHANGE(OnDisplayChange)
22  MSG_WM_ERASEBKGND(OnEraseBkgnd)
23  MSG_WM_SIZE(OnSize)
24  END_MSG_MAP()
25 
27  DECLARE_WND_CLASS_EX(nullptr, CS_HREDRAW | CS_VREDRAW, -1);
28 
32  BOOL PreTranslateMessage(MSG* pMsg);
33 
35  int OnCreate(LPCREATESTRUCT lpCreateStruct);
36 
38  LRESULT OnEraseBkgnd(HDC wParam) { return true; }
39 
41  void OnPaint(CDCHandle /*dc*/);
42 
44  void OnSize(UINT /*type*/, CSize size);
45 
48  LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
49 
51  void OnDisplayChange(UINT /*bpp*/, CSize /*resolution*/);
58  D2D1_SIZE_F GetRendererSize() const;
59 
61  void Render();
62 
65  void ResizeContent(const uint32_t& _xres, const uint32_t& _yres);
66 
68  ID2D1Bitmap* GetBitmap();
69 
71  virtual void UpdateScaleText(const std::wstring& _text);
73 };
74 
75 }}
ID2D1Bitmap * GetBitmap()
Definition: ChannelView.cpp:54
void ResizeContent(const uint32_t &_xres, const uint32_t &_yres)
Resizes the bitmap of the renderer.
Definition: ChannelView.cpp:50
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Handles WM_MOUSEMOVE messages, just passes them on to ChannelFrame (the parent) via user-defined mess...
Definition: ChannelView.cpp:36
void OnPaint(CDCHandle)
Calls renderer and validates rect.
Definition: ChannelView.cpp:19
CChannelView is just a dumb holder for the renderer and takes care of window resizes etc...
Definition: ChannelView.h:9
Handles all Direct2D rendering in a CChannelView.
void OnDisplayChange(UINT, CSize)
Calls renderer.
Definition: ChannelView.cpp:32
virtual void UpdateScaleText(const std::wstring &_text)
Update the scale text.
Definition: ChannelView.cpp:58
int OnCreate(LPCREATESTRUCT lpCreateStruct)
Creates the renderer.
Definition: ChannelView.cpp:9
void Render()
Calls renderer.Render.
Definition: ChannelView.cpp:46
LRESULT OnEraseBkgnd(HDC wParam)
avoids flickering during resize
Definition: ChannelView.h:38
BOOL PreTranslateMessage(MSG *pMsg)
Does nothing (-> disable default handling)
Definition: ChannelView.cpp:14
D2D1_SIZE_F GetRendererSize() const
Definition: ChannelView.cpp:42
d2d::D2ChannelRender renderer
the Direct2D renderer class
Definition: ChannelView.h:14
void OnSize(UINT, CSize size)
Calls renderer's resize.
Definition: ChannelView.cpp:27
DECLARE_WND_CLASS_EX(nullptr, CS_HREDRAW|CS_VREDRAW,-1)
Set background brush to -1, avoids erasure of background (similar effect as OnEraseBkgnd below...