FLImaging 7.8.25.3
GUIComboBox.h
1#pragma once
2
10
11#include <afxwin.h>
12#include "GUIWndCtrlBase.h"
13#include "GUIStyledCtrlBase.h"
14
16namespace FLImaging
17{
19 namespace GUI
20 {
28 class FL_EXPORT CGUIComboBox : public CComboBox, public CGUIWndCtrlBase, public CGUIStyledCtrlBase
29 {
30 public:
38
45 virtual ~CGUIComboBox();
46
47 public:
56 virtual void SetButtonSize(int32_t i32Size);
57
66 virtual int32_t GetButtonSize() const;
67
76 virtual void SetHeight(int32_t i32Height);
77
86 virtual int32_t GetHeight() const;
87
96 virtual void SetVisibleItemCount(int32_t i32ItemsToShow);
97
106 virtual BOOL GetDroppedState()const;
107
116 virtual void SetDroppedState(BOOL bState);
117
128 virtual int SetPrevSel(int nSelect);
129
138 virtual int32_t GetPrevSel()const;
139
150 virtual int SetCurSel(int nSelect);
151
161 virtual void EnableToolTipOnListBox(bool bEnable = true);
162
171 virtual bool IsToolTipOnListBoxEnabled() const;
172
181 static void SetToolTipDelay(uint32_t u32Delay);
182
191 static uint32_t GetToolTipDelay();
192
203 virtual void SetToolTipText(int32_t i32Index, const wchar_t* pWCsTipText);
204
213 virtual CEdit* GetEditBox() const;
214
223 virtual CListBox* GetListBox() const;
224
225 protected:
226 virtual void PreSubclassWindow() override;
227 virtual void DrawBackground(CDC* pDC, CRect rect);
228 virtual void DrawBorder(CDC* pDC, CRect rect);
229 virtual void DrawArrow(CDC* pDC, CRect rect);
230 virtual void DrawText(CDC* pDC, CRect rect);
231
232 void SetHookForListbox();
233 void DestroyToolTipWnd();
234 void CreateToolTipWnd();
235 static void HandleListboxMouseMove(CGUIComboBox* pCombo, CListBox* pList, UINT uFlag, CPoint point);
236 static void HandleOnTimer(UINT nIDEvent);
237 static void HandleOnPaint();
238 static BOOL OnTrackMouseEvent(HWND hWnd, DWORD dwFlags);
239
240 static LRESULT CALLBACK HookListboxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
241 static LRESULT CALLBACK HookTipWndProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp);
242
243 protected:
244 CBrush m_brBrush;
245 int32_t m_i32BtnSize;
246 int32_t m_i32PrevSel;
247 int32_t m_i32HeightManuallySet;
248 bool m_bInOnSize;
249
250 BOOL m_bCursorOnComboBox;
251 BOOL m_bLButtonDown;
252 BOOL m_bDroppedState;
253 BOOL m_bDroppedStatePrev;
254 bool m_bEnableToolTipOnListBox;
255
256 CMap<int32_t, int32_t, CString, const wchar_t*> m_mapTipTexts;
257 CRect m_rcDropDownBtn;
258 COMBOBOXINFO m_cbi;
259 CUIntArray m_arrDisabledItems;
260
261 static int m_i32OriginalSel;
262 static CWnd* m_pTipWnd;
263 static CFont m_fontToolTip;
264 static uint32_t m_u32DelayTime;
265 static BOOL m_bMouseCursorEntered;
266
267 static CMap<HWND, HWND, WNDPROC, WNDPROC&> m_mapWndProc;
268 static CMap<HWND, HWND, CGUIComboBox*, CGUIComboBox*&> m_mapCombo;
269 static int32_t m_i32ComboBoxCreationCount;
270
271 public:
272 DECLARE_MESSAGE_MAP()
273 afx_msg void OnPaint();
274 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
275 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
276 afx_msg void OnMouseHover(UINT nFlags, CPoint point);
277 afx_msg void OnMouseLeave();
278 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
279 afx_msg BOOL OnCbnKillfocus();
280 afx_msg void OnSetFocus(CWnd* pOldWnd);
281 afx_msg void OnKillFocus(CWnd* pNewWnd);
282 afx_msg BOOL OnCbnDropdown();
283 afx_msg BOOL OnCbnCloseup();
284 afx_msg BOOL OnCbnSelchange();
285 afx_msg BOOL OnCbnEditChange();
286 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
287 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
288 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
289 afx_msg void OnSize(UINT nType, int cx, int cy);
290 afx_msg void OnEnable(BOOL bEnable);
291 afx_msg void OnDestroy();
292 afx_msg LRESULT OnSetFont(WPARAM hFont, LPARAM lParam);
293};
294 }
295}
virtual void SetVisibleItemCount(int32_t i32ItemsToShow)
Specify drop-down height of combo box.
virtual int SetCurSel(int nSelect)
Specifies the currently selected value.
virtual CEdit * GetEditBox() const
Retrieves the edit box control of the combo box.
virtual int32_t GetPrevSel() const
Gets previously selected values.
virtual bool IsToolTipOnListBoxEnabled() const
Checks whether tooltips are currently enabled for the list box of the combo box.
virtual int32_t GetButtonSize() const
Gets the button size of the combo box.
CGUIComboBox()
Default constructor.
virtual void SetHeight(int32_t i32Height)
Sets the height of the combo box control.
virtual void SetButtonSize(int32_t i32Size)
Specify the button size of the combo box.
virtual int32_t GetHeight() const
Retrieves the current height of the combo box control.
virtual void SetDroppedState(BOOL bState)
Function to set drop-down status of combo box.
virtual ~CGUIComboBox()
Default destructor.
static uint32_t GetToolTipDelay()
Returns the currently set tooltip delay time.
virtual void EnableToolTipOnListBox(bool bEnable=true)
Enables or disables the tooltip functionality for the list box of the combo box. When enabled,...
virtual void SetToolTipText(int32_t i32Index, const wchar_t *pWCsTipText)
Sets the tooltip text for a specific item.
virtual CListBox * GetListBox() const
Retrieves the list box control of the combo box.
virtual BOOL GetDroppedState() const
Function to get drop-down status of combo box.
static void SetToolTipDelay(uint32_t u32Delay)
Sets the delay time before the tooltip is displayed.
virtual int SetPrevSel(int nSelect)
Functions that store previously selected values.
Definition D2DObject.h:12