OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_ | |
8 #define XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_ | |
9 | |
10 #include "xfa/fwl/basewidget/ifwl_listbox.h" | |
11 #include "xfa/fxgraphics/cfx_graphics.h" | |
12 | |
13 class CFWL_WidgetImpProperties; | |
14 class IFDE_TxtEdtDoRecord; | |
15 class IFWL_ComboBox; | |
16 | |
17 #define FWL_CLASS_ComboBox L"FWL_COMBOBOX" | |
18 #define FWL_STYLEEXT_CMB_DropList (0L << 0) | |
19 #define FWL_STYLEEXT_CMB_DropDown (1L << 0) | |
20 #define FWL_STYLEEXT_CMB_Sort (1L << 1) | |
21 #define FWL_STYLEEXT_CMB_ListDrag (1L << 2) | |
22 #define FWL_STYLEEXT_CMB_OwnerDraw (1L << 3) | |
23 #define FWL_STYLEEXT_CMB_EditHNear (0L << 4) | |
24 #define FWL_STYLEEXT_CMB_EditHCenter (1L << 4) | |
25 #define FWL_STYLEEXT_CMB_EditHFar (2L << 4) | |
26 #define FWL_STYLEEXT_CMB_EditVNear (0L << 6) | |
27 #define FWL_STYLEEXT_CMB_EditVCenter (1L << 6) | |
28 #define FWL_STYLEEXT_CMB_EditVFar (2L << 6) | |
29 #define FWL_STYLEEXT_CMB_EditJustified (1L << 8) | |
30 #define FWL_STYLEEXT_CMB_EditDistributed (2L << 8) | |
31 #define FWL_STYLEEXT_CMB_EditHAlignMask (3L << 4) | |
32 #define FWL_STYLEEXT_CMB_EditVAlignMask (3L << 6) | |
33 #define FWL_STYLEEXT_CMB_EditHAlignModeMask (3L << 8) | |
34 #define FWL_STYLEEXT_CMB_ListItemLeftAlign (0L << 10) | |
35 #define FWL_STYLEEXT_CMB_ListItemCenterAlign (1L << 10) | |
36 #define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10) | |
37 #define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10) | |
38 #define FWL_STYLEEXT_CMB_ListItemText (0L << 12) | |
39 #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) | |
40 #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) | |
41 | |
42 FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown) | |
43 | |
44 FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown) | |
45 | |
46 FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, CFWL_EventType::CloseUp) | |
47 | |
48 FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, | |
49 CFWL_EventType::EditChanged, | |
50 int32_t nChangeType; | |
51 CFX_WideString wsInsert; | |
52 CFX_WideString wsDelete;) | |
53 | |
54 FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, | |
55 CFWL_EventType::SelectChanged, | |
56 CFX_Int32Array iArraySels; | |
57 FX_BOOL bLButtonUp;) | |
58 | |
59 FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, | |
60 CFWL_EventType::HoverChanged, | |
61 int32_t m_iCurHover;) | |
62 | |
63 FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, | |
64 CFWL_EventType::DrawItem, | |
65 CFX_Graphics* m_pGraphics; | |
66 CFX_Matrix m_matrix; | |
67 int32_t m_index; | |
68 CFX_RectF m_rtItem;) | |
69 | |
70 class IFWL_ComboBoxDP : public IFWL_ListBoxDP { | |
71 public: | |
72 virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0; | |
73 }; | |
74 | |
75 class IFWL_ComboBox : public IFWL_Widget { | |
76 public: | |
77 static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties); | |
78 | |
79 int32_t GetCurSel(); | |
80 FWL_Error SetCurSel(int32_t iSel); | |
81 FWL_Error SetEditText(const CFX_WideString& wsText); | |
82 int32_t GetEditTextLength() const; | |
83 FWL_Error GetEditText(CFX_WideString& wsText, | |
84 int32_t nStart = 0, | |
85 int32_t nCount = -1) const; | |
86 FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); | |
87 int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); | |
88 int32_t GetEditLimit(); | |
89 FWL_Error SetEditLimit(int32_t nLimit); | |
90 FWL_Error EditDoClipboard(int32_t iCmd); | |
91 FX_BOOL EditRedo(const IFDE_TxtEdtDoRecord* pRecord); | |
92 FX_BOOL EditUndo(const IFDE_TxtEdtDoRecord* pRecord); | |
93 IFWL_ListBox* GetListBoxt(); | |
94 FX_BOOL AfterFocusShowDropList(); | |
95 FWL_Error OpenDropDownList(FX_BOOL bActivate); | |
96 FX_BOOL EditCanUndo(); | |
97 FX_BOOL EditCanRedo(); | |
98 FX_BOOL EditUndo(); | |
99 FX_BOOL EditRedo(); | |
100 FX_BOOL EditCanCopy(); | |
101 FX_BOOL EditCanCut(); | |
102 FX_BOOL EditCanSelectAll(); | |
103 FX_BOOL EditCopy(CFX_WideString& wsCopy); | |
104 FX_BOOL EditCut(CFX_WideString& wsCut); | |
105 FX_BOOL EditPaste(const CFX_WideString& wsPaste); | |
106 FX_BOOL EditSelectAll(); | |
107 FX_BOOL EditDelete(); | |
108 FX_BOOL EditDeSelect(); | |
109 FWL_Error GetBBox(CFX_RectF& rect); | |
110 FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, | |
111 uint32_t dwStylesExRemoved); | |
112 | |
113 protected: | |
114 IFWL_ComboBox(); | |
115 }; | |
116 | |
117 #endif // XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_ | |
OLD | NEW |