Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / include / fwl / basewidget / fwl_combobox.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FWL_COMBOBOX_H\r
8 #define _FWL_COMBOBOX_H\r
9 class CFWL_WidgetImpProperties;\r
10 class IFWL_Widget;\r
11 class IFWL_ListBox;\r
12 class IFWL_ComboBoxDP;\r
13 class IFWL_ComboBox;\r
14 #define FWL_CLASS_ComboBox                                      L"FWL_COMBOBOX"\r
15 #define FWL_CLASSHASH_ComboBox                          602353697\r
16 #define FWL_STYLEEXT_CMB_DropList                       (0L << 0)\r
17 #define FWL_STYLEEXT_CMB_DropDown                       (1L << 0)\r
18 #define FWL_STYLEEXT_CMB_Sort                           (1L << 1)\r
19 #define FWL_STYLEEXT_CMB_ListDrag                       (1L << 2)\r
20 #define FWL_STYLEEXT_CMB_OwnerDraw                      (1L << 3)\r
21 #define FWL_STYLEEXT_CMB_EditHNear                      (0L << 4)\r
22 #define FWL_STYLEEXT_CMB_EditHCenter            (1L << 4)\r
23 #define FWL_STYLEEXT_CMB_EditHFar                       (2L     << 4)\r
24 #define FWL_STYLEEXT_CMB_EditVNear                      (0L << 6)\r
25 #define FWL_STYLEEXT_CMB_EditVCenter            (1L << 6)\r
26 #define FWL_STYLEEXT_CMB_EditVFar                       (2L     << 6)\r
27 #define FWL_STYLEEXT_CMB_EditJustified          (1L << 8)\r
28 #define FWL_STYLEEXT_CMB_EditDistributed        (2L << 8)\r
29 #define FWL_STYLEEXT_CMB_EditHAlignMask         (3L << 4)\r
30 #define FWL_STYLEEXT_CMB_EditVAlignMask         (3L << 6)\r
31 #define FWL_STYLEEXT_CMB_EditHAlignModeMask     (3L << 8)\r
32 #define FWL_STYLEEXT_CMB_ListItemLeftAlign              (0L << 10)\r
33 #define FWL_STYLEEXT_CMB_ListItemCenterAlign    (1L << 10)\r
34 #define FWL_STYLEEXT_CMB_ListItemRightAlign             (2L << 10)\r
35 #define FWL_STYLEEXT_CMB_ListItemText           (0L << 12)\r
36 #define FWL_STYLEEXT_CMB_ListItemIconText               (1L << 12)\r
37 #define FWL_STYLEEXT_CMB_ListItemAlignMask              (3L << 12)\r
38 #define FWL_STYLEEXT_CMB_ReadOnly                               (1L << 13)\r
39 #define FWL_PART_CMB_Border                                     1\r
40 #define FWL_PART_CMB_Edge                                       2\r
41 #define FWL_PART_CMB_Background                         3\r
42 #define FWL_PART_CMB_DropDownButton                     4\r
43 #define FWL_PART_CMB_Caption                            5\r
44 #define FWL_PART_CMB_StretcgHandler                     6\r
45 #define FWL_PARTSTATE_CMB_Normal                        (0L << 0)\r
46 #define FWL_PARTSTATE_CMB_Hovered                       (1L << 0)\r
47 #define FWL_PARTSTATE_CMB_Pressed                       (2L << 0)\r
48 #define FWL_PARTSTATE_CMB_Disabled                      (3L << 0)\r
49 #define FWL_PARTSTATE_CMB_Selected                      (1L << 2)\r
50 #define FWL_WGTCAPACITY_CMB_ComboFormHandler    (FWL_WGTCAPACITY_MAX + 7)\r
51 enum FWL_CMB_TEXTCHANGED {\r
52     FWL_CMB_TEXTCHANGED_Insert  = 0     ,\r
53     FWL_CMB_TEXTCHANGED_Delete          ,\r
54     FWL_CMB_TEXTCHANGED_Replace         ,\r
55 };\r
56 #define FWL_EVT_CMB_DropDown                            L"FWL_EVENT_CMB_PreDropDown"\r
57 #define FWL_EVT_CMB_PostDropDown                        L"FWL_EVENT_CMB_PostDropDown"\r
58 #define FWL_EVT_CMB_CloseUp                                     L"FWL_EVENT_CMB_CloseUp"\r
59 #define FWL_EVT_CMB_EditChanged                         L"FWL_EVENT_CMB_EditChanged"\r
60 #define FWL_EVT_CMB_SelChanged                          L"FWL_EVENT_CMB_SelChanged"\r
61 #define FWL_EVT_CMB_HoverChanged                        L"FWL_EVENT_CMB_HoverChanged"\r
62 #define FWL_EVT_CMB_DrawItem                            L"FWL_EVENT_CMB_DrawItem"\r
63 #define FWL_EVTHASH_CMB_PreDropDown                     1357646798\r
64 #define FWL_EVTHASH_CMB_PostDropDown            3677010285\r
65 #define FWL_EVTHASH_CMB_CloseUp                         2871271190\r
66 #define FWL_EVTHASH_CMB_EditChanged                     1527034762\r
67 #define FWL_EVTHASH_CMB_SelChanged                      2923227784\r
68 #define FWL_EVTHASH_CMB_HoverChanged            944325448\r
69 #define FWL_EVTHASH_CMB_DrawItem                        917354551\r
70 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, FWL_EVTHASH_CMB_PreDropDown)\r
71 END_FWL_EVENT_DEF\r
72 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, FWL_EVTHASH_CMB_PostDropDown)\r
73 END_FWL_EVENT_DEF\r
74 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, FWL_EVTHASH_CMB_CloseUp)\r
75 END_FWL_EVENT_DEF\r
76 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, FWL_EVTHASH_CMB_EditChanged)\r
77 FX_INT32 nChangeType;\r
78 CFX_WideString wsInsert;\r
79 CFX_WideString wsDelete;\r
80 END_FWL_EVENT_DEF\r
81 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, FWL_EVTHASH_CMB_SelChanged)\r
82 CFX_Int32Array iArraySels;\r
83 FX_BOOL bLButtonUp;\r
84 END_FWL_EVENT_DEF\r
85 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, FWL_EVTHASH_CMB_HoverChanged)\r
86 FX_INT32 m_iCurHover;\r
87 END_FWL_EVENT_DEF\r
88 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, FWL_EVTHASH_CMB_DrawItem)\r
89 CFX_Graphics *m_pGraphics;\r
90 CFX_Matrix m_matrix;\r
91 FX_INT32 m_index;\r
92 CFX_RectF m_rtItem;\r
93 END_FWL_EVENT_DEF\r
94 class IFWL_ComboBoxDP : public IFWL_ListBoxDP\r
95 {\r
96 public:\r
97     virtual FX_FLOAT            GetListHeight(IFWL_Widget *pWidget) = 0;\r
98 };\r
99 class IFWL_ComboBox : public IFWL_Widget\r
100 {\r
101 public:\r
102     static IFWL_ComboBox* Create();\r
103     FWL_ERR             Initialize(IFWL_Widget *pOuter = NULL);\r
104     FWL_ERR             Initialize(const CFWL_WidgetImpProperties &properties, IFWL_Widget *pOuter = NULL);\r
105     FX_INT32    GetCurSel();\r
106     FWL_ERR             SetCurSel(FX_INT32 iSel);\r
107     FWL_ERR             SetEditText(const CFX_WideString &wsText);\r
108     FX_INT32    GetEditTextLength() const;\r
109     FWL_ERR             GetEditText(CFX_WideString &wsText, FX_INT32 nStart = 0, FX_INT32 nCount = -1) const;\r
110     FWL_ERR             SetEditSelRange(FX_INT32 nStart, FX_INT32 nCount = -1);\r
111     FX_INT32    GetEditSelRange(FX_INT32 nIndex, FX_INT32 &nStart);\r
112     FX_INT32    GetEditLimit();\r
113     FWL_ERR             SetEditLimit(FX_INT32 nLimit);\r
114     FWL_ERR             EditDoClipboard(FX_INT32 iCmd);\r
115     FX_BOOL             EditRedo(FX_BSTR bsRecord);\r
116     FX_BOOL             EditUndo(FX_BSTR bsRecord);\r
117     IFWL_ListBox*       GetListBoxt();\r
118     FX_BOOL             AfterFocusShowDropList();\r
119     FX_ERR              OpenDropDownList(FX_BOOL bActivate);\r
120     FX_BOOL             EditCanUndo();\r
121     FX_BOOL             EditCanRedo();\r
122     FX_BOOL             EditUndo();\r
123     FX_BOOL             EditRedo();\r
124     FX_BOOL             EditCanCopy();\r
125     FX_BOOL             EditCanCut();\r
126     FX_BOOL             EditCanSelectAll();\r
127     FX_BOOL             EditCopy(CFX_WideString &wsCopy);\r
128     FX_BOOL             EditCut(CFX_WideString &wsCut);\r
129     FX_BOOL             EditPaste(const CFX_WideString &wsPaste);\r
130     FX_BOOL             EditSelectAll();\r
131     FX_BOOL             EditDelete();\r
132     FX_BOOL             EditDeSelect();\r
133     FWL_ERR             GetBBox(CFX_RectF &rect);\r
134     FWL_ERR             EditModifyStylesEx(FX_DWORD dwStylesExAdded, FX_DWORD dwStylesExRemoved);\r
135 protected:\r
136     IFWL_ComboBox();\r
137     virtual ~IFWL_ComboBox();\r
138 };\r
139 #endif\r