Cleanup: Get this rid of "this->" in fpdfsdk/
[pdfium.git] / fpdfsdk / src / pdfwindow / PWL_IconList.cpp
index 7231790..157eba6 100644 (file)
@@ -1,7 +1,7 @@
 // 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 "../../include/pdfwindow/PDFWindow.h"
@@ -19,8 +19,8 @@
 
 /* ------------------ CPWL_IconList_Item ------------------- */
 
-CPWL_IconList_Item::CPWL_IconList_Item() : 
-       m_nIconIndex(-1), 
+CPWL_IconList_Item::CPWL_IconList_Item() :
+       m_nIconIndex(-1),
        m_pData(NULL),
        m_bSelected(FALSE),
        m_pText(NULL)
@@ -47,15 +47,15 @@ void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr
 
        if (m_bSelected)
        {
-               if (this->IsEnabled())
+               if (IsEnabled())
                {
-                       CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, 
-                               CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR,this->GetTransparency()));
+                       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,this->GetTransparency()));
+                       CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient,
+                               CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR, GetTransparency()));
                }
        }
 
@@ -63,8 +63,8 @@ void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr
        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(), this->GetTransparency());
+       CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon,
+               m_crIcon, m_pText->GetTextColor(), GetTransparency());
 }
 
 void CPWL_IconList_Item::SetSelect(FX_BOOL bSelected)
@@ -100,14 +100,14 @@ void CPWL_IconList_Item::SetData(void* pData)
        m_pData = pData;
 }
 
-void CPWL_IconList_Item::SetIcon(FX_INT32 nIconIndex)
+void CPWL_IconList_Item::SetIcon(int32_t nIconIndex)
 {
        m_nIconIndex = nIconIndex;
 }
 
 void CPWL_IconList_Item::SetText(const CFX_WideString& str)
 {
-       m_pText->SetText(str);
+       m_pText->SetText(str.c_str());
 }
 
 CFX_WideString CPWL_IconList_Item::GetText() const
@@ -136,19 +136,19 @@ void CPWL_IconList_Item::OnEnabled()
        else
                m_pText->SetTextColor(PWL_DEFAULT_BLACKCOLOR);
 
-       this->InvalidateRect();
+       InvalidateRect();
 }
 
 void CPWL_IconList_Item::OnDisabled()
 {
        m_pText->SetTextColor(PWL_DEFAULT_HEAVYGRAYCOLOR);
 
-       this->InvalidateRect();
+       InvalidateRect();
 }
 
 /* ----------------- CPWL_IconList_Content ----------------- */
 
-CPWL_IconList_Content::CPWL_IconList_Content(FX_INT32 nListCount) : 
+CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) :
        m_nSelectIndex(-1),
        m_pNotify(NULL),
        m_bEnableNotify(TRUE),
@@ -163,7 +163,7 @@ CPWL_IconList_Content::~CPWL_IconList_Content()
 
 void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM & cp)
 {
-       for (FX_INT32 i=0; i<m_nListCount; i++)
+       for (int32_t i=0; i<m_nListCount; i++)
        {
                CPWL_IconList_Item* pNewItem = new CPWL_IconList_Item();
 
@@ -173,13 +173,13 @@ void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM & cp)
                pNewItem->Create(icp);
        }
 
-       this->SetItemSpace(PWL_IconList_ITEM_SPACE);
-       this->ResetContent(0);
+       SetItemSpace(PWL_IconList_ITEM_SPACE);
+       ResetContent(0);
 
-       if (CPWL_Wnd * pParent = this->GetParentWindow())
+       if (CPWL_Wnd * pParent = GetParentWindow())
        {
-               CPDF_Rect rcScroll = this->GetScrollArea();
-               this->GetScrollPos();
+               CPDF_Rect rcScroll = GetScrollArea();
+               GetScrollPos();
 
                PWL_SCROLL_INFO sInfo;
                sInfo.fContentMin = rcScroll.bottom;
@@ -188,25 +188,25 @@ void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM & cp)
                sInfo.fSmallStep = 13.0f;
                sInfo.fBigStep = sInfo.fPlateWidth;
 
-               pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (FX_INTPTR)&sInfo);
+               pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo);
        }
 }
 
-FX_BOOL        CPWL_IconList_Content::OnLButtonDown(const CPDF_Point & point)
+FX_BOOL        CPWL_IconList_Content::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)
 {
        SetFocus();
 
        SetCapture();
        m_bMouseDown = TRUE;
 
-       FX_INT32 nItemIndex = FindItemIndex(point);
+       int32_t nItemIndex = FindItemIndex(point);
        SetSelect(nItemIndex);
        ScrollToItem(nItemIndex);
 
        return TRUE;
 }
 
-FX_BOOL        CPWL_IconList_Content::OnLButtonUp(const CPDF_Point & point)
+FX_BOOL        CPWL_IconList_Content::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
 {
        m_bMouseDown = FALSE;
        ReleaseCapture();
@@ -214,11 +214,11 @@ FX_BOOL   CPWL_IconList_Content::OnLButtonUp(const CPDF_Point & point)
        return TRUE;
 }
 
-FX_BOOL CPWL_IconList_Content::OnMouseMove(const CPDF_Point & point)
+FX_BOOL CPWL_IconList_Content::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag)
 {
        if (m_bMouseDown)
        {
-               FX_INT32 nItemIndex = FindItemIndex(point);
+               int32_t nItemIndex = FindItemIndex(point);
                SetSelect(nItemIndex);
                ScrollToItem(nItemIndex);
        }
@@ -226,14 +226,14 @@ FX_BOOL CPWL_IconList_Content::OnMouseMove(const CPDF_Point & point)
        return TRUE;
 }
 
-FX_BOOL        CPWL_IconList_Content::OnKeyDown(FX_WORD nChar)
+FX_BOOL        CPWL_IconList_Content::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag)
 {
        switch (nChar)
        {
        case FWL_VKEY_Up:
                if (m_nSelectIndex > 0)
                {
-                       FX_INT32 nItemIndex = m_nSelectIndex - 1;
+                       int32_t nItemIndex = m_nSelectIndex - 1;
                        SetSelect(nItemIndex);
                        ScrollToItem(nItemIndex);
                }
@@ -241,7 +241,7 @@ FX_BOOL     CPWL_IconList_Content::OnKeyDown(FX_WORD nChar)
        case FWL_VKEY_Down:
                if (m_nSelectIndex < m_nListCount-1)
                {
-                       FX_INT32 nItemIndex = m_nSelectIndex + 1;
+                       int32_t nItemIndex = m_nSelectIndex + 1;
                        SetSelect(nItemIndex);
                        ScrollToItem(nItemIndex);
                }
@@ -251,10 +251,10 @@ FX_BOOL   CPWL_IconList_Content::OnKeyDown(FX_WORD nChar)
        return FALSE;
 }
 
-FX_INT32 CPWL_IconList_Content::FindItemIndex(const CPDF_Point& point)
+int32_t CPWL_IconList_Content::FindItemIndex(const CPDF_Point& point)
 {
-       FX_INT32 nIndex = 0;
-       for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++)
+       int32_t nIndex = 0;
+       for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
        {
                if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
                {
@@ -270,7 +270,7 @@ FX_INT32 CPWL_IconList_Content::FindItemIndex(const CPDF_Point& point)
        return nIndex;
 }
 
-void CPWL_IconList_Content::ScrollToItem(FX_INT32 nItemIndex)
+void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex)
 {
        CPDF_Rect rcClient = GetClientRect();
 
@@ -289,21 +289,21 @@ void CPWL_IconList_Content::ScrollToItem(FX_INT32 nItemIndex)
                        }
                        else if (rcWnd.bottom < rcClient.bottom)
                        {
-                               ptScroll.y = rcOrigin.bottom + rcClient.Height();                                       
+                               ptScroll.y = rcOrigin.bottom + rcClient.Height();
                        }
 
-                       this->SetScrollPos(ptScroll);
-                       this->ResetFace();
-                       this->InvalidateRect();
-                       if (CPWL_Wnd* pParent = this->GetParentWindow())
+                       SetScrollPos(ptScroll);
+                       ResetFace();
+                       InvalidateRect();
+                       if (CPWL_Wnd* pParent = GetParentWindow())
                        {
-                               pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptScroll.y);
+                               pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y);
                        }
                }
        }
 }
 
-void CPWL_IconList_Content::SetSelect(FX_INT32 nIndex)
+void CPWL_IconList_Content::SetSelect(int32_t nIndex)
 {
        if (m_nSelectIndex != nIndex)
        {
@@ -316,7 +316,7 @@ void CPWL_IconList_Content::SetSelect(FX_INT32 nIndex)
        }
 }
 
-FX_INT32 CPWL_IconList_Content::GetSelect() const
+int32_t CPWL_IconList_Content::GetSelect() const
 {
        return m_nSelectIndex;
 }
@@ -338,16 +338,16 @@ void CPWL_IconList_Content::EnableNotify(FX_BOOL bNotify)
        m_bEnableNotify = bNotify;
 }
 
-void CPWL_IconList_Content::SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect)
+void CPWL_IconList_Content::SelectItem(int32_t nItemIndex, FX_BOOL bSelect)
 {
        if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex))
        {
                pItem->SetSelect(bSelect);
-               pItem->InvalidateRect();                
+               pItem->InvalidateRect();
        }
 }
 
-CPWL_IconList_Item* CPWL_IconList_Content::GetListItem(FX_INT32 nItemIndex) const
+CPWL_IconList_Item* CPWL_IconList_Content::GetListItem(int32_t nItemIndex) const
 {
        if (nItemIndex >= 0 && nItemIndex<m_aChildren.GetSize())
        {
@@ -363,25 +363,25 @@ CPWL_IconList_Item* CPWL_IconList_Content::GetListItem(FX_INT32 nItemIndex) cons
        return NULL;
 }
 
-void CPWL_IconList_Content::SetListData(FX_INT32 nItemIndex, void* pData)
+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(FX_INT32 nItemIndex, FX_INT32 nIconIndex)
+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(FX_INT32 nItemIndex, const CFX_WideString& str)
+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(FX_INT32 nItemIndex) const
+CFX_WideString CPWL_IconList_Content::GetListString(int32_t nItemIndex) const
 {
        if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex))
                return pItem->GetText();
@@ -391,7 +391,7 @@ CFX_WideString CPWL_IconList_Content::GetListString(FX_INT32 nItemIndex) const
 
 void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color)
 {
-       for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++)
+       for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
        {
                if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
                {
@@ -408,7 +408,7 @@ void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color)
 
 /* -------------------- CPWL_IconList --------------------- */
 
-CPWL_IconList::CPWL_IconList(FX_INT32 nListCount) : 
+CPWL_IconList::CPWL_IconList(int32_t nListCount) :
        m_pListContent(NULL),
        m_nListCount(nListCount)
 {
@@ -438,7 +438,7 @@ void CPWL_IconList::CreateChildWnd(const PWL_CREATEPARAM & cp)
 
 void CPWL_IconList::OnCreated()
 {
-       if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar())
+       if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
        {
                pScrollBar->RemoveFlag(PWS_AUTOTRANSPARENT);
                pScrollBar->SetTransparency(255);
@@ -446,25 +446,25 @@ void CPWL_IconList::OnCreated()
        }
 }
 
-void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam)
+void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD 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 = this->GetVScrollBar())
+                               if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
                                {
                                        if (pInfo->fContentMax - pInfo->fContentMin > pInfo->fPlateWidth)
                                        {
                                                if (!pScrollBar->IsVisible())
                                                {
                                                        pScrollBar->SetVisible(TRUE);
-                                                       RePosChildWnd();                        
+                                                       RePosChildWnd();
                                                }
                                                else
                                                {
@@ -481,7 +481,7 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_
                                                if (m_pListContent)
                                                        m_pListContent->SetScrollPos(CPDF_Point(0.0f,0.0f));
                                        }
-                                       
+
                                        pScrollBar->OnNotify(pWnd,PNM_SETSCROLLINFO,wParam,lParam);
                                }
                        }
@@ -495,24 +495,24 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_
                        }
                        return;
                case PNM_SETSCROLLPOS:
-                       if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar())
+                       if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
                                pScrollBar->OnNotify(pWnd,PNM_SETSCROLLPOS,wParam,lParam);
                        return;
                }
        }
 }
 
-void CPWL_IconList::SetSelect(FX_INT32 nIndex)
+void CPWL_IconList::SetSelect(int32_t nIndex)
 {
        m_pListContent->SetSelect(nIndex);
 }
 
-void CPWL_IconList::SetTopItem(FX_INT32 nIndex)
+void CPWL_IconList::SetTopItem(int32_t nIndex)
 {
        m_pListContent->ScrollToItem(nIndex);
 }
 
-FX_INT32 CPWL_IconList::GetSelect() const
+int32_t CPWL_IconList::GetSelect() const
 {
        return m_pListContent->GetSelect();
 }
@@ -527,22 +527,22 @@ void CPWL_IconList::EnableNotify(FX_BOOL bNotify)
        m_pListContent->EnableNotify(bNotify);
 }
 
-void CPWL_IconList::SetListData(FX_INT32 nItemIndex, void* pData)
+void CPWL_IconList::SetListData(int32_t nItemIndex, void* pData)
 {
        m_pListContent->SetListData(nItemIndex, pData);
 }
 
-void CPWL_IconList::SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex)
+void CPWL_IconList::SetListIcon(int32_t nItemIndex, int32_t nIconIndex)
 {
        m_pListContent->SetListIcon(nItemIndex, nIconIndex);
 }
 
-void CPWL_IconList::SetListString(FX_INT32 nItemIndex, const CFX_WideString& str)
+void CPWL_IconList::SetListString(int32_t nItemIndex, const CFX_WideString& str)
 {
        m_pListContent->SetListString(nItemIndex, str);
 }
 
-CFX_WideString CPWL_IconList::GetListString(FX_INT32 nItemIndex) const
+CFX_WideString CPWL_IconList::GetListString(int32_t nItemIndex) const
 {
        return m_pListContent->GetListString(nItemIndex);
 }
@@ -552,7 +552,7 @@ void CPWL_IconList::SetIconFillColor(const CPWL_Color& color)
        m_pListContent->SetIconFillColor(color);
 }
 
-FX_BOOL        CPWL_IconList::OnMouseWheel(short zDelta, const CPDF_Point & point)
+FX_BOOL        CPWL_IconList::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)
 {
        CPDF_Point ptScroll = m_pListContent->GetScrollPos();
        CPDF_Rect rcScroll = m_pListContent->GetScrollArea();
@@ -579,9 +579,9 @@ FX_BOOL     CPWL_IconList::OnMouseWheel(short zDelta, const CPDF_Point & point)
                        m_pListContent->SetScrollPos(ptNew);
                        m_pListContent->ResetFace();
                        m_pListContent->InvalidateRect(NULL);
-                       
-                       if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar())
-                               pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptNew.y);
+
+                       if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
+                               pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y);
 
                        return TRUE;
                }