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