1*c2c66affSColin Finck #pragma once 2*c2c66affSColin Finck #include "Cell.h" 3*c2c66affSColin Finck 4*c2c66affSColin Finck #define MAX_GLYPHS 0xFFFF 5*c2c66affSColin Finck 6*c2c66affSColin Finck struct CurrentFont 7*c2c66affSColin Finck { 8*c2c66affSColin Finck CAtlStringW FontName; 9*c2c66affSColin Finck LOGFONTW Font; 10*c2c66affSColin Finck HFONT hFont; 11*c2c66affSColin Finck USHORT ValidGlyphs[MAX_GLYPHS]; 12*c2c66affSColin Finck USHORT NumValidGlyphs; 13*c2c66affSColin Finck }; 14*c2c66affSColin Finck 15*c2c66affSColin Finck 16*c2c66affSColin Finck class CGridView 17*c2c66affSColin Finck { 18*c2c66affSColin Finck private: 19*c2c66affSColin Finck CAtlStringW m_szMapWndClass; 20*c2c66affSColin Finck 21*c2c66affSColin Finck HWND m_hwnd; 22*c2c66affSColin Finck HWND m_hParent; 23*c2c66affSColin Finck 24*c2c66affSColin Finck int m_xNumCells; 25*c2c66affSColin Finck int m_yNumCells; 26*c2c66affSColin Finck 27*c2c66affSColin Finck RECT m_ClientCoordinates; 28*c2c66affSColin Finck SIZE m_CellSize; 29*c2c66affSColin Finck CCell*** m_Cells; // *m_Cells[][]; 30*c2c66affSColin Finck CCell *m_ActiveCell; 31*c2c66affSColin Finck 32*c2c66affSColin Finck INT m_ScrollPosition; 33*c2c66affSColin Finck int m_NumRows; 34*c2c66affSColin Finck 35*c2c66affSColin Finck CurrentFont m_CurrentFont; 36*c2c66affSColin Finck 37*c2c66affSColin Finck public: 38*c2c66affSColin Finck CGridView(); 39*c2c66affSColin Finck ~CGridView(); 40*c2c66affSColin Finck 41*c2c66affSColin Finck bool Create( 42*c2c66affSColin Finck _In_ HWND hParent 43*c2c66affSColin Finck ); 44*c2c66affSColin Finck 45*c2c66affSColin Finck bool SetFont( 46*c2c66affSColin Finck _In_ CAtlString& FontName 47*c2c66affSColin Finck ); 48*c2c66affSColin Finck GetHwnd()49*c2c66affSColin Finck HWND GetHwnd() { return m_hwnd; } 50*c2c66affSColin Finck 51*c2c66affSColin Finck private: 52*c2c66affSColin Finck static LRESULT 53*c2c66affSColin Finck CALLBACK 54*c2c66affSColin Finck MapWndProc(HWND hwnd, 55*c2c66affSColin Finck UINT uMsg, 56*c2c66affSColin Finck WPARAM wParam, 57*c2c66affSColin Finck LPARAM lParam); 58*c2c66affSColin Finck 59*c2c66affSColin Finck LRESULT OnCreate( 60*c2c66affSColin Finck _In_ HWND hwnd, 61*c2c66affSColin Finck _In_ HWND hParent 62*c2c66affSColin Finck ); 63*c2c66affSColin Finck 64*c2c66affSColin Finck 65*c2c66affSColin Finck LRESULT OnSize( 66*c2c66affSColin Finck _In_ INT Width, 67*c2c66affSColin Finck _In_ INT Height 68*c2c66affSColin Finck ); 69*c2c66affSColin Finck 70*c2c66affSColin Finck VOID OnVScroll( 71*c2c66affSColin Finck _In_ INT Value, 72*c2c66affSColin Finck _In_ INT Pos 73*c2c66affSColin Finck ); 74*c2c66affSColin Finck 75*c2c66affSColin Finck LRESULT OnPaint( 76*c2c66affSColin Finck _In_opt_ HDC hdc 77*c2c66affSColin Finck ); 78*c2c66affSColin Finck 79*c2c66affSColin Finck bool UpdateCellCoordinates( 80*c2c66affSColin Finck ); 81*c2c66affSColin Finck 82*c2c66affSColin Finck void DrawGrid( 83*c2c66affSColin Finck _In_ LPPAINTSTRUCT PaintStruct 84*c2c66affSColin Finck ); 85*c2c66affSColin Finck 86*c2c66affSColin Finck void DeleteCells(); 87*c2c66affSColin Finck 88*c2c66affSColin Finck void SetCellFocus( 89*c2c66affSColin Finck _In_ CCell* NewActiveCell 90*c2c66affSColin Finck ); 91*c2c66affSColin Finck }; 92*c2c66affSColin Finck 93