Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: fpdfsdk/pdfwindow/PWL_ScrollBar.h

Issue 2340513002: Remove more strcmp/memcmp usage. (Closed)
Patch Set: Nit Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdfppo.cpp ('k') | fpdfsdk/pdfwindow/PWL_ScrollBar.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_ 7 #ifndef FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
8 #define FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_ 8 #define FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
9 9
10 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" 10 #include "fpdfsdk/pdfwindow/PWL_Wnd.h"
11 11
12 class CPWL_SBButton; 12 class CPWL_SBButton;
13 class CPWL_ScrollBar; 13 class CPWL_ScrollBar;
14 14
15 struct PWL_SCROLL_INFO { 15 struct PWL_SCROLL_INFO {
16 public: 16 public:
17 PWL_SCROLL_INFO() 17 PWL_SCROLL_INFO()
18 : fContentMin(0.0f), 18 : fContentMin(0.0f),
19 fContentMax(0.0f), 19 fContentMax(0.0f),
20 fPlateWidth(0.0f), 20 fPlateWidth(0.0f),
21 fBigStep(0.0f), 21 fBigStep(0.0f),
22 fSmallStep(0.0f) {} 22 fSmallStep(0.0f) {}
23
24 bool operator==(const PWL_SCROLL_INFO& that) const {
25 return fContentMin == that.fContentMin && fContentMax == that.fContentMax &&
26 fPlateWidth == that.fPlateWidth && fBigStep == that.fBigStep &&
27 fSmallStep == that.fSmallStep;
28 }
29 bool operator!=(const PWL_SCROLL_INFO& that) const {
30 return !(*this == that);
31 }
32
23 FX_FLOAT fContentMin; 33 FX_FLOAT fContentMin;
24 FX_FLOAT fContentMax; 34 FX_FLOAT fContentMax;
25 FX_FLOAT fPlateWidth; 35 FX_FLOAT fPlateWidth;
26 FX_FLOAT fBigStep; 36 FX_FLOAT fBigStep;
27 FX_FLOAT fSmallStep; 37 FX_FLOAT fSmallStep;
28 }; 38 };
29 39
30 enum PWL_SCROLLBAR_TYPE { SBT_HSCROLL, SBT_VSCROLL }; 40 enum PWL_SCROLLBAR_TYPE { SBT_HSCROLL, SBT_VSCROLL };
31 41
32 enum PWL_SBBUTTON_TYPE { PSBT_MIN, PSBT_MAX, PSBT_POS }; 42 enum PWL_SBBUTTON_TYPE { PSBT_MIN, PSBT_MAX, PSBT_POS };
(...skipping 18 matching lines...) Expand all
51 PWL_SCROLLBAR_TYPE m_eScrollBarType; 61 PWL_SCROLLBAR_TYPE m_eScrollBarType;
52 PWL_SBBUTTON_TYPE m_eSBButtonType; 62 PWL_SBBUTTON_TYPE m_eSBButtonType;
53 63
54 FX_BOOL m_bMouseDown; 64 FX_BOOL m_bMouseDown;
55 }; 65 };
56 66
57 struct PWL_FLOATRANGE { 67 struct PWL_FLOATRANGE {
58 public: 68 public:
59 PWL_FLOATRANGE(); 69 PWL_FLOATRANGE();
60 PWL_FLOATRANGE(FX_FLOAT min, FX_FLOAT max); 70 PWL_FLOATRANGE(FX_FLOAT min, FX_FLOAT max);
71
72 bool operator==(const PWL_FLOATRANGE& that) const {
73 return fMin == that.fMin && fMax == that.fMax;
74 }
75 bool operator!=(const PWL_FLOATRANGE& that) const { return !(*this == that); }
76
61 void Default(); 77 void Default();
62 void Set(FX_FLOAT min, FX_FLOAT max); 78 void Set(FX_FLOAT min, FX_FLOAT max);
63 FX_BOOL In(FX_FLOAT x) const; 79 FX_BOOL In(FX_FLOAT x) const;
64 FX_FLOAT GetWidth() const; 80 FX_FLOAT GetWidth() const;
65 81
66 FX_FLOAT fMin, fMax; 82 FX_FLOAT fMin;
83 FX_FLOAT fMax;
67 }; 84 };
68 85
69 struct PWL_SCROLL_PRIVATEDATA { 86 struct PWL_SCROLL_PRIVATEDATA {
70 public: 87 public:
71 PWL_SCROLL_PRIVATEDATA(); 88 PWL_SCROLL_PRIVATEDATA();
72 89
90 bool operator==(const PWL_SCROLL_PRIVATEDATA& that) const {
91 return ScrollRange == that.ScrollRange &&
92 fClientWidth == that.fClientWidth && fScrollPos == that.fScrollPos &&
93 fBigStep == that.fBigStep && fSmallStep == that.fSmallStep;
94 }
95 bool operator!=(const PWL_SCROLL_PRIVATEDATA& that) const {
96 return !(*this == that);
97 }
98
73 void Default(); 99 void Default();
74 void SetScrollRange(FX_FLOAT min, FX_FLOAT max); 100 void SetScrollRange(FX_FLOAT min, FX_FLOAT max);
75 void SetClientWidth(FX_FLOAT width); 101 void SetClientWidth(FX_FLOAT width);
76 void SetSmallStep(FX_FLOAT step); 102 void SetSmallStep(FX_FLOAT step);
77 void SetBigStep(FX_FLOAT step); 103 void SetBigStep(FX_FLOAT step);
78 FX_BOOL SetPos(FX_FLOAT pos); 104 FX_BOOL SetPos(FX_FLOAT pos);
79 105
80 void AddSmall(); 106 void AddSmall();
81 void SubSmall(); 107 void SubSmall();
82 void AddBig(); 108 void AddBig();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 CPWL_SBButton* m_pPosButton; 174 CPWL_SBButton* m_pPosButton;
149 PWL_SCROLL_PRIVATEDATA m_sData; 175 PWL_SCROLL_PRIVATEDATA m_sData;
150 FX_BOOL m_bMouseDown; 176 FX_BOOL m_bMouseDown;
151 FX_BOOL m_bMinOrMax; 177 FX_BOOL m_bMinOrMax;
152 FX_BOOL m_bNotifyForever; 178 FX_BOOL m_bNotifyForever;
153 FX_FLOAT m_nOldPos; 179 FX_FLOAT m_nOldPos;
154 FX_FLOAT m_fOldPosButton; 180 FX_FLOAT m_fOldPosButton;
155 }; 181 };
156 182
157 #endif // FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_ 183 #endif // FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfppo.cpp ('k') | fpdfsdk/pdfwindow/PWL_ScrollBar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698