-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ef0022
commit 040596f
Showing
13 changed files
with
274 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// SkinAutoAdaptSettingDlg.cpp: 实现文件 | ||
// | ||
|
||
#include "stdafx.h" | ||
#include "TrafficMonitor.h" | ||
#include "afxdialogex.h" | ||
#include "SkinAutoAdaptSettingDlg.h" | ||
|
||
|
||
// CSkinAutoAdaptSettingDlg 对话框 | ||
|
||
IMPLEMENT_DYNAMIC(CSkinAutoAdaptSettingDlg, CDialog) | ||
|
||
CSkinAutoAdaptSettingDlg::CSkinAutoAdaptSettingDlg(const vector<wstring>& skins, CWnd* pParent /*=nullptr*/) | ||
: CDialog(IDD_SKIN_AUTO_ADAPT_DLG, pParent) | ||
, m_skins(skins) | ||
{ | ||
|
||
} | ||
|
||
CSkinAutoAdaptSettingDlg::~CSkinAutoAdaptSettingDlg() | ||
{ | ||
} | ||
|
||
int CSkinAutoAdaptSettingDlg::FindSkinIndex(const wstring& skin_name) | ||
{ | ||
auto iter = std::find(m_skins.begin(), m_skins.end(), skin_name); | ||
if (iter == m_skins.end()) | ||
return 0; | ||
return iter - m_skins.begin(); | ||
} | ||
|
||
void CSkinAutoAdaptSettingDlg::DoDataExchange(CDataExchange* pDX) | ||
{ | ||
CDialog::DoDataExchange(pDX); | ||
DDX_Control(pDX, IDC_DARK_MODE_SKIN_COMBO, m_dark_mode_skin_combo); | ||
DDX_Control(pDX, IDC_LIGHT_MODE_SKIN_COMBO, m_light_mode_skin_combo); | ||
} | ||
|
||
|
||
BEGIN_MESSAGE_MAP(CSkinAutoAdaptSettingDlg, CDialog) | ||
END_MESSAGE_MAP() | ||
|
||
|
||
// CSkinAutoAdaptSettingDlg 消息处理程序 | ||
|
||
|
||
BOOL CSkinAutoAdaptSettingDlg::OnInitDialog() | ||
{ | ||
CDialog::OnInitDialog(); | ||
|
||
//初始化下拉列表 | ||
for (const auto& skin_path : m_skins) | ||
{ | ||
wstring skin_name; | ||
size_t index = skin_path.rfind(L'\\'); | ||
skin_name = skin_path.substr(index + 1); | ||
m_dark_mode_skin_combo.AddString(skin_name.c_str()); | ||
m_light_mode_skin_combo.AddString(skin_name.c_str()); | ||
} | ||
|
||
int dark_mode_skin = FindSkinIndex(theApp.m_cfg_data.skin_name_dark_mode); | ||
int light_mode_skin = FindSkinIndex(theApp.m_cfg_data.skin_name_light_mode); | ||
m_dark_mode_skin_combo.SetCurSel(dark_mode_skin); | ||
m_light_mode_skin_combo.SetCurSel(light_mode_skin); | ||
|
||
return TRUE; // return TRUE unless you set the focus to a control | ||
// 异常: OCX 属性页应返回 FALSE | ||
} | ||
|
||
|
||
void CSkinAutoAdaptSettingDlg::OnOK() | ||
{ | ||
m_dark_mode_skin = m_dark_mode_skin_combo.GetCurSel(); | ||
m_light_mode_skin = m_light_mode_skin_combo.GetCurSel(); | ||
|
||
CDialog::OnOK(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
#include "afxdialogex.h" | ||
|
||
|
||
// CSkinAutoAdaptSettingDlg 对话框 | ||
|
||
class CSkinAutoAdaptSettingDlg : public CDialog | ||
{ | ||
DECLARE_DYNAMIC(CSkinAutoAdaptSettingDlg) | ||
|
||
public: | ||
CSkinAutoAdaptSettingDlg(const vector<wstring>& skins, CWnd* pParent = nullptr); // 标准构造函数 | ||
virtual ~CSkinAutoAdaptSettingDlg(); | ||
|
||
int GetDarkModeSkin() const { return m_dark_mode_skin; } | ||
int GetLightModeSkin() const { return m_light_mode_skin; } | ||
|
||
// 对话框数据 | ||
#ifdef AFX_DESIGN_TIME | ||
enum { IDD = IDD_SKIN_AUTO_ADAPT_DLG }; | ||
#endif | ||
|
||
private: | ||
int FindSkinIndex(const wstring& skin_name); | ||
|
||
private: | ||
const vector<wstring>& m_skins; | ||
CComboBox m_dark_mode_skin_combo; | ||
CComboBox m_light_mode_skin_combo; | ||
|
||
int m_dark_mode_skin{}; | ||
int m_light_mode_skin{}; | ||
|
||
protected: | ||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 | ||
|
||
DECLARE_MESSAGE_MAP() | ||
public: | ||
virtual BOOL OnInitDialog(); | ||
virtual void OnOK(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.