Initial commit.
[pdfium.git] / fpdfsdk / include / pdfwindow / PWL_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 _PWL_COMBOBOX_H_\r
8 #define _PWL_COMBOBOX_H_\r
9 \r
10 class CPWL_CBEdit : public CPWL_Edit\r
11 {\r
12 public:\r
13         CPWL_CBEdit(){};\r
14         virtual ~CPWL_CBEdit(){};\r
15 };\r
16 \r
17 class PWL_CLASS CPWL_CBListBox : public CPWL_ListBox\r
18 {\r
19 public:\r
20         CPWL_CBListBox(){};\r
21         virtual ~CPWL_CBListBox(){};\r
22 \r
23 public:\r
24         virtual FX_BOOL                         OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);\r
25 \r
26         virtual FX_BOOL                         OnKeyDown(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);\r
27         virtual FX_BOOL                         OnChar(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);\r
28 };\r
29 \r
30 #define PWL_COMBOBOX_BUTTON_WIDTH               13\r
31 \r
32 class CPWL_CBButton : public CPWL_Wnd\r
33 {\r
34 public:\r
35         CPWL_CBButton(){};\r
36         virtual ~CPWL_CBButton(){};\r
37 \r
38 public:\r
39         virtual void                            GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);\r
40         virtual void                            DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);\r
41 \r
42         virtual FX_BOOL                         OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);\r
43         virtual FX_BOOL                         OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);\r
44 \r
45 };\r
46 \r
47 class PWL_CLASS CPWL_ComboBox : public CPWL_Wnd  \r
48 {\r
49 public:\r
50         CPWL_ComboBox();\r
51         operator CPWL_Edit* ()          {return m_pEdit;}\r
52 \r
53 public:\r
54         virtual CFX_ByteString          GetClassName() const;\r
55         virtual void                            OnCreate(PWL_CREATEPARAM & cp);\r
56 \r
57         virtual FX_BOOL                         OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);       \r
58         virtual FX_BOOL                         OnChar(FX_WORD nChar, FX_DWORD nFlag);\r
59 \r
60         virtual void                            OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);\r
61 \r
62         virtual void                            CreateChildWnd(const PWL_CREATEPARAM & cp);\r
63         virtual void                            RePosChildWnd();\r
64 \r
65         virtual CPDF_Rect                       GetFocusRect() const;\r
66         \r
67         virtual void                            SetFocus();\r
68         virtual void                            KillFocus();\r
69 \r
70         FX_BOOL                                         IsModified() const;\r
71 \r
72 public: \r
73         void                                            SetFillerNotify(IPWL_Filler_Notify* pNotify);\r
74 \r
75         CFX_WideString                          GetText() const;\r
76         void                                            SetText(FX_LPCWSTR text);\r
77 \r
78         void                                            AddString(FX_LPCWSTR string);\r
79         FX_INT32                                        GetSelect() const;\r
80         void                                            SetSelect(FX_INT32 nItemIndex);\r
81 \r
82         void                                            SetEditSel(FX_INT32 nStartChar,FX_INT32 nEndChar);\r
83         void                                            GetEditSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar ) const;\r
84         void                                            Clear();\r
85         void                                            SelectAll();\r
86         FX_BOOL                                         IsPopup() const;\r
87 \r
88         void                                            SetSelectText();\r
89 \r
90 private:        \r
91         void                                            CreateEdit(const PWL_CREATEPARAM & cp);\r
92         void                                            CreateButton(const PWL_CREATEPARAM & cp);\r
93         void                                            CreateListBox(const PWL_CREATEPARAM & cp);\r
94 \r
95         void                                            SetPopup(FX_BOOL bPopup);\r
96         \r
97 private:\r
98         CPWL_CBEdit*                            m_pEdit;\r
99         CPWL_CBButton*                          m_pButton;\r
100         CPWL_CBListBox*                         m_pList;\r
101 \r
102         FX_BOOL                                         m_bPopup;\r
103         CPDF_Rect                                       m_rcOldWindow;\r
104         FX_INT32                                        m_nPopupWhere;\r
105         FX_INT32                                        m_nSelectItem;\r
106         IPWL_Filler_Notify*                     m_pFillerNotify;\r
107 \r
108 public:\r
109         void                                                    AttachFFLData(void* pData) {m_pFormFiller = pData;}\r
110 private:\r
111         void*                                                   m_pFormFiller;\r
112 };\r
113 \r
114 #endif // !defined(AFX_PWL_COMBOBOX_H__9D6645F8_64AA_4806_94E8_95FDEDD39C17__INCLUDED_)\r
115 \r