Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / include / fwl / lightwidget / 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_LIGHT_H\r
8 #define _FWL_COMBOBOX_LIGHT_H\r
9 class CFWL_Widget;\r
10 class CFWL_WidgetProperties;\r
11 class IFWL_ComboBoxDP;\r
12 class CFWL_ComboBox;\r
13 class CFWL_ComboBoxDP;\r
14 class CFWL_ComboBoxItem;\r
15 class CFWL_ComboBox : public CFWL_Widget\r
16 {\r
17 public:\r
18     static CFWL_ComboBox* Create();\r
19     FWL_ERR             Initialize(const CFWL_WidgetProperties *pProperties = NULL);\r
20     FX_INT32    AddString(FX_WSTR wsText);\r
21     FX_INT32    AddString(FX_WSTR wsText, CFX_DIBitmap *pIcon);\r
22     FX_INT32    RemoveAt(FX_INT32 iIndex);\r
23     FX_INT32    RemoveAll();\r
24     FX_INT32    CountItems();\r
25     FWL_ERR             GetTextByIndex(FX_INT32 iIndex, CFX_WideString &wsText);\r
26     FX_INT32    GetCurSel();\r
27     FWL_ERR             SetCurSel(FX_INT32 iSel);\r
28     FWL_ERR             SetEditText(FX_WSTR wsText);\r
29     FX_INT32    GetEditTextLength() const;\r
30     FWL_ERR             GetEditText(CFX_WideString &wsText, FX_INT32 nStart = 0, FX_INT32 nCount = -1) const ;\r
31     FWL_ERR             SetEditSelRange(FX_INT32 nStart, FX_INT32 nCount = -1);\r
32     FX_INT32    GetEditSelRange(FX_INT32 nIndex, FX_INT32 &nStart);\r
33     FX_INT32    GetEditLimit();\r
34     FWL_ERR             SetEditLimit(FX_INT32 nLimit);\r
35     FWL_ERR             EditDoClipboard(FX_INT32 iCmd);\r
36     FX_BOOL             EditRedo(FX_BSTR bsRecord);\r
37     FX_BOOL             EditUndo(FX_BSTR bsRecord);\r
38     FWL_ERR             SetMaxListHeight(FX_FLOAT fMaxHeight);\r
39     FWL_ERR             SetItemData(FX_INT32 iIndex, FX_LPVOID pData);\r
40     FX_LPVOID   GetItemData(FX_INT32 iIndex);\r
41     FWL_ERR             SetListTheme(IFWL_ThemeProvider *pTheme);\r
42     FX_BOOL             AfterFocusShowDropList();\r
43     FWL_ERR             OpenDropDownList(FX_BOOL bActivate);\r
44 public:\r
45     FX_BOOL             EditCanUndo();\r
46     FX_BOOL             EditCanRedo();\r
47     FX_BOOL             EditUndo();\r
48     FX_BOOL             EditRedo();\r
49     FX_BOOL             EditCanCopy();\r
50     FX_BOOL             EditCanCut();\r
51     FX_BOOL             EditCanSelectAll();\r
52     FX_BOOL             EditCopy(CFX_WideString &wsCopy);\r
53     FX_BOOL             EditCut(CFX_WideString &wsCut);\r
54     FX_BOOL             EditPaste(const CFX_WideString &wsPaste);\r
55     FX_BOOL             EditSelectAll();\r
56     FX_BOOL             EditDelete();\r
57     FX_BOOL             EditDeSelect();\r
58     FWL_ERR             GetBBox(CFX_RectF &rect);\r
59     FWL_ERR             EditModifyStylesEx(FX_DWORD dwStylesExAdded, FX_DWORD dwStylesExRemoved);\r
60     CFWL_ComboBox();\r
61     virtual ~CFWL_ComboBox();\r
62 protected:\r
63     class CFWL_ComboBoxDP : public IFWL_ComboBoxDP\r
64     {\r
65     public:\r
66         CFWL_ComboBoxDP();\r
67         ~CFWL_ComboBoxDP();\r
68         virtual FWL_ERR                 GetCaption(IFWL_Widget *pWidget, CFX_WideString &wsCaption)\r
69         {\r
70             return FWL_ERR_Succeeded;\r
71         }\r
72 \r
73         virtual FX_INT32                CountItems(IFWL_Widget *pWidget);\r
74         virtual FWL_HLISTITEM   GetItem(IFWL_Widget *pWidget, FX_INT32 nIndex);\r
75         virtual FX_INT32                GetItemIndex(IFWL_Widget *pWidget, FWL_HLISTITEM hItem);\r
76         virtual FX_BOOL                 SetItemIndex(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, FX_INT32 nIndex);\r
77 \r
78         virtual FX_DWORD                GetItemStyles(IFWL_Widget *pWidget, FWL_HLISTITEM hItem);\r
79         virtual FWL_ERR                 GetItemText(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, CFX_WideString &wsText);\r
80         virtual FWL_ERR                 GetItemRect(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, CFX_RectF& rtItem);\r
81         virtual FX_LPVOID               GetItemData(IFWL_Widget *pWidget, FWL_HLISTITEM hItem);\r
82         virtual FWL_ERR                 SetItemStyles(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, FX_DWORD dwStyle);\r
83         virtual FWL_ERR                 SetItemText(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, FX_LPCWSTR pszText);\r
84         virtual FWL_ERR                 SetItemRect(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, const CFX_RectF& rtItem);\r
85         virtual FX_FLOAT                GetItemHeight(IFWL_Widget *pWidget);\r
86         virtual CFX_DIBitmap*   GetItemIcon(IFWL_Widget *pWidget, FWL_HLISTITEM hItem);\r
87         virtual FWL_ERR                 GetItemCheckRect(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, CFX_RectF& rtCheck);\r
88         virtual FWL_ERR                 SetItemCheckRect(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, const CFX_RectF& rtCheck);\r
89         virtual FX_DWORD                GetItemCheckState(IFWL_Widget *pWidget, FWL_HLISTITEM hItem);\r
90         virtual FWL_ERR                 SetItemCheckState(IFWL_Widget *pWidget, FWL_HLISTITEM hItem, FX_DWORD dwCheckState);\r
91         virtual FX_FLOAT                GetListHeight(IFWL_Widget *pWidget);\r
92 \r
93         CFX_PtrArray    m_arrItem;\r
94         FX_FLOAT                m_fMaxListHeight;\r
95         FX_FLOAT                m_fItemHeight;\r
96     };\r
97     CFWL_ComboBoxDP m_comboBoxData;\r
98 };\r
99 class CFWL_ComboBoxItem : public CFX_Object\r
100 {\r
101 public:\r
102     CFWL_ComboBoxItem()\r
103     {\r
104         m_pDIB = NULL;\r
105         m_pData = NULL;\r
106     }\r
107     CFX_RectF           m_rtItem;\r
108     FX_DWORD            m_dwStyles;\r
109     CFX_WideString      m_wsText;\r
110     CFX_DIBitmap        *m_pDIB;\r
111     FX_DWORD            m_dwCheckState;\r
112     CFX_RectF           m_rtCheckBox;\r
113     FX_LPVOID           m_pData;\r
114 };\r
115 #endif\r