| 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 #ifndef XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ |
| 8 #define XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 FWL_Error Initialize() override; | 32 FWL_Error Initialize() override; |
| 33 FWL_Error Finalize() override; | 33 FWL_Error Finalize() override; |
| 34 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 34 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 35 FWL_Error Update() override; | 35 FWL_Error Update() override; |
| 36 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 36 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
| 37 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 37 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 38 const CFX_Matrix* pMatrix = nullptr) override; | 38 const CFX_Matrix* pMatrix = nullptr) override; |
| 39 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; | 39 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
| 40 | 40 |
| 41 int32_t CountSelItems(); | 41 int32_t CountSelItems(); |
| 42 FWL_HLISTITEM GetSelItem(int32_t nIndexSel); | 42 IFWL_ListItem* GetSelItem(int32_t nIndexSel); |
| 43 int32_t GetSelIndex(int32_t nIndex); | 43 int32_t GetSelIndex(int32_t nIndex); |
| 44 FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); | 44 FWL_Error SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect = TRUE); |
| 45 FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); | 45 FWL_Error GetItemText(IFWL_ListItem* hItem, CFX_WideString& wsText); |
| 46 FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); | 46 FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); |
| 47 FWL_Error* Sort(IFWL_ListBoxCompare* pCom); | 47 FWL_Error* Sort(IFWL_ListBoxCompare* pCom); |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 friend class CFWL_ListBoxImpDelegate; | 50 friend class CFWL_ListBoxImpDelegate; |
| 51 | 51 |
| 52 FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); | 52 IFWL_ListItem* GetItem(IFWL_ListItem* hItem, uint32_t dwKeyCode); |
| 53 void SetSelection(FWL_HLISTITEM hStart, | 53 void SetSelection(IFWL_ListItem* hStart, |
| 54 FWL_HLISTITEM hEnd, | 54 IFWL_ListItem* hEnd, |
| 55 FX_BOOL bSelected); | 55 FX_BOOL bSelected); |
| 56 void SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect); | 56 void SetSelectionDirect(IFWL_ListItem* hItem, FX_BOOL bSelect); |
| 57 FX_BOOL IsItemSelected(FWL_HLISTITEM hItem); | 57 FX_BOOL IsItemSelected(IFWL_ListItem* hItem); |
| 58 void ClearSelection(); | 58 void ClearSelection(); |
| 59 void SelectAll(); | 59 void SelectAll(); |
| 60 FWL_HLISTITEM GetFocusedItem(); | 60 IFWL_ListItem* GetFocusedItem(); |
| 61 void SetFocusItem(FWL_HLISTITEM hItem); | 61 void SetFocusItem(IFWL_ListItem* hItem); |
| 62 FWL_HLISTITEM GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); | 62 IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); |
| 63 FX_BOOL GetItemCheckRect(FWL_HLISTITEM hItem, CFX_RectF& rtCheck); | 63 FX_BOOL GetItemCheckRect(IFWL_ListItem* hItem, CFX_RectF& rtCheck); |
| 64 FX_BOOL SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked); | 64 FX_BOOL SetItemChecked(IFWL_ListItem* hItem, FX_BOOL bChecked); |
| 65 FX_BOOL GetItemChecked(FWL_HLISTITEM hItem); | 65 FX_BOOL GetItemChecked(IFWL_ListItem* hItem); |
| 66 FX_BOOL ScrollToVisible(FWL_HLISTITEM hItem); | 66 FX_BOOL ScrollToVisible(IFWL_ListItem* hItem); |
| 67 void DrawBkground(CFX_Graphics* pGraphics, | 67 void DrawBkground(CFX_Graphics* pGraphics, |
| 68 IFWL_ThemeProvider* pTheme, | 68 IFWL_ThemeProvider* pTheme, |
| 69 const CFX_Matrix* pMatrix = NULL); | 69 const CFX_Matrix* pMatrix = NULL); |
| 70 void DrawItems(CFX_Graphics* pGraphics, | 70 void DrawItems(CFX_Graphics* pGraphics, |
| 71 IFWL_ThemeProvider* pTheme, | 71 IFWL_ThemeProvider* pTheme, |
| 72 const CFX_Matrix* pMatrix = NULL); | 72 const CFX_Matrix* pMatrix = NULL); |
| 73 void DrawItem(CFX_Graphics* pGraphics, | 73 void DrawItem(CFX_Graphics* pGraphics, |
| 74 IFWL_ThemeProvider* pTheme, | 74 IFWL_ThemeProvider* pTheme, |
| 75 FWL_HLISTITEM hItem, | 75 IFWL_ListItem* hItem, |
| 76 int32_t Index, | 76 int32_t Index, |
| 77 const CFX_RectF& rtItem, | 77 const CFX_RectF& rtItem, |
| 78 const CFX_Matrix* pMatrix = NULL); | 78 const CFX_Matrix* pMatrix = NULL); |
| 79 void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); | 79 void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); |
| 80 CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE); | 80 CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE); |
| 81 void GetItemSize(CFX_SizeF& size, | 81 void GetItemSize(CFX_SizeF& size, |
| 82 FWL_HLISTITEM hItem, | 82 IFWL_ListItem* hItem, |
| 83 FX_FLOAT fWidth, | 83 FX_FLOAT fWidth, |
| 84 FX_FLOAT fHeight, | 84 FX_FLOAT fHeight, |
| 85 FX_BOOL bAutoSize = FALSE); | 85 FX_BOOL bAutoSize = FALSE); |
| 86 FX_FLOAT GetMaxTextWidth(); | 86 FX_FLOAT GetMaxTextWidth(); |
| 87 FX_FLOAT GetScrollWidth(); | 87 FX_FLOAT GetScrollWidth(); |
| 88 FX_FLOAT GetItemHeigt(); | 88 FX_FLOAT GetItemHeigt(); |
| 89 void InitScrollBar(FX_BOOL bVert = TRUE); | 89 void InitScrollBar(FX_BOOL bVert = TRUE); |
| 90 FX_BOOL IsShowScrollBar(FX_BOOL bVert); | 90 FX_BOOL IsShowScrollBar(FX_BOOL bVert); |
| 91 void ProcessSelChanged(); | 91 void ProcessSelChanged(); |
| 92 | 92 |
| 93 CFX_RectF m_rtClient; | 93 CFX_RectF m_rtClient; |
| 94 CFX_RectF m_rtStatic; | 94 CFX_RectF m_rtStatic; |
| 95 CFX_RectF m_rtConent; | 95 CFX_RectF m_rtConent; |
| 96 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; | 96 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; |
| 97 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; | 97 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; |
| 98 uint32_t m_dwTTOStyles; | 98 uint32_t m_dwTTOStyles; |
| 99 int32_t m_iTTOAligns; | 99 int32_t m_iTTOAligns; |
| 100 FWL_HLISTITEM m_hAnchor; | 100 IFWL_ListItem* m_hAnchor; |
| 101 FX_FLOAT m_fItemHeight; | 101 FX_FLOAT m_fItemHeight; |
| 102 FX_FLOAT m_fScorllBarWidth; | 102 FX_FLOAT m_fScorllBarWidth; |
| 103 FX_BOOL m_bLButtonDown; | 103 FX_BOOL m_bLButtonDown; |
| 104 IFWL_ThemeProvider* m_pScrollBarTP; | 104 IFWL_ThemeProvider* m_pScrollBarTP; |
| 105 }; | 105 }; |
| 106 class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { | 106 class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { |
| 107 public: | 107 public: |
| 108 CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); | 108 CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); |
| 109 void OnProcessMessage(CFWL_Message* pMessage) override; | 109 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 110 void OnProcessEvent(CFWL_Event* pEvent) override; | 110 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 111 void OnDrawWidget(CFX_Graphics* pGraphics, | 111 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 112 const CFX_Matrix* pMatrix = NULL) override; | 112 const CFX_Matrix* pMatrix = NULL) override; |
| 113 | 113 |
| 114 protected: | 114 protected: |
| 115 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 115 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
| 116 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 116 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 117 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 117 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 118 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); | 118 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); |
| 119 void OnKeyDown(CFWL_MsgKey* pMsg); | 119 void OnKeyDown(CFWL_MsgKey* pMsg); |
| 120 void OnVK(FWL_HLISTITEM hItem, FX_BOOL bShift, FX_BOOL bCtrl); | 120 void OnVK(IFWL_ListItem* hItem, FX_BOOL bShift, FX_BOOL bCtrl); |
| 121 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); | 121 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); |
| 122 void DispatchSelChangedEv(); | 122 void DispatchSelChangedEv(); |
| 123 CFWL_ListBoxImp* m_pOwner; | 123 CFWL_ListBoxImp* m_pOwner; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 #endif // XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ | 126 #endif // XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ |
| OLD | NEW |