FLImaging 6.11.25.2
GUIMenuBar.h
1#pragma once
2#include "DefinitionsGUI.h"
3#include <functional>
4
5namespace FLImaging
6{
7 namespace GUI
8 {
9 class CGUIMainFrameTabCtrl;
10 class CGUIMenuBarUserDefinedInfo;
11 class CGUIMenuBarMDITab;
12
13 typedef std::function<void(void*)> CMenuBarCallback;
14 #define MakeMenuBarCallback [=](void* pItem) -> void
15
16 class FL_EXPORT CGUIMenuBar : public CMFCMenuBar, public Base::CFLBase
17 {
18 public:
19 CGUIMenuBar();
20 virtual ~CGUIMenuBar();
21
22 public:
23 virtual void OnFillBackground(CDC* pDC);
24 virtual void DrawLogo(Gdiplus::Graphics& memG, const CRect& rcDst, COLORREF clrBg);
25
26 virtual void SetMinWidth(int32_t i32Minwidth);
27 virtual int32_t GetMinWidth()const;
28
29 virtual void SetTitleRectMinWidth(int32_t i32Minwidth);
30 virtual int32_t GetTitleRectMinWidth()const;
31
32 virtual void SetLeftItemMinPosX(int32_t i32Min);
33 virtual int32_t GetLeftItemMinPosX()const;
34
35 virtual void SetButtonWidth(int32_t i32Width);
36 virtual int32_t GetButtonWidth()const;
37
38 virtual CRect GetTitleBarRect()const;
39 virtual void SetTitleBarRect(CRect rtTitleBar);
40 virtual int GetHitButton()const;
41
42 virtual CWnd* GetMovableParent();
43
44 virtual int HitTest(CPoint point) override;
45
46 virtual void SetHitArea(EGUIMenuBarHitArea eHitArea);
47 virtual EGUIMenuBarHitArea GetHitArea()const;
48 // GetHitArea()로 얻은 값이 EGUIMenuBarHitArea_UserDefinedInfo 인 경우에 사용합니다.
49 virtual CGUIMenuBarUserDefinedInfo* GetHitUserDefinedInfo(CPoint ptClient) const;
50 // GetHitArea()로 얻은 값이 EGUIMenuBarHitArea_MDITab 인 경우에 사용합니다.
51 virtual CGUIMenuBarMDITab* GetHitMDITab() const;
52
53 virtual void SetToolTipText(const Base::CFLString<wchar_t>& strToolTipText);
54
55 // Current Model Name
56 virtual void SetCurrentModelNameBkColor(COLORREF clrBk);
57 virtual COLORREF GetCurrentModelNameBkColor()const;
58
59 virtual void SetCurrentModelNameTextColor(COLORREF clrText);
60 virtual COLORREF GetCurrentModelNameTextColor()const;
61
62 virtual void SetCurrentModelNameRect(CRect rtTitleBar);
63 virtual CRect GetCurrentModelNameRect()const;
64
65 virtual void ShowCurrentModelName(bool bShow);
66 virtual bool IsCurrentModelNameVisible()const;
67
68 // Current User Id
69 virtual void SetCurrentUserIDBkColor(COLORREF clrBk);
70 virtual COLORREF GetCurrentUserIDBkColor()const;
71
72 virtual void SetCurrentUserIDTextColor(COLORREF clrText);
73 virtual COLORREF GetCurrentUserIDTextColor()const;
74
75 virtual void SetCurrentUserIDRect(CRect rtTitleBar);
76 virtual CRect GetCurrentUserIDRect()const;
77
78 virtual void ShowCurrentUserID(bool bShow);
79 virtual bool IsCurrentUserIDVisible()const;
80
81 virtual void ShowLogo(bool bShow);
82 virtual bool IsLogoVisible()const;
83
84 // Current model 이름 사각형의 왼쪽 방향으로 하나씩 추가됩니다.
85 virtual void PushBackUserDefinedInfo(const Base::CFLString<wchar_t>& strInfo, COLORREF clrBackground = RGB(80, 80, 80), COLORREF clrText = RGB(255, 255, 255), bool bShow = true, EGUIAlignment eAlign = EGUIAlignment_CENTER_CENTER, EGUIStringTrimming eStringTrimming = EGUIStringTrimming_EllipsisCharacter);
86 virtual void PushBackUserDefinedInfo(const CGUIMenuBarUserDefinedInfo& refUDI);
87
88 virtual void PushFrontUserDefinedInfo(const Base::CFLString<wchar_t>& strInfo, COLORREF clrBackground = RGB(80, 80, 80), COLORREF clrText = RGB(255, 255, 255), bool bShow = true, EGUIAlignment eAlign = EGUIAlignment_CENTER_CENTER, EGUIStringTrimming eStringTrimming = EGUIStringTrimming_EllipsisCharacter);
89 virtual void PushFrontUserDefinedInfo(const CGUIMenuBarUserDefinedInfo& refUDI);
90
91 virtual int32_t GetUserDefinedInfoCount()const;
92 virtual CGUIMenuBarUserDefinedInfo* PopBackUserDefinedInfo();
93 virtual CGUIMenuBarUserDefinedInfo* GetBackUserDefinedInfo() const;
94 virtual CGUIMenuBarUserDefinedInfo* PopFrontUserDefinedInfo();
95 virtual CGUIMenuBarUserDefinedInfo* GetFrontUserDefinedInfo() const;
96
97 virtual CGUIMenuBarUserDefinedInfo* GetUserDefinedInfoAt(int32_t i32Index) const;
98 virtual int32_t GetUserDefinedInfoIndex(const CGUIMenuBarUserDefinedInfo* pUDI) const;
99
100 virtual const CResult SetUserDefinedInfoAt(int32_t i32Index, const Base::CFLString<wchar_t>& strInfo, COLORREF clrBackground = RGB(80, 80, 80), COLORREF clrText = RGB(255, 255, 255), bool bShow = true, EGUIAlignment eAlign = EGUIAlignment_CENTER_CENTER, EGUIStringTrimming eStringTrimming = EGUIStringTrimming_EllipsisCharacter);
101 virtual const CResult SetUserDefinedInfoAt(int32_t i32Index, const CGUIMenuBarUserDefinedInfo& refUDI);
102
103 virtual const CResult InsertUserDefinedInfoAt(int32_t i32Index, const Base::CFLString<wchar_t>& strInfo, COLORREF clrBackground = RGB(80, 80, 80), COLORREF clrText = RGB(255, 255, 255), bool bShow = true, EGUIAlignment eAlign = EGUIAlignment_CENTER_CENTER, EGUIStringTrimming eStringTrimming = EGUIStringTrimming_EllipsisCharacter);
104 virtual const CResult InsertUserDefinedInfoAt(int32_t i32Index, const CGUIMenuBarUserDefinedInfo& refUDI);
105
106 virtual const CResult RemoveUserDefinedInfoAt(int32_t i32Index);
107 virtual const CResult ClearUserDefinedInfo();
108
109 virtual void OnReceiveBroadcast(const Base::CBroadcastMessage* pMessage) override;
110
111 DeclareGetClassType();
112
113 protected:
114 // Color
115 Gdiplus::Color m_crBackground;
116 Gdiplus::Color m_crText;
117 COLORREF m_clrBackgroundCurrentModel;
118 COLORREF m_clrTextCurrentModel;
119 COLORREF m_clrBackgroundCurrentUserID;
120 COLORREF m_clrTextCurrentUserID;
121
122 bool m_bMoving;
123
124 Base::CFLString<wchar_t> m_strTitle;
125 bool m_bLButtonDown;
126 bool m_bLButtonDblClk;
127 bool m_bMouseDragMaximize;
128 CPoint m_ptDragStart;
129 CRect m_rtOrgWindow;
130 CRect m_rtClient;
131
132 int32_t m_i32ButtonWidth;
133 int32_t m_i32ButtonHeight;
134 int32_t m_i32MinWidth;
135 int32_t m_i32ItemWidthLeft;
136 int32_t m_i32LeftItemMinPosX;
137 int32_t m_i32TitleBarMinWidth;
138 int32_t m_i32ItemWidthRight;
139 int32_t m_i32ItemCountRight; // CLOSE, MAXIMIZE, MINIMIZE button
140 int32_t m_i32ItemCount;
141 int32_t m_i32LeftStartPos;
142
143 int32_t m_i32HitButton;
144 EGUIMenuBarHitArea m_eHitArea;
145
146 int32_t m_i32AnimationIdx;
147 int32_t m_i32AnimationIdxDirection;
148 unsigned char m_crTitleBk;
149 Gdiplus::Bitmap* m_pLogoImage;
150 int32_t m_i32BmpWidth, m_i32BmpHeight;
151 CRect m_rtTitleBar;
152 CRect m_rtTitleBarPrev;
153 CRect m_rtClose, m_rtRestore, m_rtMinimize;
154 CRect m_rtInfoCurrentModelName;
155 CRect m_rtInfoCurrentUserID;
156
157 CWnd* m_pParent;
158 bool m_bInit;
159 bool m_bAboutToMaximize;
160
161 CPoint m_ptPrevMouse;
162 double m_f64MoveThreshold;
163 double m_f64MoveDistance;
164
165 CRect m_rtMainFrame;
166 std::vector<unsigned char> m_vctLogoBkClr;
167
168 CGUIMainFrameTabCtrl* m_pMainFrameTabCtrl;
169 bool m_bTrackMouse;
170
171 CToolTipCtrl m_ToolTip;
172 Base::CFLString<wchar_t> m_strToolTipText;
173
174 bool m_bHitTimerInstalled;
175 bool m_bShowLogo;
176
177 protected:
178 void DoPaint(CDC* pDCPaint);
179 void DrawTitle(CDC* pDCPaint);
180 void UpdateAnimation();
181 void LoadLogoImage(const Base::CFLString<wchar_t>& strLogoPath);
182
183 public:
184 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
185 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
186 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
187 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
188 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
189 afx_msg void OnMouseLeave();
190 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
191 afx_msg void OnKillFocus(CWnd* pNewWnd);
192 afx_msg void OnSize(UINT nType, int cx, int cy);
193 afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
194 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
195 afx_msg void OnDestroy();
196 afx_msg void OnTimer(UINT_PTR nIDEvent);
197 DECLARE_MESSAGE_MAP()
198 virtual BOOL PreTranslateMessage(MSG* pMsg)override;
199
200 friend class CGUIMainFrame;
201 friend class CGUIMenuItemLogIn;
202};
203 }
204}
Definition D2DObject.h:12
EGUIMenuBarHitArea
The area where the mouse is located on the menu bar.
Definition DefinitionsGUI.h:4713
@ RGB
Definition DefinitionsBase.h:2630