2026-01-18 22:39:36 +01:00
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "afxdialogex.h"
|
|
|
|
|
|
#include "HostInfo.h"
|
|
|
|
|
|
#include "Resource.h"
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
#include <algorithm>
|
2026-01-25 12:14:15 +01:00
|
|
|
|
#include <map>
|
2026-01-18 22:39:36 +01:00
|
|
|
|
#include "2015RemoteDlg.h"
|
|
|
|
|
|
|
2026-01-25 12:14:15 +01:00
|
|
|
|
// 分组键:支持任意字段组合
|
|
|
|
|
|
struct GroupKey {
|
|
|
|
|
|
std::vector<CString> Values;
|
|
|
|
|
|
|
|
|
|
|
|
bool operator<(const GroupKey& other) const {
|
|
|
|
|
|
size_t count = (std::min)(Values.size(), other.Values.size());
|
|
|
|
|
|
for (size_t i = 0; i < count; i++) {
|
|
|
|
|
|
int cmp = Values[i].Compare(other.Values[i]);
|
|
|
|
|
|
if (cmp != 0) return cmp < 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
return Values.size() < other.Values.size();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 分组信息
|
|
|
|
|
|
struct GroupInfo {
|
|
|
|
|
|
int GroupId;
|
|
|
|
|
|
BOOL bExpanded;
|
|
|
|
|
|
std::vector<std::pair<ClientKey, ClientValue>> Clients;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-18 22:39:36 +01:00
|
|
|
|
// CClientListDlg 对话框
|
|
|
|
|
|
|
|
|
|
|
|
class CClientListDlg : public CDialogEx
|
|
|
|
|
|
{
|
|
|
|
|
|
DECLARE_DYNAMIC(CClientListDlg)
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
CClientListDlg(_ClientList* clients, CMy2015RemoteDlg* pParent = nullptr);
|
|
|
|
|
|
virtual ~CClientListDlg();
|
|
|
|
|
|
|
|
|
|
|
|
// 对话框数据
|
|
|
|
|
|
#ifdef AFX_DESIGN_TIME
|
|
|
|
|
|
enum { IDD = IDD_DIALOG_CLIENTLIST };
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
_ClientList* g_ClientList;
|
|
|
|
|
|
CMy2015RemoteDlg* g_pParent;
|
|
|
|
|
|
std::vector<std::pair<ClientKey, ClientValue>> m_clients; // 数据副本
|
2026-01-25 12:14:15 +01:00
|
|
|
|
std::map<GroupKey, GroupInfo> m_groups; // 分组数据
|
2026-01-18 22:39:36 +01:00
|
|
|
|
int m_nSortColumn; // 当前排序列
|
|
|
|
|
|
BOOL m_bSortAscending; // 是否升序
|
2026-01-25 12:14:15 +01:00
|
|
|
|
CToolTipCtrl m_ToolTip;
|
|
|
|
|
|
int m_nTipItem; // 当前提示的行
|
|
|
|
|
|
int m_nTipSubItem; // 当前提示的列
|
|
|
|
|
|
std::vector<BOOL> m_ColumnVisible; // 各列的显示状态
|
|
|
|
|
|
|
|
|
|
|
|
void BuildGroups(); // 构建分组数据
|
|
|
|
|
|
void ShowColumnContextMenu(CPoint pt); // 显示列选择菜单
|
|
|
|
|
|
void ToggleColumnVisibility(int nColumn); // 切换列的显示/隐藏
|
|
|
|
|
|
void LoadColumnVisibility(); // 从配置加载列可见性
|
|
|
|
|
|
void SaveColumnVisibility(); // 保存列可见性到配置
|
2026-01-18 22:39:36 +01:00
|
|
|
|
|
|
|
|
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
|
|
|
|
|
|
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
|
|
public:
|
|
|
|
|
|
CListCtrl m_ClientList;
|
|
|
|
|
|
virtual BOOL OnInitDialog();
|
|
|
|
|
|
void RefreshClientList();
|
|
|
|
|
|
void DisplayClients();
|
|
|
|
|
|
void AdjustColumnWidths();
|
|
|
|
|
|
void SortByColumn(int nColumn, BOOL bAscending);
|
|
|
|
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
|
|
|
|
afx_msg void OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
|
2026-01-25 12:14:15 +01:00
|
|
|
|
afx_msg void OnListClick(NMHDR* pNMHDR, LRESULT* pResult);
|
|
|
|
|
|
afx_msg void OnContextMenu(CWnd* pWnd, CPoint pt);
|
|
|
|
|
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
2026-01-18 22:39:36 +01:00
|
|
|
|
virtual void OnCancel();
|
|
|
|
|
|
virtual void PostNcDestroy();
|
|
|
|
|
|
virtual void OnOK();
|
|
|
|
|
|
};
|