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

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

Issue 2533623002: Cleanup default FWL params part I (Closed)
Patch Set: Rebase to master Created 4 years 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
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/cfwl_edit.h" 7 #include "xfa/fwl/core/cfwl_edit.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (iTextLen > 0) { 115 if (iTextLen > 0) {
116 CFX_WideString wsText = m_EdtEngine.GetText(0); 116 CFX_WideString wsText = m_EdtEngine.GetText(0);
117 CFX_SizeF sz = CalcTextSize( 117 CFX_SizeF sz = CalcTextSize(
118 wsText, m_pProperties->m_pThemeProvider, 118 wsText, m_pProperties->m_pThemeProvider,
119 !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine)); 119 !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine));
120 rect.Set(0, 0, sz.x, sz.y); 120 rect.Set(0, 0, sz.x, sz.y);
121 } 121 }
122 CFWL_Widget::GetWidgetRect(rect, true); 122 CFWL_Widget::GetWidgetRect(rect, true);
123 } 123 }
124 124
125 void CFWL_Edit::SetStates(uint32_t dwStates, bool bSet) { 125 void CFWL_Edit::SetStates(uint32_t dwStates) {
126 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) || 126 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) ||
127 (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { 127 (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
128 HideCaret(nullptr); 128 HideCaret(nullptr);
129 } 129 }
130 CFWL_Widget::SetStates(dwStates, bSet); 130 CFWL_Widget::SetStates(dwStates);
Tom Sepez 2016/12/06 22:38:26 Sure this didn't ever used to do a RemoveStates eq
dsinclair 2016/12/07 15:03:27 If we remove the Invisible or Disabled state, then
131 } 131 }
132 132
133 void CFWL_Edit::Update() { 133 void CFWL_Edit::Update() {
134 if (IsLocked()) 134 if (IsLocked())
135 return; 135 return;
136 if (!m_pProperties->m_pThemeProvider) 136 if (!m_pProperties->m_pThemeProvider)
137 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 137 m_pProperties->m_pThemeProvider = GetAvailableTheme();
138 138
139 Layout(); 139 Layout();
140 if (m_rtClient.IsEmpty()) 140 if (m_rtClient.IsEmpty())
141 return; 141 return;
142 142
143 UpdateEditEngine(); 143 UpdateEditEngine();
144 UpdateVAlignment(); 144 UpdateVAlignment();
145 UpdateScroll(); 145 UpdateScroll();
146 InitCaret(); 146 InitCaret();
147 } 147 }
148 148
149 FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) { 149 FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
150 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { 150 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
151 if (IsShowScrollBar(true)) { 151 if (IsShowScrollBar(true)) {
152 CFX_RectF rect; 152 CFX_RectF rect;
153 m_pVertScrollBar->GetWidgetRect(rect); 153 m_pVertScrollBar->GetWidgetRect(rect, false);
154 if (rect.Contains(fx, fy)) 154 if (rect.Contains(fx, fy))
155 return FWL_WidgetHit::VScrollBar; 155 return FWL_WidgetHit::VScrollBar;
156 } 156 }
157 if (IsShowScrollBar(false)) { 157 if (IsShowScrollBar(false)) {
158 CFX_RectF rect; 158 CFX_RectF rect;
159 m_pHorzScrollBar->GetWidgetRect(rect); 159 m_pHorzScrollBar->GetWidgetRect(rect, false);
160 if (rect.Contains(fx, fy)) 160 if (rect.Contains(fx, fy))
161 return FWL_WidgetHit::HScrollBar; 161 return FWL_WidgetHit::HScrollBar;
162 } 162 }
163 } 163 }
164 if (m_rtClient.Contains(fx, fy)) 164 if (m_rtClient.Contains(fx, fy))
165 return FWL_WidgetHit::Edit; 165 return FWL_WidgetHit::Edit;
166 return FWL_WidgetHit::Unknown; 166 return FWL_WidgetHit::Unknown;
167 } 167 }
168 168
169 void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData, 169 void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 return; 426 return;
427 427
428 bool bRepaintContent = UpdateOffset(); 428 bool bRepaintContent = UpdateOffset();
429 UpdateCaret(); 429 UpdateCaret();
430 CFX_RectF rtInvalid; 430 CFX_RectF rtInvalid;
431 rtInvalid.Set(0, 0, 0, 0); 431 rtInvalid.Set(0, 0, 0, 0);
432 bool bRepaintScroll = false; 432 bool bRepaintScroll = false;
433 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { 433 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) {
434 CFWL_ScrollBar* pScroll = UpdateScroll(); 434 CFWL_ScrollBar* pScroll = UpdateScroll();
435 if (pScroll) { 435 if (pScroll) {
436 pScroll->GetWidgetRect(rtInvalid); 436 pScroll->GetWidgetRect(rtInvalid, false);
437 bRepaintScroll = true; 437 bRepaintScroll = true;
438 } 438 }
439 } 439 }
440 if (bRepaintContent || bRepaintScroll) { 440 if (bRepaintContent || bRepaintScroll) {
441 if (bRepaintContent) 441 if (bRepaintContent)
442 rtInvalid.Union(m_rtEngine); 442 rtInvalid.Union(m_rtEngine);
443 Repaint(&rtInvalid); 443 Repaint(&rtInvalid);
444 } 444 }
445 } 445 }
446 446
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (dwStates) 525 if (dwStates)
526 param.m_dwStates = CFWL_PartState_Disabled; 526 param.m_dwStates = CFWL_PartState_Disabled;
527 param.m_pGraphics = pGraphics; 527 param.m_pGraphics = pGraphics;
528 param.m_matrix = *pMatrix; 528 param.m_matrix = *pMatrix;
529 param.m_rtPart = m_rtClient; 529 param.m_rtPart = m_rtClient;
530 pTheme->DrawBackground(&param); 530 pTheme->DrawBackground(&param);
531 531
532 if (!IsShowScrollBar(true) || !IsShowScrollBar(false)) 532 if (!IsShowScrollBar(true) || !IsShowScrollBar(false))
533 return; 533 return;
534 534
535 CFX_RectF rtScorll; 535 CFX_RectF rtScroll;
536 m_pHorzScrollBar->GetWidgetRect(rtScorll); 536 m_pHorzScrollBar->GetWidgetRect(rtScroll, false);
537 537
538 CFX_RectF rtStatic; 538 CFX_RectF rtStatic;
539 rtStatic.Set(m_rtClient.right() - rtScorll.height, 539 rtStatic.Set(m_rtClient.right() - rtScroll.height,
540 m_rtClient.bottom() - rtScorll.height, rtScorll.height, 540 m_rtClient.bottom() - rtScroll.height, rtScroll.height,
541 rtScorll.height); 541 rtScroll.height);
542 param.m_bStaticBackground = true; 542 param.m_bStaticBackground = true;
543 param.m_bMaximize = true; 543 param.m_bMaximize = true;
544 param.m_rtPart = rtStatic; 544 param.m_rtPart = rtStatic;
545 pTheme->DrawBackground(&param); 545 pTheme->DrawBackground(&param);
546 } 546 }
547 547
548 void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, 548 void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
549 IFWL_ThemeProvider* pTheme, 549 IFWL_ThemeProvider* pTheme,
550 const CFX_Matrix* pMatrix) { 550 const CFX_Matrix* pMatrix) {
551 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); 551 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 return nullptr; 910 return nullptr;
911 911
912 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); 912 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
913 if (!pPage) 913 if (!pPage)
914 return nullptr; 914 return nullptr;
915 915
916 const CFX_RectF& rtFDE = pPage->GetContentsBox(); 916 const CFX_RectF& rtFDE = pPage->GetContentsBox();
917 CFWL_ScrollBar* pRepaint = nullptr; 917 CFWL_ScrollBar* pRepaint = nullptr;
918 if (bShowHorz) { 918 if (bShowHorz) {
919 CFX_RectF rtScroll; 919 CFX_RectF rtScroll;
920 m_pHorzScrollBar->GetWidgetRect(rtScroll); 920 m_pHorzScrollBar->GetWidgetRect(rtScroll, false);
921 if (rtScroll.width < rtFDE.width) { 921 if (rtScroll.width < rtFDE.width) {
922 m_pHorzScrollBar->LockUpdate(); 922 m_pHorzScrollBar->LockUpdate();
923 FX_FLOAT fRange = rtFDE.width - rtScroll.width; 923 FX_FLOAT fRange = rtFDE.width - rtScroll.width;
924 m_pHorzScrollBar->SetRange(0.0f, fRange); 924 m_pHorzScrollBar->SetRange(0.0f, fRange);
925 925
926 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetX, 0.0f), fRange); 926 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetX, 0.0f), fRange);
927 m_pHorzScrollBar->SetPos(fPos); 927 m_pHorzScrollBar->SetPos(fPos);
928 m_pHorzScrollBar->SetTrackPos(fPos); 928 m_pHorzScrollBar->SetTrackPos(fPos);
929 m_pHorzScrollBar->SetPageSize(rtScroll.width); 929 m_pHorzScrollBar->SetPageSize(rtScroll.width);
930 m_pHorzScrollBar->SetStepSize(rtScroll.width / 10); 930 m_pHorzScrollBar->SetStepSize(rtScroll.width / 10);
931 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, false); 931 m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Disabled);
932 m_pHorzScrollBar->UnlockUpdate(); 932 m_pHorzScrollBar->UnlockUpdate();
933 m_pHorzScrollBar->Update(); 933 m_pHorzScrollBar->Update();
934 pRepaint = m_pHorzScrollBar.get(); 934 pRepaint = m_pHorzScrollBar.get();
935 } else if ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { 935 } else if ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) {
936 m_pHorzScrollBar->LockUpdate(); 936 m_pHorzScrollBar->LockUpdate();
937 m_pHorzScrollBar->SetRange(0, -1); 937 m_pHorzScrollBar->SetRange(0, -1);
938 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, true); 938 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled);
939 m_pHorzScrollBar->UnlockUpdate(); 939 m_pHorzScrollBar->UnlockUpdate();
940 m_pHorzScrollBar->Update(); 940 m_pHorzScrollBar->Update();
941 pRepaint = m_pHorzScrollBar.get(); 941 pRepaint = m_pHorzScrollBar.get();
942 } 942 }
943 } 943 }
944 944
945 if (bShowVert) { 945 if (bShowVert) {
946 CFX_RectF rtScroll; 946 CFX_RectF rtScroll;
947 m_pVertScrollBar->GetWidgetRect(rtScroll); 947 m_pVertScrollBar->GetWidgetRect(rtScroll, false);
948 if (rtScroll.height < rtFDE.height) { 948 if (rtScroll.height < rtFDE.height) {
949 m_pVertScrollBar->LockUpdate(); 949 m_pVertScrollBar->LockUpdate();
950 FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace; 950 FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace;
951 FX_FLOAT fRange = std::max(rtFDE.height - m_rtEngine.height, fStep); 951 FX_FLOAT fRange = std::max(rtFDE.height - m_rtEngine.height, fStep);
952 952
953 m_pVertScrollBar->SetRange(0.0f, fRange); 953 m_pVertScrollBar->SetRange(0.0f, fRange);
954 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetY, 0.0f), fRange); 954 FX_FLOAT fPos = std::min(std::max(m_fScrollOffsetY, 0.0f), fRange);
955 m_pVertScrollBar->SetPos(fPos); 955 m_pVertScrollBar->SetPos(fPos);
956 m_pVertScrollBar->SetTrackPos(fPos); 956 m_pVertScrollBar->SetTrackPos(fPos);
957 m_pVertScrollBar->SetPageSize(rtScroll.height); 957 m_pVertScrollBar->SetPageSize(rtScroll.height);
958 m_pVertScrollBar->SetStepSize(fStep); 958 m_pVertScrollBar->SetStepSize(fStep);
959 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, false); 959 m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Disabled);
960 m_pVertScrollBar->UnlockUpdate(); 960 m_pVertScrollBar->UnlockUpdate();
961 m_pVertScrollBar->Update(); 961 m_pVertScrollBar->Update();
962 pRepaint = m_pVertScrollBar.get(); 962 pRepaint = m_pVertScrollBar.get();
963 } else if ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { 963 } else if ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) {
964 m_pVertScrollBar->LockUpdate(); 964 m_pVertScrollBar->LockUpdate();
965 m_pVertScrollBar->SetRange(0, -1); 965 m_pVertScrollBar->SetRange(0, -1);
966 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, true); 966 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled);
967 m_pVertScrollBar->UnlockUpdate(); 967 m_pVertScrollBar->UnlockUpdate();
968 m_pVertScrollBar->Update(); 968 m_pVertScrollBar->Update();
969 pRepaint = m_pVertScrollBar.get(); 969 pRepaint = m_pVertScrollBar.get();
970 } 970 }
971 } 971 }
972 return pRepaint; 972 return pRepaint;
973 } 973 }
974 974
975 bool CFWL_Edit::IsShowScrollBar(bool bVert) { 975 bool CFWL_Edit::IsShowScrollBar(bool bVert) {
976 bool bShow = 976 bool bShow =
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 m_rtClient.height); 1050 m_rtClient.height);
1051 } else { 1051 } else {
1052 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, 1052 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth,
1053 m_rtClient.height); 1053 m_rtClient.height);
1054 if (bShowHorzScrollbar) 1054 if (bShowHorzScrollbar)
1055 rtVertScr.height -= fWidth; 1055 rtVertScr.height -= fWidth;
1056 m_rtEngine.width -= fWidth; 1056 m_rtEngine.width -= fWidth;
1057 } 1057 }
1058 1058
1059 m_pVertScrollBar->SetWidgetRect(rtVertScr); 1059 m_pVertScrollBar->SetWidgetRect(rtVertScr);
1060 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); 1060 m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
1061 m_pVertScrollBar->Update(); 1061 m_pVertScrollBar->Update();
1062 } else if (m_pVertScrollBar) { 1062 } else if (m_pVertScrollBar) {
1063 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); 1063 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible);
1064 } 1064 }
1065 1065
1066 if (bShowHorzScrollbar) { 1066 if (bShowHorzScrollbar) {
1067 InitScrollBar(false); 1067 InitScrollBar(false);
1068 1068
1069 CFX_RectF rtHoriScr; 1069 CFX_RectF rtHoriScr;
1070 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { 1070 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
1071 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, 1071 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin,
1072 m_rtClient.width, fWidth); 1072 m_rtClient.width, fWidth);
1073 } else { 1073 } else {
1074 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, 1074 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth,
1075 m_rtClient.width, fWidth); 1075 m_rtClient.width, fWidth);
1076 if (bShowVertScrollbar) 1076 if (bShowVertScrollbar)
1077 rtHoriScr.width -= fWidth; 1077 rtHoriScr.width -= fWidth;
1078 m_rtEngine.height -= fWidth; 1078 m_rtEngine.height -= fWidth;
1079 } 1079 }
1080 m_pHorzScrollBar->SetWidgetRect(rtHoriScr); 1080 m_pHorzScrollBar->SetWidgetRect(rtHoriScr);
1081 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); 1081 m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
1082 m_pHorzScrollBar->Update(); 1082 m_pHorzScrollBar->Update();
1083 } else if (m_pHorzScrollBar) { 1083 } else if (m_pHorzScrollBar) {
1084 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); 1084 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible);
1085 } 1085 }
1086 } 1086 }
1087 1087
1088 void CFWL_Edit::LayoutScrollBar() { 1088 void CFWL_Edit::LayoutScrollBar() {
1089 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) == 1089 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) ==
1090 0) { 1090 0) {
1091 return; 1091 return;
1092 } 1092 }
1093 1093
1094 FX_FLOAT* pfWidth = nullptr; 1094 FX_FLOAT* pfWidth = nullptr;
(...skipping 11 matching lines...) Expand all
1106 m_rtClient.height); 1106 m_rtClient.height);
1107 } else { 1107 } else {
1108 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, 1108 rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth,
1109 m_rtClient.height); 1109 m_rtClient.height);
1110 if (bShowHorzScrollbar) 1110 if (bShowHorzScrollbar)
1111 rtVertScr.height -= fWidth; 1111 rtVertScr.height -= fWidth;
1112 } 1112 }
1113 m_pVertScrollBar->SetWidgetRect(rtVertScr); 1113 m_pVertScrollBar->SetWidgetRect(rtVertScr);
1114 m_pVertScrollBar->Update(); 1114 m_pVertScrollBar->Update();
1115 } 1115 }
1116 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); 1116 m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
1117 } else if (m_pVertScrollBar) { 1117 } else if (m_pVertScrollBar) {
1118 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); 1118 m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible);
1119 } 1119 }
1120 1120
1121 if (bShowHorzScrollbar) { 1121 if (bShowHorzScrollbar) {
1122 if (!m_pHorzScrollBar) { 1122 if (!m_pHorzScrollBar) {
1123 if (!pfWidth) { 1123 if (!pfWidth) {
1124 pfWidth = static_cast<FX_FLOAT*>( 1124 pfWidth = static_cast<FX_FLOAT*>(
1125 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 1125 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
1126 } 1126 }
1127 1127
1128 FX_FLOAT fWidth = pfWidth ? *pfWidth : 0; 1128 FX_FLOAT fWidth = pfWidth ? *pfWidth : 0;
1129 InitScrollBar(false); 1129 InitScrollBar(false);
1130 CFX_RectF rtHoriScr; 1130 CFX_RectF rtHoriScr;
1131 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { 1131 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
1132 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, 1132 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin,
1133 m_rtClient.width, fWidth); 1133 m_rtClient.width, fWidth);
1134 } else { 1134 } else {
1135 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, 1135 rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth,
1136 m_rtClient.width, fWidth); 1136 m_rtClient.width, fWidth);
1137 if (bShowVertScrollbar) 1137 if (bShowVertScrollbar)
1138 rtHoriScr.width -= (fWidth); 1138 rtHoriScr.width -= (fWidth);
1139 } 1139 }
1140 m_pHorzScrollBar->SetWidgetRect(rtHoriScr); 1140 m_pHorzScrollBar->SetWidgetRect(rtHoriScr);
1141 m_pHorzScrollBar->Update(); 1141 m_pHorzScrollBar->Update();
1142 } 1142 }
1143 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); 1143 m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
1144 } else if (m_pHorzScrollBar) { 1144 } else if (m_pHorzScrollBar) {
1145 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); 1145 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible);
1146 } 1146 }
1147 if (bShowVertScrollbar || bShowHorzScrollbar) 1147 if (bShowVertScrollbar || bShowHorzScrollbar)
1148 UpdateScroll(); 1148 UpdateScroll();
1149 } 1149 }
1150 1150
1151 void CFWL_Edit::DeviceToEngine(CFX_PointF& pt) { 1151 void CFWL_Edit::DeviceToEngine(CFX_PointF& pt) {
1152 pt.x += m_fScrollOffsetX - m_rtEngine.left; 1152 pt.x += m_fScrollOffsetX - m_rtEngine.left;
1153 pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset; 1153 pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset;
1154 } 1154 }
1155 1155
(...skipping 22 matching lines...) Expand all
1178 Repaint(&m_rtEngine); 1178 Repaint(&m_rtEngine);
1179 return; 1179 return;
1180 } 1180 }
1181 1181
1182 CFWL_Widget* pOuter = this; 1182 CFWL_Widget* pOuter = this;
1183 pRect->Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); 1183 pRect->Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top);
1184 while (pOuter->GetOuter()) { 1184 while (pOuter->GetOuter()) {
1185 pOuter = pOuter->GetOuter(); 1185 pOuter = pOuter->GetOuter();
1186 1186
1187 CFX_RectF rtOuter; 1187 CFX_RectF rtOuter;
1188 pOuter->GetWidgetRect(rtOuter); 1188 pOuter->GetWidgetRect(rtOuter, false);
1189 pRect->Offset(rtOuter.left, rtOuter.top); 1189 pRect->Offset(rtOuter.left, rtOuter.top);
1190 } 1190 }
1191 1191
1192 CXFA_FFWidget* pXFAWidget = 1192 CXFA_FFWidget* pXFAWidget =
1193 static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()); 1193 static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem());
1194 if (!pXFAWidget) 1194 if (!pXFAWidget)
1195 return; 1195 return;
1196 1196
1197 IXFA_DocEnvironment* pDocEnvironment = 1197 IXFA_DocEnvironment* pDocEnvironment =
1198 pXFAWidget->GetDoc()->GetDocEnvironment(); 1198 pXFAWidget->GetDoc()->GetDocEnvironment();
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 } 1644 }
1645 if (iCurPos == fPos) 1645 if (iCurPos == fPos)
1646 return true; 1646 return true;
1647 1647
1648 pScrollBar->SetPos(fPos); 1648 pScrollBar->SetPos(fPos);
1649 pScrollBar->SetTrackPos(fPos); 1649 pScrollBar->SetTrackPos(fPos);
1650 UpdateOffset(pScrollBar, fPos - iCurPos); 1650 UpdateOffset(pScrollBar, fPos - iCurPos);
1651 UpdateCaret(); 1651 UpdateCaret();
1652 1652
1653 CFX_RectF rect; 1653 CFX_RectF rect;
1654 GetWidgetRect(rect); 1654 GetWidgetRect(rect, false);
1655 CFX_RectF rtInvalidate; 1655 CFX_RectF rtInvalidate;
1656 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); 1656 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
1657 Repaint(&rtInvalidate); 1657 Repaint(&rtInvalidate);
1658 return true; 1658 return true;
1659 } 1659 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_edit.h ('k') | xfa/fwl/core/cfwl_form.h » ('j') | xfa/fwl/core/cfwl_form.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698