1 /*
2  * PROJECT:     ReactOS Task Manager
3  * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE:     Graph Plotting controls.
5  * COPYRIGHT:   Copyright 2002 Robert Dickenson <robd@reactos.org>
6  *              Copyright 2021 Wu Haotian <rigoligo03@gmail.com>
7  *              Copyright 2021 Valerij Zaporogeci <vlrzprgts@gmail.com>
8  */
9 
10 #pragma once
11 
12 #define NUM_PLOTS    2
13 #define PLOT_SHIFT   2
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 typedef struct _TM_GRAPH_CONTROL
20 {
21     HWND     hParentWnd;
22     HWND     hWnd;
23     HDC      hdcGraph;
24     HBITMAP  hbmGraph;
25     HPEN     hPenGrid;
26     HPEN     hPen0;
27     HPEN     hPen1;
28     HBRUSH   hBrushBack;
29 
30     INT      BitmapWidth;
31     INT      BitmapHeight;
32     INT      GridCellWidth;
33     INT      GridCellHeight;
34     INT      CurrShift;
35 
36     PBYTE    PointBuffer;
37     UINT32   NumberOfPoints;
38     UINT32   CurrIndex;
39 
40     FLOAT    ftPixelsPerPercent;
41     BOOL     DrawSecondaryPlot;
42 }
43 TM_GRAPH_CONTROL, *PTM_GRAPH_CONTROL;
44 
45 typedef struct _TM_FORMAT
46 {
47     COLORREF  clrBack;
48     COLORREF  clrGrid;
49     COLORREF  clrPlot0;
50     COLORREF  clrPlot1;
51     INT       GridCellWidth;
52     INT       GridCellHeight;
53     BOOL      DrawSecondaryPlot;
54 }
55 TM_FORMAT, *PTM_FORMAT;
56 
57 extern WNDPROC OldGraphCtrlWndProc;
58 INT_PTR CALLBACK GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
59 
60 BOOL GraphCtrl_Create(PTM_GRAPH_CONTROL inst, HWND hWnd, HWND hParentWnd, PTM_FORMAT fmt);
61 void GraphCtrl_Dispose(PTM_GRAPH_CONTROL inst);
62 void GraphCtrl_AddPoint(PTM_GRAPH_CONTROL inst, BYTE val0, BYTE val1);
63 void GraphCtrl_RedrawOnHeightChange(PTM_GRAPH_CONTROL inst, INT nh);
64 void GraphCtrl_RedrawBitmap(PTM_GRAPH_CONTROL inst, INT h);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69