diff options
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_IconList.cpp | 478 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_IconList.h | 115 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Label.cpp | 143 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Label.h | 45 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListCtrl.cpp | 205 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListCtrl.h | 48 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Signature.cpp | 178 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Signature.h | 67 |
8 files changed, 0 insertions, 1279 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_IconList.cpp b/fpdfsdk/pdfwindow/PWL_IconList.cpp deleted file mode 100644 index 26d6c92ea4..0000000000 --- a/fpdfsdk/pdfwindow/PWL_IconList.cpp +++ /dev/null @@ -1,478 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "fpdfsdk/pdfwindow/PWL_IconList.h" - -#include "fpdfsdk/pdfwindow/PWL_Label.h" -#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" -#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" -#include "fpdfsdk/pdfwindow/PWL_Utils.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" -#include "public/fpdf_fwlevent.h" - -#define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f -#define PWL_IconList_ITEM_WIDTH 20.0f -#define PWL_IconList_ITEM_HEIGHT 20.0f -#define PWL_IconList_ITEM_SPACE 4.0f - -CPWL_IconList_Item::CPWL_IconList_Item() - : m_nIconIndex(-1), - m_pData(nullptr), - m_bSelected(FALSE), - m_pText(nullptr) {} - -CPWL_IconList_Item::~CPWL_IconList_Item() {} - -CFX_ByteString CPWL_IconList_Item::GetClassName() const { - return "CPWL_IconList_Item"; -} - -FX_FLOAT CPWL_IconList_Item::GetItemHeight(FX_FLOAT fLimitWidth) { - return PWL_IconList_ITEM_HEIGHT; -} - -void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CFX_FloatRect rcClient = GetClientRect(); - - if (m_bSelected) { - if (IsEnabled()) { - CPWL_Utils::DrawFillRect( - pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR, - GetTransparency())); - } else { - CPWL_Utils::DrawFillRect( - pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR, - GetTransparency())); - } - } - - CFX_FloatRect rcIcon = rcClient; - rcIcon.left += PWL_IconList_ITEM_ICON_LEFTMARGIN; - rcIcon.right = rcIcon.left + PWL_IconList_ITEM_WIDTH; - - CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon, - m_crIcon, m_pText->GetTextColor(), - GetTransparency()); -} - -void CPWL_IconList_Item::SetSelect(FX_BOOL bSelected) { - m_bSelected = bSelected; - - if (bSelected) - m_pText->SetTextColor(PWL_DEFAULT_WHITECOLOR); - else - m_pText->SetTextColor(PWL_DEFAULT_BLACKCOLOR); -} - -FX_BOOL CPWL_IconList_Item::IsSelected() const { - return m_bSelected; -} - -void CPWL_IconList_Item::CreateChildWnd(const PWL_CREATEPARAM& cp) { - m_pText = new CPWL_Label; - - PWL_CREATEPARAM lcp = cp; - lcp.pParentWnd = this; - lcp.dwFlags = PWS_CHILD | PWS_VISIBLE | PES_LEFT | PES_CENTER; - lcp.sTextColor = PWL_DEFAULT_BLACKCOLOR; - lcp.fFontSize = 12; - m_pText->Create(lcp); -} - -void CPWL_IconList_Item::SetData(void* pData) { - m_pData = pData; -} - -void CPWL_IconList_Item::SetIcon(int32_t nIconIndex) { - m_nIconIndex = nIconIndex; -} - -void CPWL_IconList_Item::SetText(const CFX_WideString& str) { - m_pText->SetText(str.c_str()); -} - -CFX_WideString CPWL_IconList_Item::GetText() const { - return m_pText->GetText(); -} - -void CPWL_IconList_Item::RePosChildWnd() { - CFX_FloatRect rcClient = GetClientRect(); - - rcClient.left += - (PWL_IconList_ITEM_ICON_LEFTMARGIN + PWL_IconList_ITEM_WIDTH + - PWL_IconList_ITEM_ICON_LEFTMARGIN); - - m_pText->Move(rcClient, TRUE, FALSE); -} - -void CPWL_IconList_Item::SetIconFillColor(const CPWL_Color& color) { - m_crIcon = color; -} - -void CPWL_IconList_Item::OnEnabled() { - if (m_bSelected) - m_pText->SetTextColor(PWL_DEFAULT_WHITECOLOR); - else - m_pText->SetTextColor(PWL_DEFAULT_BLACKCOLOR); - - InvalidateRect(); -} - -void CPWL_IconList_Item::OnDisabled() { - m_pText->SetTextColor(PWL_DEFAULT_HEAVYGRAYCOLOR); - - InvalidateRect(); -} - -CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) - : m_nSelectIndex(-1), - m_bMouseDown(FALSE), - m_nListCount(nListCount) {} - -CPWL_IconList_Content::~CPWL_IconList_Content() {} - -void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM& cp) { - for (int32_t i = 0; i < m_nListCount; i++) { - CPWL_IconList_Item* pNewItem = new CPWL_IconList_Item(); - - PWL_CREATEPARAM icp = cp; - icp.pParentWnd = this; - icp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_NOREFRESHCLIP; - pNewItem->Create(icp); - } - - SetItemSpace(PWL_IconList_ITEM_SPACE); - ResetContent(0); - - if (CPWL_Wnd* pParent = GetParentWindow()) { - CFX_FloatRect rcScroll = GetScrollArea(); - GetScrollPos(); - - PWL_SCROLL_INFO sInfo; - sInfo.fContentMin = rcScroll.bottom; - sInfo.fContentMax = rcScroll.top; - sInfo.fPlateWidth = GetClientRect().Height(); - sInfo.fSmallStep = 13.0f; - sInfo.fBigStep = sInfo.fPlateWidth; - - pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo); - } -} - -FX_BOOL CPWL_IconList_Content::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { - SetFocus(); - - SetCapture(); - m_bMouseDown = TRUE; - - int32_t nItemIndex = FindItemIndex(point); - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - - return TRUE; -} - -FX_BOOL CPWL_IconList_Content::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { - m_bMouseDown = FALSE; - ReleaseCapture(); - - return TRUE; -} - -FX_BOOL CPWL_IconList_Content::OnMouseMove(const CFX_FloatPoint& point, - uint32_t nFlag) { - if (m_bMouseDown) { - int32_t nItemIndex = FindItemIndex(point); - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - } - - return TRUE; -} - -FX_BOOL CPWL_IconList_Content::OnKeyDown(uint16_t nChar, uint32_t nFlag) { - switch (nChar) { - case FWL_VKEY_Up: - if (m_nSelectIndex > 0) { - int32_t nItemIndex = m_nSelectIndex - 1; - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - } - return TRUE; - case FWL_VKEY_Down: - if (m_nSelectIndex < m_nListCount - 1) { - int32_t nItemIndex = m_nSelectIndex + 1; - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - } - return TRUE; - } - - return FALSE; -} - -int32_t CPWL_IconList_Content::FindItemIndex(const CFX_FloatPoint& point) { - int32_t nIndex = 0; - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - CFX_FloatRect rcWnd = pChild->ChildToParent(pChild->GetWindowRect()); - - if (point.y < rcWnd.top) { - nIndex = i; - } - } - } - - return nIndex; -} - -void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex) { - CFX_FloatRect rcClient = GetClientRect(); - - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { - CFX_FloatRect rcOrigin = pItem->GetWindowRect(); - CFX_FloatRect rcWnd = pItem->ChildToParent(rcOrigin); - - if (!(rcWnd.bottom > rcClient.bottom && rcWnd.top < rcClient.top)) { - CFX_FloatPoint ptScroll = GetScrollPos(); - - if (rcWnd.top > rcClient.top) { - ptScroll.y = rcOrigin.top; - } else if (rcWnd.bottom < rcClient.bottom) { - ptScroll.y = rcOrigin.bottom + rcClient.Height(); - } - - SetScrollPos(ptScroll); - ResetFace(); - InvalidateRect(); - if (CPWL_Wnd* pParent = GetParentWindow()) { - pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, - (intptr_t)&ptScroll.y); - } - } - } -} - -void CPWL_IconList_Content::SetSelect(int32_t nIndex) { - if (m_nSelectIndex == nIndex) - return; - - SelectItem(m_nSelectIndex, FALSE); - SelectItem(nIndex, TRUE); - m_nSelectIndex = nIndex; -} - -int32_t CPWL_IconList_Content::GetSelect() const { - return m_nSelectIndex; -} - -void CPWL_IconList_Content::SelectItem(int32_t nItemIndex, FX_BOOL bSelect) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { - pItem->SetSelect(bSelect); - pItem->InvalidateRect(); - } -} - -CPWL_IconList_Item* CPWL_IconList_Content::GetListItem( - int32_t nItemIndex) const { - if (nItemIndex >= 0 && nItemIndex < m_aChildren.GetSize()) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(nItemIndex)) { - if (pChild->GetClassName() == "CPWL_IconList_Item") { - return (CPWL_IconList_Item*)pChild; - } - } - } - - return nullptr; -} - -void CPWL_IconList_Content::SetListData(int32_t nItemIndex, void* pData) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - pItem->SetData(pData); -} - -void CPWL_IconList_Content::SetListIcon(int32_t nItemIndex, - int32_t nIconIndex) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - pItem->SetIcon(nIconIndex); -} - -void CPWL_IconList_Content::SetListString(int32_t nItemIndex, - const CFX_WideString& str) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - pItem->SetText(str); -} - -CFX_WideString CPWL_IconList_Content::GetListString(int32_t nItemIndex) const { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - return pItem->GetText(); - - return L""; -} - -void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) { - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - if (pChild->GetClassName() == "CPWL_IconList_Item") { - CPWL_IconList_Item* pItem = (CPWL_IconList_Item*)pChild; - pItem->SetIconFillColor(color); - pItem->InvalidateRect(); - } - } - } -} - -CPWL_IconList::CPWL_IconList(int32_t nListCount) - : m_pListContent(nullptr), m_nListCount(nListCount) {} - -CPWL_IconList::~CPWL_IconList() {} - -void CPWL_IconList::RePosChildWnd() { - CPWL_Wnd::RePosChildWnd(); - - if (m_pListContent) - m_pListContent->Move(GetClientRect(), TRUE, FALSE); -} - -void CPWL_IconList::CreateChildWnd(const PWL_CREATEPARAM& cp) { - m_pListContent = new CPWL_IconList_Content(m_nListCount); - - PWL_CREATEPARAM ccp = cp; - ccp.pParentWnd = this; - ccp.dwFlags = PWS_CHILD | PWS_VISIBLE; - m_pListContent->Create(ccp); -} - -void CPWL_IconList::OnCreated() { - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { - pScrollBar->RemoveFlag(PWS_AUTOTRANSPARENT); - pScrollBar->SetTransparency(255); - pScrollBar->SetNotifyForever(TRUE); - } -} - -void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, - uint32_t msg, - intptr_t wParam, - intptr_t lParam) { - CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); - - if (wParam == SBT_VSCROLL) { - switch (msg) { - case PNM_SETSCROLLINFO: - if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { - if (pInfo->fContentMax - pInfo->fContentMin > pInfo->fPlateWidth) { - if (!pScrollBar->IsVisible()) { - pScrollBar->SetVisible(TRUE); - RePosChildWnd(); - } else { - } - } else { - if (pScrollBar->IsVisible()) { - pScrollBar->SetVisible(FALSE); - RePosChildWnd(); - } - - if (m_pListContent) - m_pListContent->SetScrollPos(CFX_FloatPoint(0.0f, 0.0f)); - } - - pScrollBar->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam); - } - } - return; - case PNM_SCROLLWINDOW: - if (m_pListContent) { - m_pListContent->SetScrollPos( - CFX_FloatPoint(0.0f, *(FX_FLOAT*)lParam)); - m_pListContent->ResetFace(); - m_pListContent->InvalidateRect(nullptr); - } - return; - case PNM_SETSCROLLPOS: - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) - pScrollBar->OnNotify(pWnd, PNM_SETSCROLLPOS, wParam, lParam); - return; - } - } -} - -void CPWL_IconList::SetSelect(int32_t nIndex) { - m_pListContent->SetSelect(nIndex); -} - -void CPWL_IconList::SetTopItem(int32_t nIndex) { - m_pListContent->ScrollToItem(nIndex); -} - -int32_t CPWL_IconList::GetSelect() const { - return m_pListContent->GetSelect(); -} - -void CPWL_IconList::SetListData(int32_t nItemIndex, void* pData) { - m_pListContent->SetListData(nItemIndex, pData); -} - -void CPWL_IconList::SetListIcon(int32_t nItemIndex, int32_t nIconIndex) { - m_pListContent->SetListIcon(nItemIndex, nIconIndex); -} - -void CPWL_IconList::SetListString(int32_t nItemIndex, - const CFX_WideString& str) { - m_pListContent->SetListString(nItemIndex, str); -} - -CFX_WideString CPWL_IconList::GetListString(int32_t nItemIndex) const { - return m_pListContent->GetListString(nItemIndex); -} - -void CPWL_IconList::SetIconFillColor(const CPWL_Color& color) { - m_pListContent->SetIconFillColor(color); -} - -FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { - CFX_FloatPoint ptScroll = m_pListContent->GetScrollPos(); - CFX_FloatRect rcScroll = m_pListContent->GetScrollArea(); - CFX_FloatRect rcContents = m_pListContent->GetClientRect(); - - if (rcScroll.top - rcScroll.bottom > rcContents.Height()) { - CFX_FloatPoint ptNew = ptScroll; - - if (zDelta > 0) - ptNew.y += 30; - else - ptNew.y -= 30; - - if (ptNew.y > rcScroll.top) - ptNew.y = rcScroll.top; - if (ptNew.y < rcScroll.bottom + rcContents.Height()) - ptNew.y = rcScroll.bottom + rcContents.Height(); - if (ptNew.y < rcScroll.bottom) - ptNew.y = rcScroll.bottom; - - if (ptNew.y != ptScroll.y) { - m_pListContent->SetScrollPos(ptNew); - m_pListContent->ResetFace(); - m_pListContent->InvalidateRect(nullptr); - - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) - pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, - (intptr_t)&ptNew.y); - - return TRUE; - } - } - - return FALSE; -} diff --git a/fpdfsdk/pdfwindow/PWL_IconList.h b/fpdfsdk/pdfwindow/PWL_IconList.h deleted file mode 100644 index 901f4de976..0000000000 --- a/fpdfsdk/pdfwindow/PWL_IconList.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ -#define FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ - -#include "core/fxcrt/include/fx_string.h" -#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class CPWL_IconList_Item; -class CPWL_IconList_Content; -class CPWL_IconList; -class CPWL_Label; - -class CPWL_IconList_Item : public CPWL_Wnd { - public: - CPWL_IconList_Item(); - ~CPWL_IconList_Item() override; - - void SetSelect(FX_BOOL bSelected); - FX_BOOL IsSelected() const; - void SetData(void* pData); - void SetIcon(int32_t nIconIndex); - void SetText(const CFX_WideString& str); - void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetText() const; - - protected: - // CPWL_Wnd - CFX_ByteString GetClassName() const override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - void RePosChildWnd() override; - FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void OnEnabled() override; - void OnDisabled() override; - - private: - int32_t m_nIconIndex; - void* m_pData; - FX_BOOL m_bSelected; - CPWL_Label* m_pText; - CPWL_Color m_crIcon; -}; - -class CPWL_IconList_Content : public CPWL_ListCtrl { - public: - CPWL_IconList_Content(int32_t nListCount); - ~CPWL_IconList_Content() override; - - void SetSelect(int32_t nIndex); - int32_t GetSelect() const; - void SetListData(int32_t nItemIndex, void* pData); - void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); - void SetListString(int32_t nItemIndex, const CFX_WideString& str); - void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetListString(int32_t nItemIndex) const; - void ScrollToItem(int32_t nItemIndex); - - protected: - // CPWL_ListCtrl - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - - private: - CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; - void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); - int32_t FindItemIndex(const CFX_FloatPoint& point); - - int32_t m_nSelectIndex; - FX_BOOL m_bMouseDown; - int32_t m_nListCount; -}; - -class CPWL_IconList : public CPWL_Wnd { - public: - CPWL_IconList(int32_t nListCount); - ~CPWL_IconList() override; - - void SetSelect(int32_t nIndex); - void SetTopItem(int32_t nIndex); - int32_t GetSelect() const; - void SetListData(int32_t nItemIndex, void* pData); - void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); - void SetListString(int32_t nItemIndex, const CFX_WideString& str); - void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetListString(int32_t nItemIndex) const; - - protected: - // CPWL_Wnd - FX_BOOL OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) override; - void OnCreated() override; - void RePosChildWnd() override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - void OnNotify(CPWL_Wnd* pWnd, - uint32_t msg, - intptr_t wParam = 0, - intptr_t lParam = 0) override; - - private: - CPWL_IconList_Content* m_pListContent; - int32_t m_nListCount; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp deleted file mode 100644 index 83d299cd34..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Label.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "fpdfsdk/fxedit/include/fx_edit.h" -#include "fpdfsdk/pdfwindow/PWL_Label.h" -#include "fpdfsdk/pdfwindow/PWL_Utils.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -CPWL_Label::CPWL_Label() : m_pEdit(IFX_Edit::NewEdit()) {} - -CPWL_Label::~CPWL_Label() { - IFX_Edit::DelEdit(m_pEdit); -} - -CFX_ByteString CPWL_Label::GetClassName() const { - return "CPWL_Label"; -} - -void CPWL_Label::OnCreated() { - SetParamByFlag(); - SetFontSize(GetCreationParam().fFontSize); - - m_pEdit->SetFontMap(GetFontMap()); - m_pEdit->Initialize(); - - if (HasFlag(PES_TEXTOVERFLOW)) { - SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); - m_pEdit->SetTextOverflow(TRUE); - } -} - -void CPWL_Label::SetText(const FX_WCHAR* csText) { - m_pEdit->SetText(csText); -} - -void CPWL_Label::RePosChildWnd() { - m_pEdit->SetPlateRect(GetClientRect()); -} - -void CPWL_Label::SetFontSize(FX_FLOAT fFontSize) { - m_pEdit->SetFontSize(fFontSize); -} - -FX_FLOAT CPWL_Label::GetFontSize() const { - return m_pEdit->GetFontSize(); -} - -void CPWL_Label::SetParamByFlag() { - if (HasFlag(PES_LEFT)) { - m_pEdit->SetAlignmentH(0); - } else if (HasFlag(PES_MIDDLE)) { - m_pEdit->SetAlignmentH(1); - } else if (HasFlag(PES_RIGHT)) { - m_pEdit->SetAlignmentH(2); - } else { - m_pEdit->SetAlignmentH(0); - } - - if (HasFlag(PES_TOP)) { - m_pEdit->SetAlignmentV(0); - } else if (HasFlag(PES_CENTER)) { - m_pEdit->SetAlignmentV(1); - } else if (HasFlag(PES_BOTTOM)) { - m_pEdit->SetAlignmentV(2); - } else { - m_pEdit->SetAlignmentV(0); - } - - if (HasFlag(PES_PASSWORD)) { - m_pEdit->SetPasswordChar('*'); - } - - m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE)); - m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN)); - m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE)); - m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL)); -} - -void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); - - GetClientRect(); - - CFX_FloatRect rcClip; - CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange(); - CPVT_WordRange* pRange = nullptr; - - if (!HasFlag(PES_TEXTOVERFLOW)) { - rcClip = GetClientRect(); - pRange = &wrRange; - } - CFX_SystemHandler* pSysHandler = GetSystemHandler(); - IFX_Edit::DrawEdit( - pDevice, pUser2Device, m_pEdit, - CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_FloatPoint(0.0f, 0.0f), pRange, pSysHandler, nullptr); -} - -void CPWL_Label::SetHorzScale(int32_t nHorzScale) { - m_pEdit->SetHorzScale(nHorzScale); -} - -void CPWL_Label::SetCharSpace(FX_FLOAT fCharSpace) { - m_pEdit->SetCharSpace(fCharSpace); -} - -CFX_FloatRect CPWL_Label::GetContentRect() const { - return m_pEdit->GetContentRect(); -} - -void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - CPWL_Wnd::GetThisAppearanceStream(sAppStream); - - sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f)).AsStringC(); -} - -CFX_ByteString CPWL_Label::GetTextAppearanceStream( - const CFX_FloatPoint& ptOffset) const { - CFX_ByteTextBuf sRet; - CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset); - if (sEdit.GetLength() > 0) { - sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() - << sEdit.AsStringC() << "ET\n"; - } - return sRet.MakeString(); -} - -CFX_WideString CPWL_Label::GetText() const { - return m_pEdit->GetText(); -} - -void CPWL_Label::SetLimitChar(int32_t nLimitChar) { - m_pEdit->SetLimitChar(nLimitChar); -} - -int32_t CPWL_Label::GetTotalWords() { - return m_pEdit->GetTotalWords(); -} diff --git a/fpdfsdk/pdfwindow/PWL_Label.h b/fpdfsdk/pdfwindow/PWL_Label.h deleted file mode 100644 index 7b5a3e52f7..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Label.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_PDFWINDOW_PWL_LABEL_H_ -#define FPDFSDK_PDFWINDOW_PWL_LABEL_H_ - -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class IFX_Edit; - -class CPWL_Label : public CPWL_Wnd { - public: - CPWL_Label(); - ~CPWL_Label() override; - - void SetText(const FX_WCHAR* csText); - CFX_WideString GetText() const; - void SetLimitChar(int32_t nLimitChar); - void SetHorzScale(int32_t nHorzScale); - void SetCharSpace(FX_FLOAT fCharSpace); - CFX_FloatRect GetContentRect() const; - int32_t GetTotalWords(); - CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; - - protected: - // CPWL_Wnd - CFX_ByteString GetClassName() const override; - void SetFontSize(FX_FLOAT fFontSize) override; - FX_FLOAT GetFontSize() const override; - void OnCreated() override; - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; - void RePosChildWnd() override; - - private: - void SetParamByFlag(); - - IFX_Edit* m_pEdit; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_LABEL_H_ diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp deleted file mode 100644 index dde2160943..0000000000 --- a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/fxge/include/fx_ge.h" -#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -CPWL_ListCtrl::CPWL_ListCtrl() - : m_rcContent(0, 0, 0, 0), - m_ptScroll(0, 0), - m_fItemSpace(0.0f), - m_fTopSpace(0.0f), - m_fBottomSpace(0.0f) {} - -CPWL_ListCtrl::~CPWL_ListCtrl() {} - -void CPWL_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) { - m_ptScroll = point; - - if (m_ptScroll.x < m_rcContent.left) - m_ptScroll.x = m_rcContent.left; - - if (m_ptScroll.x > m_rcContent.right) - m_ptScroll.x = m_rcContent.right; - - if (m_ptScroll.y > m_rcContent.top) - m_ptScroll.y = m_rcContent.top; - - if (m_ptScroll.y < m_rcContent.bottom) - m_ptScroll.y = m_rcContent.bottom; -} - -CFX_FloatPoint CPWL_ListCtrl::GetScrollPos() const { - return m_ptScroll; -} - -CFX_FloatRect CPWL_ListCtrl::GetScrollArea() const { - return m_rcContent; -} - -void CPWL_ListCtrl::ResetFace() { - ResetAll(FALSE, 0); -} - -void CPWL_ListCtrl::ResetContent(int32_t nStart) { - if (nStart < 0) - nStart = 0; - if (nStart >= 0 && nStart < m_aChildren.GetSize()) - ResetAll(TRUE, nStart); -} - -FX_FLOAT CPWL_ListCtrl::GetContentsHeight(FX_FLOAT fLimitWidth) { - FX_FLOAT fRet = m_fTopSpace; - - FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); - - if (fLimitWidth > fBorderWidth * 2) { - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - FX_FLOAT fLeft = pChild->GetItemLeftMargin(); - FX_FLOAT fRight = pChild->GetItemRightMargin(); - - fRet += pChild->GetItemHeight(fLimitWidth - fBorderWidth * 2 - fLeft - - fRight); - fRet += m_fItemSpace; - } - } - - fRet -= m_fItemSpace; - } - - fRet += m_fBottomSpace; - - return fRet; -} - -void CPWL_ListCtrl::ResetAll(FX_BOOL bMove, int32_t nStart) { - CFX_FloatRect rcClient = GetClientRect(); - - FX_FLOAT fWidth = rcClient.Width(); - - FX_FLOAT fy = 0.0f - m_fTopSpace; - - if (nStart - 1 >= 0 && nStart - 1 < m_aChildren.GetSize()) - if (CPWL_Wnd* pChild = m_aChildren.GetAt(nStart - 1)) - fy = pChild->GetWindowRect().bottom - m_fItemSpace; - - for (int32_t i = nStart, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - FX_FLOAT fLeft = pChild->GetItemLeftMargin(); - FX_FLOAT fRight = pChild->GetItemRightMargin(); - - pChild->SetChildMatrix(CFX_Matrix(1, 0, 0, 1, - rcClient.left - m_ptScroll.x, - rcClient.top - m_ptScroll.y)); - - if (bMove) { - FX_FLOAT fItemHeight = pChild->GetItemHeight(fWidth - fLeft - fRight); - pChild->Move( - CFX_FloatRect(fLeft, fy - fItemHeight, fWidth - fRight, fy), TRUE, - FALSE); - fy -= fItemHeight; - fy -= m_fItemSpace; - } - } - } - - fy += m_fItemSpace; - - fy -= m_fBottomSpace; - - if (bMove) { - m_rcContent.left = 0; - m_rcContent.top = 0; - m_rcContent.right = fWidth; - m_rcContent.bottom = fy; - } -} - -void CPWL_ListCtrl::SetItemSpace(FX_FLOAT fSpace) { - m_fItemSpace = fSpace; -} - -void CPWL_ListCtrl::SetTopSpace(FX_FLOAT fSpace) { - m_fTopSpace = fSpace; -} - -void CPWL_ListCtrl::SetBottomSpace(FX_FLOAT fSpace) { - m_fBottomSpace = fSpace; -} - -void CPWL_ListCtrl::RePosChildWnd() { - ResetFace(); -} - -void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - pDevice->SaveState(); - CFX_FloatRect rcClient = GetClientRect(); - CFX_FloatRect rcTemp = rcClient; - pUser2Device->TransformRect(rcTemp); - pDevice->SetClip_Rect(FX_RECT((int32_t)rcTemp.left, (int32_t)rcTemp.bottom, - (int32_t)rcTemp.right, (int32_t)rcTemp.top)); - - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - CFX_FloatRect rcChild = pChild->ChildToParent(pChild->GetWindowRect()); - if (!(rcChild.top < rcClient.bottom || rcChild.bottom > rcClient.top)) { - CFX_Matrix mt = pChild->GetChildMatrix(); - if (mt.IsIdentity()) { - pChild->DrawAppearance(pDevice, pUser2Device); - } else { - mt.Concat(*pUser2Device); - pChild->DrawAppearance(pDevice, &mt); - } - } - } - } - - pDevice->RestoreState(false); -} - -int32_t CPWL_ListCtrl::GetItemIndex(CPWL_Wnd* pItem) { - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (pItem == m_aChildren.GetAt(i)) - return i; - } - - return -1; -} - -CFX_FloatPoint CPWL_ListCtrl::InToOut(const CFX_FloatPoint& point) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatPoint(point.x + rcClient.left - m_ptScroll.x, - point.y + rcClient.top - m_ptScroll.y); -} - -CFX_FloatPoint CPWL_ListCtrl::OutToIn(const CFX_FloatPoint& point) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatPoint(point.x - rcClient.left + m_ptScroll.x, - point.y - rcClient.top + m_ptScroll.y); -} - -CFX_FloatRect CPWL_ListCtrl::InToOut(const CFX_FloatRect& rect) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatRect(rect.left + rcClient.left - m_ptScroll.x, - rect.bottom + rcClient.top - m_ptScroll.y, - rect.right + rcClient.left - m_ptScroll.x, - rect.top + rcClient.top - m_ptScroll.y); -} - -CFX_FloatRect CPWL_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatRect(rect.left - rcClient.left + m_ptScroll.x, - rect.bottom - rcClient.top + m_ptScroll.y, - rect.right - rcClient.left + m_ptScroll.x, - rect.top - rcClient.top + m_ptScroll.y); -} diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/pdfwindow/PWL_ListCtrl.h deleted file mode 100644 index 844801978c..0000000000 --- a/fpdfsdk/pdfwindow/PWL_ListCtrl.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_ -#define FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_ - -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class CPWL_ListCtrl : public CPWL_Wnd { - public: - CPWL_ListCtrl(); - ~CPWL_ListCtrl() override; - - void SetScrollPos(const CFX_FloatPoint& point); - CFX_FloatPoint GetScrollPos() const; - CFX_FloatRect GetScrollArea() const; - void SetItemSpace(FX_FLOAT fSpace); - void SetTopSpace(FX_FLOAT fSpace); - void SetBottomSpace(FX_FLOAT fSpace); - void ResetFace(); - void ResetContent(int32_t nStart); - int32_t GetItemIndex(CPWL_Wnd* pItem); - FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth); - CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; - CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; - CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; - CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; - - protected: - // CPWL_Wnd - void RePosChildWnd() override; - void DrawChildAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - - private: - void ResetAll(FX_BOOL bMove, int32_t nStart); - - CFX_FloatRect m_rcContent; - CFX_FloatPoint m_ptScroll; - FX_FLOAT m_fItemSpace; - FX_FLOAT m_fTopSpace; - FX_FLOAT m_fBottomSpace; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp deleted file mode 100644 index 7513950cb7..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Signature.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "fpdfsdk/pdfwindow/PWL_Signature.h" - -#include "core/fxge/include/fx_ge.h" -#include "fpdfsdk/pdfwindow/PWL_Icon.h" -#include "fpdfsdk/pdfwindow/PWL_Label.h" -#include "fpdfsdk/pdfwindow/PWL_Utils.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(nullptr) {} - -CPWL_Signature_Image::~CPWL_Signature_Image() {} - -void CPWL_Signature_Image::SetImage(CFX_DIBSource* pImage) { - m_pImage = pImage; -} - -CFX_DIBSource* CPWL_Signature_Image::GetImage() { - return m_pImage; -} - -void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); - - if (m_pImage) { - CFX_FloatRect rcClient = GetClientRect(); - - FX_FLOAT x, y; - pUser2Device->Transform(rcClient.left, rcClient.top, x, y); - - pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, - (int32_t)rcClient.Width(), - (int32_t)rcClient.Height()); - } -} - -void CPWL_Signature_Image::GetThisAppearanceStream( - CFX_ByteTextBuf& sAppStream) { - sAppStream << CPWL_Image::GetImageAppStream().AsStringC(); -} - -void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { - FX_FLOAT fImageW, fImageH; - - GetImageSize(fImageW, fImageH); - - CFX_FloatRect rcClient = GetClientRect(); - - fHScale = rcClient.Width() / fImageW; - fVScale = rcClient.Height() / fImageH; -} - -CPWL_Signature::CPWL_Signature() - : m_pText(nullptr), - m_pDescription(nullptr), - m_pImage(nullptr), - m_bTextExist(TRUE), - m_bImageExist(FALSE), - m_bFlagExist(TRUE) {} - -CPWL_Signature::~CPWL_Signature() {} - -void CPWL_Signature::SetTextFlag(FX_BOOL bTextExist) { - m_bTextExist = bTextExist; - - RePosChildWnd(); -} - -void CPWL_Signature::SetImageFlag(FX_BOOL bImageExist) { - m_bImageExist = bImageExist; - - RePosChildWnd(); -} - -void CPWL_Signature::SetFoxitFlag(FX_BOOL bFlagExist) { - m_bFlagExist = bFlagExist; -} - -void CPWL_Signature::SetText(const FX_WCHAR* sText) { - m_pText->SetText(sText); - - RePosChildWnd(); -} - -void CPWL_Signature::SetDescription(const FX_WCHAR* str) { - m_pDescription->SetText(str); - - RePosChildWnd(); -} - -void CPWL_Signature::SetImage(CFX_DIBSource* pImage) { - m_pImage->SetImage(pImage); - - RePosChildWnd(); -} - -void CPWL_Signature::SetImageStream(CPDF_Stream* pStream, - const FX_CHAR* sImageAlias) { - m_pImage->SetPDFStream(pStream); - m_pImage->SetImageAlias(sImageAlias); - - RePosChildWnd(); -} - -void CPWL_Signature::RePosChildWnd() { - CFX_FloatRect rcClient = GetClientRect(); - - CFX_FloatRect rcText = rcClient; - CFX_FloatRect rcDescription = rcClient; - - FX_BOOL bTextVisible = m_bTextExist && m_pText->GetText().GetLength() > 0; - - if ((bTextVisible || m_bImageExist) && - m_pDescription->GetText().GetLength() > 0) { - if (rcClient.Width() >= rcClient.Height()) { - rcText.right = rcText.left + rcClient.Width() / 2.0f; - rcDescription.left = rcDescription.right - rcClient.Width() / 2.0f; - } else { - rcText.bottom = rcText.top - rcClient.Height() / 2.0f; - rcDescription.top = rcDescription.bottom + rcClient.Height() / 2.0f; - } - } - - m_pText->SetVisible(bTextVisible); - m_pImage->SetVisible(m_bImageExist); - - m_pText->Move(rcText, TRUE, FALSE); - m_pImage->Move(rcText, TRUE, FALSE); - m_pDescription->Move(rcDescription, TRUE, FALSE); -} - -void CPWL_Signature::CreateChildWnd(const PWL_CREATEPARAM& cp) { - m_pImage = new CPWL_Signature_Image; - PWL_CREATEPARAM icp = cp; - icp.pParentWnd = this; - icp.dwFlags = PWS_CHILD | PWS_VISIBLE; - icp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); - m_pImage->Create(icp); - - m_pText = new CPWL_Label; - PWL_CREATEPARAM acp = cp; - acp.pParentWnd = this; - acp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_AUTOFONTSIZE | PES_MULTILINE | - PES_AUTORETURN | PES_MIDDLE | PES_CENTER; - acp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); - m_pText->Create(acp); - - m_pDescription = new CPWL_Label; - PWL_CREATEPARAM dcp = cp; - dcp.pParentWnd = this; - dcp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_AUTOFONTSIZE | PES_MULTILINE | - PES_AUTORETURN | PES_LEFT | PES_CENTER; - dcp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); - m_pDescription->Create(dcp); -} - -void CPWL_Signature::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); - - if (m_bFlagExist) { - CPWL_Utils::DrawIconAppStream( - pDevice, pUser2Device, PWL_ICONTYPE_FOXIT, - CPWL_Utils::GetCenterSquare(GetClientRect()), - CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f), - CPWL_Color(COLORTYPE_TRANSPARENT), 255); - } -} - -void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - CPWL_Wnd::GetThisAppearanceStream(sAppStream); -} diff --git a/fpdfsdk/pdfwindow/PWL_Signature.h b/fpdfsdk/pdfwindow/PWL_Signature.h deleted file mode 100644 index 47d0bb0ae3..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Signature.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_ -#define FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_ - -#include "fpdfsdk/pdfwindow/PWL_Icon.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class CFX_DIBSource; -class CPWL_Label; - -class CPWL_Signature_Image : public CPWL_Image { - public: - CPWL_Signature_Image(); - ~CPWL_Signature_Image() override; - - void SetImage(CFX_DIBSource* pImage); - CFX_DIBSource* GetImage(); - - protected: - // CPWL_Image - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; - void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override; - - private: - CFX_DIBSource* m_pImage; -}; - -class CPWL_Signature : public CPWL_Wnd { - public: - CPWL_Signature(); - ~CPWL_Signature() override; - - void SetText(const FX_WCHAR* sText); - void SetDescription(const FX_WCHAR* str); - void SetImage(CFX_DIBSource* pImage); - void SetImageStream(CPDF_Stream* pStream, const FX_CHAR* sImageAlias); - - void SetTextFlag(FX_BOOL bTextExist); - void SetImageFlag(FX_BOOL bImageExist); - void SetFoxitFlag(FX_BOOL bFlagExist); - - protected: - // CPWL_Wnd - void RePosChildWnd() override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; - - private: - CPWL_Label* m_pText; - CPWL_Label* m_pDescription; - CPWL_Signature_Image* m_pImage; - - FX_BOOL m_bTextExist; - FX_BOOL m_bImageExist; - FX_BOOL m_bFlagExist; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_ |