MainFrm.h
2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// MainFrm.h : interface of the CMainFrame class
//
#pragma once
#include "ETradeClientView.h"
#include <string>
#include <map>
#include <cstdint>
#include "etradeclient/browser/user_msg_monitor.h"
#include "etradeclient/utility/menu_res_auth_mgr.h"
#include "etradeclient/utility/ETTimeManage.h"
class CMainFrame : public CFrameWnd
{
typedef std::map<uint32_t, HICON> MenuIconsType;
public:
CMainFrame();
virtual ~CMainFrame();
bool Launch(); // Lauch the browser window.
void UpdateStatus(LPCTSTR status);
// Overrides
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
DECLARE_DYNAMIC(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnClose();
// Handlers for drawing the icon of the menu item.
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
afx_msg void OnUpdateToolBarMsgCount(CCmdUI *pCmdUI);
afx_msg void OnToolBarBtnClicked(UINT btn_id);
afx_msg void OnMenuBtnClicked(UINT btn_id);
afx_msg void OnToolbarDropDown(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnExit();
afx_msg void OnModifyPwd();
afx_msg void OnModifyConfig();
// Customized message handlers.
afx_msg LRESULT OnSessionExpired(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnGotMsgCount(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnCrashClose(WPARAM wParam, LPARAM lParam);
afx_msg void OnUpdateStateBar(CCmdUI *pCmdUI);
DECLARE_MESSAGE_MAP()
private:
bool FilterMenuBar();
bool FilterQuickAccessToolBar();
bool CreateMainFrmUI();
bool CreateWebNaviToolBar();
bool CreateQuickAccessToolBar();
bool CreateExFuncToolBar();
void UpdateToolbarBtnSize(CToolBar& toolbar, uint32_t padding_width = 0, uint32_t padding_height = 0);
bool LogOut();
void ShowUserMessageDlg();
std::string MenuUrl(uint32_t menu_res_id) const;
std::string WinHttpGet(const std::string& url_path) const;
private:
CStatusBar m_status_bar;
CETradeClientView m_view;
CToolBar m_web_navi_tlb;
CImageList m_web_navi_tlb_imgs;
CToolBar m_quick_access_tlb;
CImageList m_quick_access_tlb_imgs;
CToolBar m_ex_func_tlb; // tool bar to provide extra functional.
CImageList m_ex_func_tlb_imgs;
CImageList m_ex_func_tlb_disabled_imgs;
CReBar m_re_bar;
MenuResAuthMgr m_menu_res_auth_manager;
MenuIconsType m_authorized_menu_icons;
UserMsgMonitor m_user_msg_monitor;
int m_msg_count;
bool m_is_view_closing;
CETTimeManage m_cTimeManager;
public:
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg LRESULT UpdateTime(WPARAM wParam, LPARAM lParam);
};