|
@@ -0,0 +1,196 @@
|
|
|
+// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
|
|
|
+// (“Fluent UI”)。该示例仅供参考,
|
|
|
+// 用以补充《Microsoft 基础类参考》和
|
|
|
+// MFC C++ 库软件随附的相关电子文档。
|
|
|
+// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
|
|
|
+// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
|
|
|
+// https://go.microsoft.com/fwlink/?LinkId=238214.
|
|
|
+//
|
|
|
+// 版权所有(C) Microsoft Corporation
|
|
|
+// 保留所有权利。
|
|
|
+
|
|
|
+#include "stdafx.h"
|
|
|
+#include "framework.h"
|
|
|
+
|
|
|
+#include "UpgradeWnd.h"
|
|
|
+#include "Resource.h"
|
|
|
+#include "MainFrm.h"
|
|
|
+#include "SATHelper.h"
|
|
|
+#include <filehelper.h>
|
|
|
+
|
|
|
+#ifdef _DEBUG
|
|
|
+#undef THIS_FILE
|
|
|
+static char THIS_FILE[] = __FILE__;
|
|
|
+#define new DEBUG_NEW
|
|
|
+#endif
|
|
|
+
|
|
|
+extern CMainFrame* g_pMainFrame;
|
|
|
+
|
|
|
+// 重启进程按钮id;
|
|
|
+#define ID_BUTTON_RESTART_PROC 4
|
|
|
+// 复制框控件id;
|
|
|
+#define ID_CHECKBOX_SIGNAL_TYPE 5
|
|
|
+// 下拉框控件id;
|
|
|
+#define ID_COMBOBOX_SIGNAL_FILE 6
|
|
|
+/////////////////////////////////////////////////////////////////////////////
|
|
|
+// CResourceViewBar
|
|
|
+
|
|
|
+CUpgradeWnd::CUpgradeWnd() noexcept
|
|
|
+{
|
|
|
+ m_nComboHeight = 0;
|
|
|
+}
|
|
|
+
|
|
|
+CUpgradeWnd::~CUpgradeWnd()
|
|
|
+{
|
|
|
+ RedRat::UnloadLibrary();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+BEGIN_MESSAGE_MAP(CUpgradeWnd, CDockablePane)
|
|
|
+ ON_WM_CREATE()
|
|
|
+ ON_WM_SIZE()
|
|
|
+ ON_COMMAND(ID_EXPAND_ALL, OnExpandAllProperties)
|
|
|
+ ON_UPDATE_COMMAND_UI(ID_EXPAND_ALL, OnUpdateExpandAllProperties)
|
|
|
+ ON_COMMAND(ID_SORTPROPERTIES, OnSortProperties)
|
|
|
+ ON_UPDATE_COMMAND_UI(ID_SORTPROPERTIES, OnUpdateSortProperties)
|
|
|
+ ON_COMMAND(ID_PROPERTIES1, OnProperties1)
|
|
|
+ ON_UPDATE_COMMAND_UI(ID_PROPERTIES1, OnUpdateProperties1)
|
|
|
+ ON_COMMAND(ID_PROPERTIES2, OnProperties2)
|
|
|
+ ON_UPDATE_COMMAND_UI(ID_PROPERTIES2, OnUpdateProperties2)
|
|
|
+ ON_WM_SETFOCUS()
|
|
|
+ ON_WM_SETTINGCHANGE()
|
|
|
+ ON_WM_PAINT()
|
|
|
+
|
|
|
+ ON_WM_CONTEXTMENU()
|
|
|
+END_MESSAGE_MAP()
|
|
|
+
|
|
|
+/////////////////////////////////////////////////////////////////////////////
|
|
|
+// CResourceViewBar 消息处理程序
|
|
|
+
|
|
|
+void CUpgradeWnd::AdjustLayout()
|
|
|
+{
|
|
|
+ if (GetSafeHwnd() == nullptr || (AfxGetMainWnd() != nullptr && AfxGetMainWnd()->IsIconic()))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int CUpgradeWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
|
+{
|
|
|
+ if (CDockablePane::OnCreate(lpCreateStruct) == -1)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ CRect rectDummy;
|
|
|
+ rectDummy.SetRectEmpty();
|
|
|
+
|
|
|
+ // 创建组合:
|
|
|
+ const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
|
|
+
|
|
|
+ // 设置最小窗体;
|
|
|
+ SetMinSize((530, 260));
|
|
|
+
|
|
|
+ // 校正布局;
|
|
|
+ AdjustLayout();
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnSize(UINT nType, int cx, int cy)
|
|
|
+{
|
|
|
+ CDockablePane::OnSize(nType, cx, cy);
|
|
|
+
|
|
|
+ TRACE2("坐标:%d,%d\n", cx, cy);
|
|
|
+
|
|
|
+ AdjustLayout();
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnExpandAllProperties()
|
|
|
+{
|
|
|
+ //m_wndPropList.ExpandAll();
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnUpdateExpandAllProperties(CCmdUI* /* pCmdUI */)
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnSortProperties()
|
|
|
+{
|
|
|
+ //m_wndPropList.SetAlphabeticMode(!m_wndPropList.IsAlphabeticMode());
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnUpdateSortProperties(CCmdUI* pCmdUI)
|
|
|
+{
|
|
|
+ //pCmdUI->SetCheck(m_wndPropList.IsAlphabeticMode());
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnProperties1()
|
|
|
+{
|
|
|
+ // TODO: 在此处添加命令处理程序代码
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnUpdateProperties1(CCmdUI* /*pCmdUI*/)
|
|
|
+{
|
|
|
+ // TODO: 在此处添加命令更新 UI 处理程序代码
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnProperties2()
|
|
|
+{
|
|
|
+ // TODO: 在此处添加命令处理程序代码
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnUpdateProperties2(CCmdUI* /*pCmdUI*/)
|
|
|
+{
|
|
|
+ // TODO: 在此处添加命令更新 UI 处理程序代码
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnSetFocus(CWnd* pOldWnd)
|
|
|
+{
|
|
|
+ CDockablePane::OnSetFocus(pOldWnd);
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
|
|
|
+{
|
|
|
+ CDockablePane::OnSettingChange(uFlags, lpszSection);
|
|
|
+ //SetPropListFont();
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeWnd::SetPropListFont()
|
|
|
+{
|
|
|
+ ::DeleteObject(m_fntPropList.Detach());
|
|
|
+
|
|
|
+ LOGFONT lf;
|
|
|
+ afxGlobalData.fontRegular.GetLogFont(&lf);
|
|
|
+
|
|
|
+ NONCLIENTMETRICS info;
|
|
|
+ info.cbSize = sizeof(info);
|
|
|
+
|
|
|
+ afxGlobalData.GetNonClientMetrics(info);
|
|
|
+
|
|
|
+ lf.lfHeight = info.lfMenuFont.lfHeight;
|
|
|
+ lf.lfWeight = info.lfMenuFont.lfWeight;
|
|
|
+ lf.lfItalic = info.lfMenuFont.lfItalic;
|
|
|
+
|
|
|
+ m_fntPropList.CreateFontIndirect(&lf);
|
|
|
+
|
|
|
+ //m_wndObjectCombo.SetFont(&m_fntPropList);
|
|
|
+}
|
|
|
+
|
|
|
+// 如果CDockablePane无控件,改变大小时背景会刷新失败;
|
|
|
+// 所以要重载onpaint;
|
|
|
+void CUpgradeWnd::OnPaint()
|
|
|
+{
|
|
|
+ CPaintDC dc(this); // device context for painting
|
|
|
+ // TODO: 在此处添加消息处理程序代码
|
|
|
+ // 不为绘图消息调用 CDockablePane::OnPaint();
|
|
|
+ CRect rc;
|
|
|
+ GetClientRect(rc);
|
|
|
+ CBrush brush;
|
|
|
+ brush.CreateSolidBrush(0xFFEFD5);
|
|
|
+ dc.FillRect(&rc, &brush);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void CUpgradeWnd::OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/)
|
|
|
+{
|
|
|
+ // TODO: 在此处添加消息处理程序代码
|
|
|
+}
|