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/PDFWindow.h" | |
8 #include "fpdfsdk/include/pdfwindow/PWL_IconList.h" | 7 #include "fpdfsdk/include/pdfwindow/PWL_IconList.h" |
| 8 |
9 #include "fpdfsdk/include/pdfwindow/PWL_Label.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Label.h" |
10 #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" |
11 #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" | 11 #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.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 | 15 |
15 #define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f | 16 #define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f |
16 #define PWL_IconList_ITEM_WIDTH 20.0f | 17 #define PWL_IconList_ITEM_WIDTH 20.0f |
17 #define PWL_IconList_ITEM_HEIGHT 20.0f | 18 #define PWL_IconList_ITEM_HEIGHT 20.0f |
18 #define PWL_IconList_ITEM_SPACE 4.0f | 19 #define PWL_IconList_ITEM_SPACE 4.0f |
19 | 20 |
20 /* ------------------ CPWL_IconList_Item ------------------- */ | |
21 | |
22 CPWL_IconList_Item::CPWL_IconList_Item() | 21 CPWL_IconList_Item::CPWL_IconList_Item() |
23 : m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) {} | 22 : m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) {} |
24 | 23 |
25 CPWL_IconList_Item::~CPWL_IconList_Item() {} | 24 CPWL_IconList_Item::~CPWL_IconList_Item() {} |
26 | 25 |
27 CFX_ByteString CPWL_IconList_Item::GetClassName() const { | 26 CFX_ByteString CPWL_IconList_Item::GetClassName() const { |
28 return "CPWL_IconList_Item"; | 27 return "CPWL_IconList_Item"; |
29 } | 28 } |
30 | 29 |
31 FX_FLOAT CPWL_IconList_Item::GetItemHeight(FX_FLOAT fLimitWidth) { | 30 FX_FLOAT CPWL_IconList_Item::GetItemHeight(FX_FLOAT fLimitWidth) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 120 |
122 InvalidateRect(); | 121 InvalidateRect(); |
123 } | 122 } |
124 | 123 |
125 void CPWL_IconList_Item::OnDisabled() { | 124 void CPWL_IconList_Item::OnDisabled() { |
126 m_pText->SetTextColor(PWL_DEFAULT_HEAVYGRAYCOLOR); | 125 m_pText->SetTextColor(PWL_DEFAULT_HEAVYGRAYCOLOR); |
127 | 126 |
128 InvalidateRect(); | 127 InvalidateRect(); |
129 } | 128 } |
130 | 129 |
131 /* ----------------- CPWL_IconList_Content ----------------- */ | |
132 | |
133 CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) | 130 CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) |
134 : m_nSelectIndex(-1), | 131 : m_nSelectIndex(-1), |
135 m_pNotify(NULL), | 132 m_pNotify(NULL), |
136 m_bEnableNotify(TRUE), | 133 m_bEnableNotify(TRUE), |
137 m_bMouseDown(FALSE), | 134 m_bMouseDown(FALSE), |
138 m_nListCount(nListCount) {} | 135 m_nListCount(nListCount) {} |
139 | 136 |
140 CPWL_IconList_Content::~CPWL_IconList_Content() {} | 137 CPWL_IconList_Content::~CPWL_IconList_Content() {} |
141 | 138 |
142 void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM& cp) { | 139 void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM& cp) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 338 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
342 if (pChild->GetClassName() == "CPWL_IconList_Item") { | 339 if (pChild->GetClassName() == "CPWL_IconList_Item") { |
343 CPWL_IconList_Item* pItem = (CPWL_IconList_Item*)pChild; | 340 CPWL_IconList_Item* pItem = (CPWL_IconList_Item*)pChild; |
344 pItem->SetIconFillColor(color); | 341 pItem->SetIconFillColor(color); |
345 pItem->InvalidateRect(); | 342 pItem->InvalidateRect(); |
346 } | 343 } |
347 } | 344 } |
348 } | 345 } |
349 } | 346 } |
350 | 347 |
351 /* -------------------- CPWL_IconList --------------------- */ | |
352 | |
353 CPWL_IconList::CPWL_IconList(int32_t nListCount) | 348 CPWL_IconList::CPWL_IconList(int32_t nListCount) |
354 : m_pListContent(NULL), m_nListCount(nListCount) {} | 349 : m_pListContent(NULL), m_nListCount(nListCount) {} |
355 | 350 |
356 CPWL_IconList::~CPWL_IconList() {} | 351 CPWL_IconList::~CPWL_IconList() {} |
357 | 352 |
358 void CPWL_IconList::RePosChildWnd() { | 353 void CPWL_IconList::RePosChildWnd() { |
359 CPWL_Wnd::RePosChildWnd(); | 354 CPWL_Wnd::RePosChildWnd(); |
360 | 355 |
361 if (m_pListContent) | 356 if (m_pListContent) |
362 m_pListContent->Move(GetClientRect(), TRUE, FALSE); | 357 m_pListContent->Move(GetClientRect(), TRUE, FALSE); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) | 491 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) |
497 pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, | 492 pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, |
498 (intptr_t)&ptNew.y); | 493 (intptr_t)&ptNew.y); |
499 | 494 |
500 return TRUE; | 495 return TRUE; |
501 } | 496 } |
502 } | 497 } |
503 | 498 |
504 return FALSE; | 499 return FALSE; |
505 } | 500 } |
OLD | NEW |