| 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_IFWL_LISTBOX_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ |
| 8 #define XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ | 8 #define XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ |
| 9 | 9 |
| 10 #include "xfa/fwl/core/ifwl_widget.h" | 10 #include "xfa/fwl/core/ifwl_widget.h" |
| 11 #include "xfa/fwl/core/ifwl_dataprovider.h" | 11 #include "xfa/fwl/core/ifwl_dataprovider.h" |
| 12 #include "xfa/fwl/core/cfwl_event.h" | 12 #include "xfa/fwl/core/cfwl_event.h" |
| 13 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 13 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
| 14 | 14 |
| 15 #define FWL_CLASS_ListBox L"FWL_LISTBOX" | 15 #define FWL_CLASS_ListBox L"FWL_LISTBOX" |
| 16 #define FWL_CLASSHASH_ListBox 1777358317 | 16 #define FWL_CLASSHASH_ListBox 1777358317 |
| 17 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) | 17 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) |
| 18 #define FWL_STYLEEXT_LTB_Sort (1L << 1) | |
| 19 #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) | 18 #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) |
| 20 #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) | 19 #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) |
| 21 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) | 20 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) |
| 22 #define FWL_STYLEEXT_LTB_CenterAlign (1L << 4) | 21 #define FWL_STYLEEXT_LTB_CenterAlign (1L << 4) |
| 23 #define FWL_STYLEEXT_LTB_RightAlign (2L << 4) | 22 #define FWL_STYLEEXT_LTB_RightAlign (2L << 4) |
| 24 #define FWL_STYLEEXT_LTB_MultiLine (1L << 6) | 23 #define FWL_STYLEEXT_LTB_MultiLine (1L << 6) |
| 25 #define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7) | 24 #define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7) |
| 26 #define FWL_STYLEEXT_LTB_Icon (1L << 8) | 25 #define FWL_STYLEEXT_LTB_Icon (1L << 8) |
| 27 #define FWL_STYLEEXT_LTB_Check (1L << 9) | 26 #define FWL_STYLEEXT_LTB_Check (1L << 9) |
| 28 #define FWL_STYLEEXT_LTB_AlignMask (3L << 4) | 27 #define FWL_STYLEEXT_LTB_AlignMask (3L << 4) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 54 | 53 |
| 55 class IFWL_ListBoxDP : public IFWL_DataProvider { | 54 class IFWL_ListBoxDP : public IFWL_DataProvider { |
| 56 public: | 55 public: |
| 57 virtual int32_t CountItems(IFWL_Widget* pWidget) = 0; | 56 virtual int32_t CountItems(IFWL_Widget* pWidget) = 0; |
| 58 virtual FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex) = 0; | 57 virtual FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex) = 0; |
| 59 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; | 58 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; |
| 60 virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget, | 59 virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget, |
| 61 FWL_HLISTITEM hItem, | 60 FWL_HLISTITEM hItem, |
| 62 int32_t nIndex) = 0; | 61 int32_t nIndex) = 0; |
| 63 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; | 62 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; |
| 64 virtual FWL_ERR GetItemText(IFWL_Widget* pWidget, | 63 virtual FWL_Error GetItemText(IFWL_Widget* pWidget, |
| 65 FWL_HLISTITEM hItem, | 64 FWL_HLISTITEM hItem, |
| 66 CFX_WideString& wsText) = 0; | 65 CFX_WideString& wsText) = 0; |
| 67 virtual FWL_ERR GetItemRect(IFWL_Widget* pWidget, | 66 virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, |
| 68 FWL_HLISTITEM hItem, | 67 FWL_HLISTITEM hItem, |
| 69 CFX_RectF& rtItem) = 0; | 68 CFX_RectF& rtItem) = 0; |
| 70 virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; | 69 virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; |
| 71 virtual FWL_ERR SetItemStyles(IFWL_Widget* pWidget, | 70 virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, |
| 71 FWL_HLISTITEM hItem, |
| 72 uint32_t dwStyle) = 0; |
| 73 virtual FWL_Error SetItemText(IFWL_Widget* pWidget, |
| 72 FWL_HLISTITEM hItem, | 74 FWL_HLISTITEM hItem, |
| 73 uint32_t dwStyle) = 0; | 75 const FX_WCHAR* pszText) = 0; |
| 74 virtual FWL_ERR SetItemText(IFWL_Widget* pWidget, | 76 virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, |
| 75 FWL_HLISTITEM hItem, | 77 FWL_HLISTITEM hItem, |
| 76 const FX_WCHAR* pszText) = 0; | 78 const CFX_RectF& rtItem) = 0; |
| 77 virtual FWL_ERR SetItemRect(IFWL_Widget* pWidget, | |
| 78 FWL_HLISTITEM hItem, | |
| 79 const CFX_RectF& rtItem) = 0; | |
| 80 virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; | 79 virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; |
| 81 virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, | 80 virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, |
| 82 FWL_HLISTITEM hItem) = 0; | 81 FWL_HLISTITEM hItem) = 0; |
| 83 virtual FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget, | 82 virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, |
| 84 FWL_HLISTITEM hItem, | 83 FWL_HLISTITEM hItem, |
| 85 CFX_RectF& rtCheck) = 0; | 84 CFX_RectF& rtCheck) = 0; |
| 86 virtual FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget, | 85 virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, |
| 87 FWL_HLISTITEM hItem, | 86 FWL_HLISTITEM hItem, |
| 88 const CFX_RectF& rtCheck) = 0; | 87 const CFX_RectF& rtCheck) = 0; |
| 89 virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, | 88 virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, |
| 90 FWL_HLISTITEM hItem) = 0; | 89 FWL_HLISTITEM hItem) = 0; |
| 91 virtual FWL_ERR SetItemCheckState(IFWL_Widget* pWidget, | 90 virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, |
| 92 FWL_HLISTITEM hItem, | 91 FWL_HLISTITEM hItem, |
| 93 uint32_t dwCheckState) = 0; | 92 uint32_t dwCheckState) = 0; |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 class IFWL_ListBoxCompare { | 95 class IFWL_ListBoxCompare { |
| 97 public: | 96 public: |
| 98 virtual ~IFWL_ListBoxCompare() {} | 97 virtual ~IFWL_ListBoxCompare() {} |
| 99 virtual int32_t Compare(FWL_HLISTITEM hLeft, FWL_HLISTITEM hRight) = 0; | 98 virtual int32_t Compare(FWL_HLISTITEM hLeft, FWL_HLISTITEM hRight) = 0; |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 class IFWL_ListBox : public IFWL_Widget { | 101 class IFWL_ListBox : public IFWL_Widget { |
| 103 public: | 102 public: |
| 104 static IFWL_ListBox* Create(const CFWL_WidgetImpProperties& properties, | 103 static IFWL_ListBox* Create(const CFWL_WidgetImpProperties& properties, |
| 105 IFWL_Widget* pOuter); | 104 IFWL_Widget* pOuter); |
| 106 static IFWL_ListBox* CreateComboList( | 105 static IFWL_ListBox* CreateComboList( |
| 107 const CFWL_WidgetImpProperties& properties, | 106 const CFWL_WidgetImpProperties& properties, |
| 108 IFWL_Widget* pOuter); | 107 IFWL_Widget* pOuter); |
| 109 | 108 |
| 110 int32_t CountSelItems(); | 109 int32_t CountSelItems(); |
| 111 FWL_HLISTITEM GetSelItem(int32_t nIndexSel); | 110 FWL_HLISTITEM GetSelItem(int32_t nIndexSel); |
| 112 int32_t GetSelIndex(int32_t nIndex); | 111 int32_t GetSelIndex(int32_t nIndex); |
| 113 FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); | 112 FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); |
| 114 FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); | 113 FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); |
| 115 FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); | 114 FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); |
| 116 FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); | |
| 117 | 115 |
| 118 protected: | 116 protected: |
| 119 IFWL_ListBox(); | 117 IFWL_ListBox(); |
| 120 }; | 118 }; |
| 121 | 119 |
| 122 #endif // XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ | 120 #endif // XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ |
| OLD | NEW |