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