| | |
| | | #include <afxwin.h> |
| | | #endif |
| | | |
| | | |
| | | // 放到 CCarrierSlotGrid 类定义前或内部 public: 区都可 |
| | | enum { CSGN_SEL_CHANGED = 1, CSGN_MAT_CHANGED = 2 }; |
| | | |
| | | struct CSG_SEL_CHANGE { |
| | | NMHDR hdr; // hdr.code = CSGN_SEL_CHANGED |
| | | int port; // 0..GetPortCount()-1 |
| | | int slot; // 0..GetSlotCount()-1 |
| | | BOOL checked; |
| | | }; |
| | | |
| | | struct CSG_MAT_CHANGE { |
| | | NMHDR hdr; // hdr.code = CSGN_MAT_CHANGED |
| | | int port; |
| | | int slot; |
| | | int material; // 1=G1, 2=G2 |
| | | }; |
| | | |
| | | |
| | | class CCarrierSlotGrid : public CWnd |
| | | { |
| | | public: |
| | |
| | | BOOL IsPortAllocated(int portIndex) const; |
| | | |
| | | void SetSlotGlass(int portIndex, int slotIndex, BOOL hasGlass, LPCTSTR coreId, int material); |
| | | void SetSlotChecked(int portIndex, int slotIndex, BOOL checked); |
| | | void SetSlotChecked(int portIndex, int slotIndex, BOOL checked, BOOL bNotify = FALSE); |
| | | BOOL GetSlotChecked(int portIndex, int slotIndex) const; |
| | | |
| | | int GetSlotMaterialType(int portIndex, int slotIndex) const; |
| | |
| | | // - CalcBestClientSize:内容区域(不含滚动条/非客户区)刚好容纳表头+所有行、全部列 |
| | | // - CalcBestWindowSize:在当前窗口样式下,将“内容大小”转换为窗口外框大小(会考虑 WS_BORDER/CLIENTEDGE 等) |
| | | // 默认按“隐藏滚动条”的目标来算(即不把 WS_HSCROLL/WS_VSCROLL 计入调整) |
| | | // 计算最佳大小(支持可选安全边距,默认按 DPI 约等于 2px) |
| | | CSize CalcBestClientSize(int nSlotsOverride = -1) const; |
| | | CSize CalcBestWindowSize(BOOL includeNonClient = TRUE, int nSlotsOverride = -1) const; |
| | | CSize CalcBestWindowSize(BOOL includeNonClient = TRUE, |
| | | int nSlotsOverride = -1, |
| | | int extraPadX = -1, // -1 表示按 DPI 自动 |
| | | int extraPadY = -1) const; |
| | | |
| | | // 永久禁用系统滚动条(去掉样式并刷新非客户区) |
| | | void DisableSystemScrollbars(); |
| | | |
| | | // 把窗口尺寸调到正好容纳所有内容(不出现滚动条) |
| | | void ResizeWindowToFitAll(BOOL includeNonClient = TRUE, int nSlotsOverride = -1); |
| | | |
| | | // 进入/退出无滚动条模式(去样式、清滚动、忽略滚动消息) |
| | | void SetNoScrollbarsMode(BOOL enable); |
| | | |
| | | // 在“无滚动条模式”下,把窗口尺寸调到刚好容纳所有内容(不出现滚动条) |
| | | void FitWindowToContentNoScroll(BOOL includeNonClient = TRUE, int nSlotsOverride = -1); |
| | | |
| | | protected: |
| | | // 数据 |
| | |
| | | std::vector<int> m_portColCXsStart; |
| | | int m_hitEdgeHover = -1; |
| | | bool m_bAllowResize = true; // ← 新增:是否允许拖动列宽 |
| | | bool m_noScrollbars = false; // ← 新增:无滚动条模式 |
| | | |
| | | // 工具 |
| | | void EnsureFonts(); |