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