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

Side by Side Diff: xfa/fwl/core/fwl_formimp.cpp

Issue 1896923002: Make FWL_CornerEnlarge a const (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | 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 #include "xfa/fwl/core/fwl_formimp.h" 7 #include "xfa/fwl/core/fwl_formimp.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h"
11 #include "xfa/fwl/core/cfwl_message.h" 11 #include "xfa/fwl/core/cfwl_message.h"
12 #include "xfa/fwl/core/cfwl_themebackground.h" 12 #include "xfa/fwl/core/cfwl_themebackground.h"
13 #include "xfa/fwl/core/cfwl_themepart.h" 13 #include "xfa/fwl/core/cfwl_themepart.h"
14 #include "xfa/fwl/core/cfwl_themetext.h" 14 #include "xfa/fwl/core/cfwl_themetext.h"
15 #include "xfa/fwl/core/fwl_appimp.h" 15 #include "xfa/fwl/core/fwl_appimp.h"
16 #include "xfa/fwl/core/fwl_noteimp.h" 16 #include "xfa/fwl/core/fwl_noteimp.h"
17 #include "xfa/fwl/core/fwl_targetimp.h" 17 #include "xfa/fwl/core/fwl_targetimp.h"
18 #include "xfa/fwl/core/fwl_threadimp.h" 18 #include "xfa/fwl/core/fwl_threadimp.h"
19 #include "xfa/fwl/core/fwl_widgetimp.h" 19 #include "xfa/fwl/core/fwl_widgetimp.h"
20 #include "xfa/fwl/core/fwl_widgetmgrimp.h" 20 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
21 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" 21 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
22 #include "xfa/fwl/core/ifwl_app.h" 22 #include "xfa/fwl/core/ifwl_app.h"
23 #include "xfa/fwl/core/ifwl_themeprovider.h" 23 #include "xfa/fwl/core/ifwl_themeprovider.h"
24 24
25 #define FWL_SYSBTNSIZE 21 25 #define FWL_SYSBTNSIZE 21
26 #define FWL_SYSBTNMARGIN 5 26 #define FWL_SYSBTNMARGIN 5
27 #define FWL_SYSBTNSPAN 2 27 #define FWL_SYSBTNSPAN 2
28 #define FWL_CornerEnlarge 10 28
29 namespace {
30
31 const uint8_t kCornerEnlarge = 10;
Tom Sepez 2016/04/18 18:00:57 nit: we wouldn't by chance know the units, as in k
dsinclair 2016/04/18 19:09:38 I don't, I don't see anything in the usage that re
32
33 } // namespace
29 34
30 // static 35 // static
31 IFWL_Form* IFWL_Form::CreateFormProxy(CFWL_WidgetImpProperties& properties, 36 IFWL_Form* IFWL_Form::CreateFormProxy(CFWL_WidgetImpProperties& properties,
32 CFX_WideString* classname, 37 CFX_WideString* classname,
33 IFWL_Widget* pOuter) { 38 IFWL_Widget* pOuter) {
34 IFWL_Form* pForm = new IFWL_Form; 39 IFWL_Form* pForm = new IFWL_Form;
35 CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter); 40 CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter);
36 pForm->SetImpl(pFormProxyImpl); 41 pForm->SetImpl(pFormProxyImpl);
37 pFormProxyImpl->SetInterface(pForm); 42 pFormProxyImpl->SetInterface(pForm);
38 return pForm; 43 return pForm;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 211 }
207 CFX_RectF rtCap; 212 CFX_RectF rtCap;
208 rtCap.Set(m_rtCaption.left + m_fCYBorder, m_rtCaption.top + m_fCXBorder, 213 rtCap.Set(m_rtCaption.left + m_fCYBorder, m_rtCaption.top + m_fCXBorder,
209 m_rtCaption.width - FWL_SYSBTNSIZE * m_iSysBox - 2 * m_fCYBorder, 214 m_rtCaption.width - FWL_SYSBTNSIZE * m_iSysBox - 2 * m_fCYBorder,
210 m_rtCaption.height - m_fCXBorder); 215 m_rtCaption.height - m_fCXBorder);
211 if (rtCap.Contains(fx, fy)) { 216 if (rtCap.Contains(fx, fy)) {
212 return FWL_WGTHITTEST_Titlebar; 217 return FWL_WGTHITTEST_Titlebar;
213 } 218 }
214 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) && 219 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) &&
215 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize)) { 220 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize)) {
216 FX_FLOAT fWidth = 221 FX_FLOAT fWidth = m_rtRelative.width - 2 * (m_fCYBorder + kCornerEnlarge);
217 m_rtRelative.width - 2 * (m_fCYBorder + FWL_CornerEnlarge); 222 FX_FLOAT fHeight = m_rtRelative.height - 2 * (m_fCXBorder + kCornerEnlarge);
218 FX_FLOAT fHeight =
219 m_rtRelative.height - 2 * (m_fCXBorder + FWL_CornerEnlarge);
220 CFX_RectF rt; 223 CFX_RectF rt;
221 rt.Set(0, m_fCXBorder + FWL_CornerEnlarge, m_fCYBorder, fHeight); 224 rt.Set(0, m_fCXBorder + kCornerEnlarge, m_fCYBorder, fHeight);
222 if (rt.Contains(fx, fy)) { 225 if (rt.Contains(fx, fy)) {
223 return FWL_WGTHITTEST_Left; 226 return FWL_WGTHITTEST_Left;
224 } 227 }
225 rt.Set(m_rtRelative.width - m_fCYBorder, m_fCXBorder + FWL_CornerEnlarge, 228 rt.Set(m_rtRelative.width - m_fCYBorder, m_fCXBorder + kCornerEnlarge,
226 m_fCYBorder, fHeight); 229 m_fCYBorder, fHeight);
227 if (rt.Contains(fx, fy)) { 230 if (rt.Contains(fx, fy)) {
228 return FWL_WGTHITTEST_Right; 231 return FWL_WGTHITTEST_Right;
229 } 232 }
230 rt.Set(m_fCYBorder + FWL_CornerEnlarge, 0, fWidth, m_fCXBorder); 233 rt.Set(m_fCYBorder + kCornerEnlarge, 0, fWidth, m_fCXBorder);
231 if (rt.Contains(fx, fy)) { 234 if (rt.Contains(fx, fy)) {
232 return FWL_WGTHITTEST_Top; 235 return FWL_WGTHITTEST_Top;
233 } 236 }
234 rt.Set(m_fCYBorder + FWL_CornerEnlarge, m_rtRelative.height - m_fCXBorder, 237 rt.Set(m_fCYBorder + kCornerEnlarge, m_rtRelative.height - m_fCXBorder,
235 fWidth, m_fCXBorder); 238 fWidth, m_fCXBorder);
236 if (rt.Contains(fx, fy)) { 239 if (rt.Contains(fx, fy)) {
237 return FWL_WGTHITTEST_Bottom; 240 return FWL_WGTHITTEST_Bottom;
238 } 241 }
239 rt.Set(0, 0, m_fCYBorder + FWL_CornerEnlarge, 242 rt.Set(0, 0, m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
240 m_fCXBorder + FWL_CornerEnlarge);
241 if (rt.Contains(fx, fy)) { 243 if (rt.Contains(fx, fy)) {
242 return FWL_WGTHITTEST_LeftTop; 244 return FWL_WGTHITTEST_LeftTop;
243 } 245 }
244 rt.Set(0, m_rtRelative.height - m_fCXBorder - FWL_CornerEnlarge, 246 rt.Set(0, m_rtRelative.height - m_fCXBorder - kCornerEnlarge,
245 m_fCYBorder + FWL_CornerEnlarge, m_fCXBorder + FWL_CornerEnlarge); 247 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
246 if (rt.Contains(fx, fy)) { 248 if (rt.Contains(fx, fy)) {
247 return FWL_WGTHITTEST_LeftBottom; 249 return FWL_WGTHITTEST_LeftBottom;
248 } 250 }
249 rt.Set(m_rtRelative.width - m_fCYBorder - FWL_CornerEnlarge, 0, 251 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, 0,
250 m_fCYBorder + FWL_CornerEnlarge, m_fCXBorder + FWL_CornerEnlarge); 252 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
251 if (rt.Contains(fx, fy)) { 253 if (rt.Contains(fx, fy)) {
252 return FWL_WGTHITTEST_RightTop; 254 return FWL_WGTHITTEST_RightTop;
253 } 255 }
254 rt.Set(m_rtRelative.width - m_fCYBorder - FWL_CornerEnlarge, 256 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge,
255 m_rtRelative.height - m_fCXBorder - FWL_CornerEnlarge, 257 m_rtRelative.height - m_fCXBorder - kCornerEnlarge,
256 m_fCYBorder + FWL_CornerEnlarge, m_fCXBorder + FWL_CornerEnlarge); 258 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge);
257 if (rt.Contains(fx, fy)) { 259 if (rt.Contains(fx, fy)) {
258 return FWL_WGTHITTEST_RightBottom; 260 return FWL_WGTHITTEST_RightBottom;
259 } 261 }
260 } 262 }
261 return FWL_WGTHITTEST_Client; 263 return FWL_WGTHITTEST_Client;
262 } 264 }
263 FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, 265 FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
264 const CFX_Matrix* pMatrix) { 266 const CFX_Matrix* pMatrix) {
265 if (!pGraphics) 267 if (!pGraphics)
266 return FWL_ERR_Indefinite; 268 return FWL_ERR_Indefinite;
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 } 1145 }
1144 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { 1146 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) {
1145 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; 1147 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx;
1146 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; 1148 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy;
1147 } 1149 }
1148 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { 1150 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) {
1149 CFWL_EvtClose eClose; 1151 CFWL_EvtClose eClose;
1150 eClose.m_pSrcTarget = m_pOwner->m_pInterface; 1152 eClose.m_pSrcTarget = m_pOwner->m_pInterface;
1151 m_pOwner->DispatchEvent(&eClose); 1153 m_pOwner->DispatchEvent(&eClose);
1152 } 1154 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698