FLImaging 7.10.21.1
GUISearchBar.h
1#pragma once
2#include "ISearchTarget.h"
3#include "GUIEditCtrl.h"
4#include "GUIButton.h"
5#include "GUIStaticText.h"
6#include "GUIComboBox.h"
7#include "GUICheckBoxPushLike.h"
8#include "GUIStyledCtrlBase.h"
9
10namespace FLImaging
11{
12 namespace GUI
13 {
14 namespace SearchBarLayout
15 {
16 const int32_t kMargin = 4;
17 const int32_t kPadding = 2;
18 const int32_t kEditHeight = 20;
19 const int32_t kToggleBtnSize = 18;
20 const int32_t kNavBtnSize = 18;
21 const int32_t kGap = 2;
22 const int32_t kSeparatorW = 1;
23 }
24
25 class CGUISearchBar : public CWnd, public CGUIStyledCtrlBase
26 {
27 DECLARE_DYNAMIC(CGUISearchBar)
28 public:
29 CGUISearchBar();
30 virtual ~CGUISearchBar();
31
32 BOOL Create(CWnd* pParentWnd, ISearchTarget* pTargetEdit);
33 void Show();
34 void Hide();
35 bool IsShowing() const;
36 void UpdateLayout();
37 virtual BOOL PreTranslateMessage(MSG* pMsg);
38 virtual void SearchAllAndCount_Regex(const CString& strPattern);
39 virtual void SetTargetEdit(ISearchTarget* pTargetEdit);
40 virtual CRect GetGripRect(CWnd* pWnd) const;
41 virtual CRect GetOriginalRect() const;
42 virtual void SetOriginalRect(const CRect& rt);
43 virtual const CResult ClearResult();
44
45 protected:
46 void DoSearch(BOOL bDown, BOOL bResetFromCursor);
47 void SearchAllAndCount();
48 void ScrollToMatch(const CHARRANGE& match);
49 void UpdateIndexLabel();
50 void ApplyHighlightAll();
51 void ApplyCurrentMatchHighlight();
52 void ClearHighlight();
53 void LayoutControls(int cx, int cy);
54 DWORD BuildFindFlags();
55
56 protected:
57 CGUIEditCtrl m_editSearch;
58 CGUICheckBoxPushLike m_btnMatchCase;
59 CGUICheckBoxPushLike m_btnWholeWord;
60 CGUICheckBoxPushLike m_btnRegex;
61 CGUIButton m_btnPrev;
62 CGUIButton m_btnNext;
63 CGUIButton m_btnClose;
64 CGUIStaticText m_staticIndex;
65
66 ISearchTarget* m_pSearchTarget;
67 CWnd* m_pParentWnd;
68
69 int32_t m_i32Sep1X;
70 int32_t m_i32Sep2X;
71
72 BOOL m_bMatchCase;
73 BOOL m_bWholeWord;
74 BOOL m_bRegex;
75
76 std::vector<CHARRANGE> m_matches;
77 int32_t m_i32CurrentMatch;
78 int32_t m_i32LastHighlightedMatch;
79
80 bool m_bDragging;
81 bool m_bUserWantsOpen;
82 CPoint m_ptDragStart;
83 CRect m_rcOriginal;
84
85 CToolTipCtrl m_toolTip;
86
87 DECLARE_MESSAGE_MAP()
88 public:
89 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
90 afx_msg void OnDestroy();
91 afx_msg void OnSize(UINT nType, int cx, int cy);
92 afx_msg void OnPaint();
93 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
94 afx_msg void OnSearchTextChanged();
95 afx_msg void OnBtnPrev();
96 afx_msg void OnBtnNext();
97 afx_msg void OnBtnClose();
98 afx_msg void OnBtnMatchCase();
99 afx_msg void OnBtnWholeWord();
100 afx_msg void OnBtnRegex();
101 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
102 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
103 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
104 };
105 }
106}
Definition D2DObject.h:12