| OLD | NEW |
| 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 "fpdfsdk/include/pdfwindow/PWL_ComboBox.h" | 7 #include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" |
| 10 #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" |
| 11 #include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" | 11 #include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" |
| 12 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" | 12 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" |
| 13 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | 13 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" |
| 14 #include "public/fpdf_fwlevent.h" | 14 #include "public/fpdf_fwlevent.h" |
| 15 | 15 |
| 16 #define PWLCB_DEFAULTFONTSIZE 12.0f | 16 #define PWLCB_DEFAULTFONTSIZE 12.0f |
| 17 | 17 |
| 18 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) | 18 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
| 19 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 19 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 20 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 20 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 21 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) | 21 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) |
| 22 | 22 |
| 23 FX_BOOL CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, | 23 FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
| 24 FX_DWORD nFlag) { | |
| 25 CPWL_Wnd::OnLButtonUp(point, nFlag); | 24 CPWL_Wnd::OnLButtonUp(point, nFlag); |
| 26 | 25 |
| 27 if (m_bMouseDown) { | 26 if (m_bMouseDown) { |
| 28 ReleaseCapture(); | 27 ReleaseCapture(); |
| 29 m_bMouseDown = FALSE; | 28 m_bMouseDown = FALSE; |
| 30 | 29 |
| 31 if (ClientHitTest(point)) { | 30 if (ClientHitTest(point)) { |
| 32 if (CPWL_Wnd* pParent = GetParentWindow()) { | 31 if (CPWL_Wnd* pParent = GetParentWindow()) { |
| 33 pParent->OnNotify(this, PNM_LBUTTONUP, 0, | 32 pParent->OnNotify(this, PNM_LBUTTONUP, 0, |
| 34 PWL_MAKEDWORD(point.x, point.y)); | 33 PWL_MAKEDWORD(point.x, point.y)); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 103 } |
| 105 | 104 |
| 106 OnNotifySelChanged(TRUE, bExit, nFlag); | 105 OnNotifySelChanged(TRUE, bExit, nFlag); |
| 107 | 106 |
| 108 return TRUE; | 107 return TRUE; |
| 109 } | 108 } |
| 110 | 109 |
| 111 void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 110 void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
| 112 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 111 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
| 113 | 112 |
| 114 CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect(); | 113 CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); |
| 115 | 114 |
| 116 if (IsVisible() && !rectWnd.IsEmpty()) { | 115 if (IsVisible() && !rectWnd.IsEmpty()) { |
| 117 CFX_ByteTextBuf sButton; | 116 CFX_ByteTextBuf sButton; |
| 118 | 117 |
| 119 CFX_FloatPoint ptCenter = GetCenterPoint(); | 118 CPDF_Point ptCenter = GetCenterPoint(); |
| 120 | 119 |
| 121 CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, | 120 CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, |
| 122 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); | 121 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); |
| 123 CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, | 122 CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, |
| 124 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); | 123 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); |
| 125 CFX_FloatPoint pt3(ptCenter.x, | 124 CPDF_Point pt3(ptCenter.x, |
| 126 ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); | 125 ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); |
| 127 | 126 |
| 128 if (IsFloatBigger(rectWnd.right - rectWnd.left, | 127 if (IsFloatBigger(rectWnd.right - rectWnd.left, |
| 129 PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && | 128 PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && |
| 130 IsFloatBigger(rectWnd.top - rectWnd.bottom, | 129 IsFloatBigger(rectWnd.top - rectWnd.bottom, |
| 131 PWL_CBBUTTON_TRIANGLE_HALFLEN)) { | 130 PWL_CBBUTTON_TRIANGLE_HALFLEN)) { |
| 132 sButton << "0 g\n"; | 131 sButton << "0 g\n"; |
| 133 sButton << pt1.x << " " << pt1.y << " m\n"; | 132 sButton << pt1.x << " " << pt1.y << " m\n"; |
| 134 sButton << pt2.x << " " << pt2.y << " l\n"; | 133 sButton << pt2.x << " " << pt2.y << " l\n"; |
| 135 sButton << pt3.x << " " << pt3.y << " l\n"; | 134 sButton << pt3.x << " " << pt3.y << " l\n"; |
| 136 sButton << pt1.x << " " << pt1.y << " l f\n"; | 135 sButton << pt1.x << " " << pt1.y << " l f\n"; |
| 137 | 136 |
| 138 sAppStream << "q\n" << sButton << "Q\n"; | 137 sAppStream << "q\n" << sButton << "Q\n"; |
| 139 } | 138 } |
| 140 } | 139 } |
| 141 } | 140 } |
| 142 | 141 |
| 143 void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, | 142 void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, |
| 144 CFX_Matrix* pUser2Device) { | 143 CFX_Matrix* pUser2Device) { |
| 145 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); | 144 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); |
| 146 | 145 |
| 147 CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect(); | 146 CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); |
| 148 | 147 |
| 149 if (IsVisible() && !rectWnd.IsEmpty()) { | 148 if (IsVisible() && !rectWnd.IsEmpty()) { |
| 150 CFX_FloatPoint ptCenter = GetCenterPoint(); | 149 CPDF_Point ptCenter = GetCenterPoint(); |
| 151 | 150 |
| 152 CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, | 151 CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, |
| 153 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); | 152 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); |
| 154 CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, | 153 CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, |
| 155 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); | 154 ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); |
| 156 CFX_FloatPoint pt3(ptCenter.x, | 155 CPDF_Point pt3(ptCenter.x, |
| 157 ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); | 156 ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); |
| 158 | 157 |
| 159 if (IsFloatBigger(rectWnd.right - rectWnd.left, | 158 if (IsFloatBigger(rectWnd.right - rectWnd.left, |
| 160 PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && | 159 PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && |
| 161 IsFloatBigger(rectWnd.top - rectWnd.bottom, | 160 IsFloatBigger(rectWnd.top - rectWnd.bottom, |
| 162 PWL_CBBUTTON_TRIANGLE_HALFLEN)) { | 161 PWL_CBBUTTON_TRIANGLE_HALFLEN)) { |
| 163 CFX_PathData path; | 162 CFX_PathData path; |
| 164 | 163 |
| 165 path.SetPointCount(4); | 164 path.SetPointCount(4); |
| 166 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO); | 165 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO); |
| 167 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO); | 166 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO); |
| 168 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); | 167 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); |
| 169 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); | 168 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); |
| 170 | 169 |
| 171 pDevice->DrawPath(&path, pUser2Device, NULL, | 170 pDevice->DrawPath(&path, pUser2Device, NULL, |
| 172 CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR, | 171 CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR, |
| 173 GetTransparency()), | 172 GetTransparency()), |
| 174 0, FXFILL_ALTERNATE); | 173 0, FXFILL_ALTERNATE); |
| 175 } | 174 } |
| 176 } | 175 } |
| 177 } | 176 } |
| 178 | 177 |
| 179 FX_BOOL CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, | 178 FX_BOOL CPWL_CBButton::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { |
| 180 FX_DWORD nFlag) { | |
| 181 CPWL_Wnd::OnLButtonDown(point, nFlag); | 179 CPWL_Wnd::OnLButtonDown(point, nFlag); |
| 182 | 180 |
| 183 SetCapture(); | 181 SetCapture(); |
| 184 | 182 |
| 185 if (CPWL_Wnd* pParent = GetParentWindow()) { | 183 if (CPWL_Wnd* pParent = GetParentWindow()) { |
| 186 pParent->OnNotify(this, PNM_LBUTTONDOWN, 0, | 184 pParent->OnNotify(this, PNM_LBUTTONDOWN, 0, |
| 187 PWL_MAKEDWORD(point.x, point.y)); | 185 PWL_MAKEDWORD(point.x, point.y)); |
| 188 } | 186 } |
| 189 | 187 |
| 190 return TRUE; | 188 return TRUE; |
| 191 } | 189 } |
| 192 | 190 |
| 193 FX_BOOL CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, | 191 FX_BOOL CPWL_CBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
| 194 FX_DWORD nFlag) { | |
| 195 CPWL_Wnd::OnLButtonUp(point, nFlag); | 192 CPWL_Wnd::OnLButtonUp(point, nFlag); |
| 196 | 193 |
| 197 ReleaseCapture(); | 194 ReleaseCapture(); |
| 198 | 195 |
| 199 return TRUE; | 196 return TRUE; |
| 200 } | 197 } |
| 201 | 198 |
| 202 CPWL_ComboBox::CPWL_ComboBox() | 199 CPWL_ComboBox::CPWL_ComboBox() |
| 203 : m_pEdit(NULL), | 200 : m_pEdit(NULL), |
| 204 m_pButton(NULL), | 201 m_pButton(NULL), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 ecp.pParentWnd = this; | 290 ecp.pParentWnd = this; |
| 294 ecp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PES_CENTER | | 291 ecp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PES_CENTER | |
| 295 PES_AUTOSCROLL | PES_UNDO; | 292 PES_AUTOSCROLL | PES_UNDO; |
| 296 | 293 |
| 297 if (HasFlag(PWS_AUTOFONTSIZE)) | 294 if (HasFlag(PWS_AUTOFONTSIZE)) |
| 298 ecp.dwFlags |= PWS_AUTOFONTSIZE; | 295 ecp.dwFlags |= PWS_AUTOFONTSIZE; |
| 299 | 296 |
| 300 if (!HasFlag(PCBS_ALLOWCUSTOMTEXT)) | 297 if (!HasFlag(PCBS_ALLOWCUSTOMTEXT)) |
| 301 ecp.dwFlags |= PWS_READONLY; | 298 ecp.dwFlags |= PWS_READONLY; |
| 302 | 299 |
| 303 ecp.rcRectWnd = CFX_FloatRect(0, 0, 0, 0); | 300 ecp.rcRectWnd = CPDF_Rect(0, 0, 0, 0); |
| 304 ecp.dwBorderWidth = 0; | 301 ecp.dwBorderWidth = 0; |
| 305 ecp.nBorderStyle = PBS_SOLID; | 302 ecp.nBorderStyle = PBS_SOLID; |
| 306 | 303 |
| 307 m_pEdit->Create(ecp); | 304 m_pEdit->Create(ecp); |
| 308 } | 305 } |
| 309 } | 306 } |
| 310 | 307 |
| 311 void CPWL_ComboBox::CreateButton(const PWL_CREATEPARAM& cp) { | 308 void CPWL_ComboBox::CreateButton(const PWL_CREATEPARAM& cp) { |
| 312 if (!m_pButton) { | 309 if (!m_pButton) { |
| 313 m_pButton = new CPWL_CBButton; | 310 m_pButton = new CPWL_CBButton; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 329 if (!m_pList) { | 326 if (!m_pList) { |
| 330 m_pList = new CPWL_CBListBox; | 327 m_pList = new CPWL_CBListBox; |
| 331 m_pList->AttachFFLData(m_pFormFiller); | 328 m_pList->AttachFFLData(m_pFormFiller); |
| 332 PWL_CREATEPARAM lcp = cp; | 329 PWL_CREATEPARAM lcp = cp; |
| 333 lcp.pParentWnd = this; | 330 lcp.pParentWnd = this; |
| 334 lcp.dwFlags = | 331 lcp.dwFlags = |
| 335 PWS_CHILD | PWS_BORDER | PWS_BACKGROUND | PLBS_HOVERSEL | PWS_VSCROLL; | 332 PWS_CHILD | PWS_BORDER | PWS_BACKGROUND | PLBS_HOVERSEL | PWS_VSCROLL; |
| 336 lcp.nBorderStyle = PBS_SOLID; | 333 lcp.nBorderStyle = PBS_SOLID; |
| 337 lcp.dwBorderWidth = 1; | 334 lcp.dwBorderWidth = 1; |
| 338 lcp.eCursorType = FXCT_ARROW; | 335 lcp.eCursorType = FXCT_ARROW; |
| 339 lcp.rcRectWnd = CFX_FloatRect(0, 0, 0, 0); | 336 lcp.rcRectWnd = CPDF_Rect(0, 0, 0, 0); |
| 340 | 337 |
| 341 if (cp.dwFlags & PWS_AUTOFONTSIZE) | 338 if (cp.dwFlags & PWS_AUTOFONTSIZE) |
| 342 lcp.fFontSize = PWLCB_DEFAULTFONTSIZE; | 339 lcp.fFontSize = PWLCB_DEFAULTFONTSIZE; |
| 343 else | 340 else |
| 344 lcp.fFontSize = cp.fFontSize; | 341 lcp.fFontSize = cp.fFontSize; |
| 345 | 342 |
| 346 if (cp.sBorderColor.nColorType == COLORTYPE_TRANSPARENT) | 343 if (cp.sBorderColor.nColorType == COLORTYPE_TRANSPARENT) |
| 347 lcp.sBorderColor = PWL_DEFAULT_BLACKCOLOR; | 344 lcp.sBorderColor = PWL_DEFAULT_BLACKCOLOR; |
| 348 | 345 |
| 349 if (cp.sBackgroundColor.nColorType == COLORTYPE_TRANSPARENT) | 346 if (cp.sBackgroundColor.nColorType == COLORTYPE_TRANSPARENT) |
| 350 lcp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; | 347 lcp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; |
| 351 | 348 |
| 352 m_pList->Create(lcp); | 349 m_pList->Create(lcp); |
| 353 } | 350 } |
| 354 } | 351 } |
| 355 | 352 |
| 356 void CPWL_ComboBox::RePosChildWnd() { | 353 void CPWL_ComboBox::RePosChildWnd() { |
| 357 CFX_FloatRect rcClient = GetClientRect(); | 354 CPDF_Rect rcClient = GetClientRect(); |
| 358 | 355 |
| 359 if (m_bPopup) { | 356 if (m_bPopup) { |
| 360 CFX_FloatRect rclient = GetClientRect(); | 357 CPDF_Rect rclient = GetClientRect(); |
| 361 CFX_FloatRect rcButton = rclient; | 358 CPDF_Rect rcButton = rclient; |
| 362 CFX_FloatRect rcEdit = rcClient; | 359 CPDF_Rect rcEdit = rcClient; |
| 363 CFX_FloatRect rcList = CPWL_Wnd::GetWindowRect(); | 360 CPDF_Rect rcList = CPWL_Wnd::GetWindowRect(); |
| 364 | 361 |
| 365 FX_FLOAT fOldWindowHeight = m_rcOldWindow.Height(); | 362 FX_FLOAT fOldWindowHeight = m_rcOldWindow.Height(); |
| 366 FX_FLOAT fOldClientHeight = fOldWindowHeight - GetBorderWidth() * 2; | 363 FX_FLOAT fOldClientHeight = fOldWindowHeight - GetBorderWidth() * 2; |
| 367 | 364 |
| 368 switch (m_nPopupWhere) { | 365 switch (m_nPopupWhere) { |
| 369 case 0: | 366 case 0: |
| 370 rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; | 367 rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; |
| 371 | 368 |
| 372 if (rcButton.left < rclient.left) | 369 if (rcButton.left < rclient.left) |
| 373 rcButton.left = rclient.left; | 370 rcButton.left = rclient.left; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 412 |
| 416 if (m_pEdit) | 413 if (m_pEdit) |
| 417 m_pEdit->Move(rcEdit, TRUE, FALSE); | 414 m_pEdit->Move(rcEdit, TRUE, FALSE); |
| 418 | 415 |
| 419 if (m_pList) { | 416 if (m_pList) { |
| 420 m_pList->SetVisible(TRUE); | 417 m_pList->SetVisible(TRUE); |
| 421 m_pList->Move(rcList, TRUE, FALSE); | 418 m_pList->Move(rcList, TRUE, FALSE); |
| 422 m_pList->ScrollToListItem(m_nSelectItem); | 419 m_pList->ScrollToListItem(m_nSelectItem); |
| 423 } | 420 } |
| 424 } else { | 421 } else { |
| 425 CFX_FloatRect rcButton = rcClient; | 422 CPDF_Rect rcButton = rcClient; |
| 426 | 423 |
| 427 rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; | 424 rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; |
| 428 | 425 |
| 429 if (rcButton.left < rcClient.left) | 426 if (rcButton.left < rcClient.left) |
| 430 rcButton.left = rcClient.left; | 427 rcButton.left = rcClient.left; |
| 431 | 428 |
| 432 if (m_pButton) | 429 if (m_pButton) |
| 433 m_pButton->Move(rcButton, TRUE, FALSE); | 430 m_pButton->Move(rcButton, TRUE, FALSE); |
| 434 | 431 |
| 435 CFX_FloatRect rcEdit = rcClient; | 432 CPDF_Rect rcEdit = rcClient; |
| 436 rcEdit.right = rcButton.left - 1.0f; | 433 rcEdit.right = rcButton.left - 1.0f; |
| 437 | 434 |
| 438 if (rcEdit.left < rcClient.left) | 435 if (rcEdit.left < rcClient.left) |
| 439 rcEdit.left = rcClient.left; | 436 rcEdit.left = rcClient.left; |
| 440 | 437 |
| 441 if (rcEdit.right < rcEdit.left) | 438 if (rcEdit.right < rcEdit.left) |
| 442 rcEdit.right = rcEdit.left; | 439 rcEdit.right = rcEdit.left; |
| 443 | 440 |
| 444 if (m_pEdit) | 441 if (m_pEdit) |
| 445 m_pEdit->Move(rcEdit, TRUE, FALSE); | 442 m_pEdit->Move(rcEdit, TRUE, FALSE); |
| 446 | 443 |
| 447 if (m_pList) | 444 if (m_pList) |
| 448 m_pList->SetVisible(FALSE); | 445 m_pList->SetVisible(FALSE); |
| 449 } | 446 } |
| 450 } | 447 } |
| 451 | 448 |
| 452 void CPWL_ComboBox::SelectAll() { | 449 void CPWL_ComboBox::SelectAll() { |
| 453 if (m_pEdit && HasFlag(PCBS_ALLOWCUSTOMTEXT)) | 450 if (m_pEdit && HasFlag(PCBS_ALLOWCUSTOMTEXT)) |
| 454 m_pEdit->SelectAll(); | 451 m_pEdit->SelectAll(); |
| 455 } | 452 } |
| 456 | 453 |
| 457 CFX_FloatRect CPWL_ComboBox::GetFocusRect() const { | 454 CPDF_Rect CPWL_ComboBox::GetFocusRect() const { |
| 458 return CFX_FloatRect(); | 455 return CPDF_Rect(); |
| 459 } | 456 } |
| 460 | 457 |
| 461 void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { | 458 void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { |
| 462 if (!m_pList) | 459 if (!m_pList) |
| 463 return; | 460 return; |
| 464 if (bPopup == m_bPopup) | 461 if (bPopup == m_bPopup) |
| 465 return; | 462 return; |
| 466 FX_FLOAT fListHeight = m_pList->GetContentRect().Height(); | 463 FX_FLOAT fListHeight = m_pList->GetContentRect().Height(); |
| 467 if (!IsFloatBigger(fListHeight, 0.0f)) | 464 if (!IsFloatBigger(fListHeight, 0.0f)) |
| 468 return; | 465 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 481 if (m_pList->GetCount() > 3) | 478 if (m_pList->GetCount() > 3) |
| 482 fPopupMin = | 479 fPopupMin = |
| 483 m_pList->GetFirstHeight() * 3 + m_pList->GetBorderWidth() * 2; | 480 m_pList->GetFirstHeight() * 3 + m_pList->GetBorderWidth() * 2; |
| 484 FX_FLOAT fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2; | 481 FX_FLOAT fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2; |
| 485 m_pFillerNotify->QueryWherePopup(GetAttachedData(), fPopupMin, fPopupMax, | 482 m_pFillerNotify->QueryWherePopup(GetAttachedData(), fPopupMin, fPopupMax, |
| 486 nWhere, fPopupRet); | 483 nWhere, fPopupRet); |
| 487 | 484 |
| 488 if (IsFloatBigger(fPopupRet, 0.0f)) { | 485 if (IsFloatBigger(fPopupRet, 0.0f)) { |
| 489 m_bPopup = bPopup; | 486 m_bPopup = bPopup; |
| 490 | 487 |
| 491 CFX_FloatRect rcWindow = CPWL_Wnd::GetWindowRect(); | 488 CPDF_Rect rcWindow = CPWL_Wnd::GetWindowRect(); |
| 492 m_rcOldWindow = rcWindow; | 489 m_rcOldWindow = rcWindow; |
| 493 switch (nWhere) { | 490 switch (nWhere) { |
| 494 default: | 491 default: |
| 495 case 0: | 492 case 0: |
| 496 rcWindow.bottom -= fPopupRet; | 493 rcWindow.bottom -= fPopupRet; |
| 497 break; | 494 break; |
| 498 case 1: | 495 case 1: |
| 499 rcWindow.top += fPopupRet; | 496 rcWindow.top += fPopupRet; |
| 500 break; | 497 break; |
| 501 } | 498 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 | 639 |
| 643 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) { | 640 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) { |
| 644 m_pFillerNotify = pNotify; | 641 m_pFillerNotify = pNotify; |
| 645 | 642 |
| 646 if (m_pEdit) | 643 if (m_pEdit) |
| 647 m_pEdit->SetFillerNotify(pNotify); | 644 m_pEdit->SetFillerNotify(pNotify); |
| 648 | 645 |
| 649 if (m_pList) | 646 if (m_pList) |
| 650 m_pList->SetFillerNotify(pNotify); | 647 m_pList->SetFillerNotify(pNotify); |
| 651 } | 648 } |
| OLD | NEW |