summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_wnd.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-09-15 13:26:32 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-09-15 21:25:46 +0000
commitbf15730b2c9577d4efd2124d84c6c8ccc5f66b43 (patch)
treeb03fb50d97a3233094437746260c0927464be5ec /fpdfsdk/pwl/cpwl_wnd.h
parentbb2f7e73bef47b4e865118cb52170563d849b4de (diff)
downloadpdfium-bf15730b2c9577d4efd2124d84c6c8ccc5f66b43.tar.xz
Move CPWL_CREATPARAM to CPWL_Wnd::CreateParams
This nesting makes so much more sense when I read the code. Fix member naming for this in CPWL_Wnd. Pass in/out CreateParams arg as pointer. Kill Reset() method, only called during destroy and nothing needs explicit cleanup. Change-Id: If50e403e11c131e7656da09c0cb36866223d64c6 Reviewed-on: https://pdfium-review.googlesource.com/14070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_wnd.h')
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.h94
1 files changed, 35 insertions, 59 deletions
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index cd1c06005f..4074e9369f 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -118,58 +118,35 @@ class IPWL_FocusHandler {
virtual void OnSetFocus(CPWL_Edit* pEdit) = 0;
};
-struct PWL_CREATEPARAM {
- public:
- PWL_CREATEPARAM();
- PWL_CREATEPARAM(const PWL_CREATEPARAM& other);
-
- void Reset() {
- rcRectWnd.Reset();
- pSystemHandler = nullptr;
- pFontMap = nullptr;
- pProvider.Reset();
- pFocusHandler = nullptr;
- dwFlags = 0;
- sBackgroundColor.Reset();
- pAttachedWidget.Reset();
- nBorderStyle = BorderStyle::SOLID;
- dwBorderWidth = 0;
- sBorderColor.Reset();
- sTextColor.Reset();
- nTransparency = 0;
- fFontSize = 0.0f;
- sDash.Reset();
- pAttachedData = nullptr;
- pParentWnd = nullptr;
- pMsgControl = nullptr;
- eCursorType = 0;
- mtChild.SetIdentity();
- }
-
- CFX_FloatRect rcRectWnd; // required
- CFX_SystemHandler* pSystemHandler; // required
- IPVT_FontMap* pFontMap; // required
- IPWL_Provider::ObservedPtr pProvider; // required
- IPWL_FocusHandler* pFocusHandler; // optional
- uint32_t dwFlags; // optional
- CFX_Color sBackgroundColor; // optional
- CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required
- BorderStyle nBorderStyle; // optional
- int32_t dwBorderWidth; // optional
- CFX_Color sBorderColor; // optional
- CFX_Color sTextColor; // optional
- int32_t nTransparency; // optional
- float fFontSize; // optional
- CPWL_Dash sDash; // optional
- void* pAttachedData; // optional
- CPWL_Wnd* pParentWnd; // ignore
- CPWL_MsgControl* pMsgControl; // ignore
- int32_t eCursorType; // ignore
- CFX_Matrix mtChild; // ignore
-};
-
class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
public:
+ struct CreateParams {
+ public:
+ CreateParams();
+ CreateParams(const CreateParams& other);
+
+ CFX_FloatRect rcRectWnd; // required
+ CFX_SystemHandler* pSystemHandler; // required
+ IPVT_FontMap* pFontMap; // required
+ IPWL_Provider::ObservedPtr pProvider; // required
+ IPWL_FocusHandler* pFocusHandler; // optional
+ uint32_t dwFlags; // optional
+ CFX_Color sBackgroundColor; // optional
+ CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required
+ BorderStyle nBorderStyle; // optional
+ int32_t dwBorderWidth; // optional
+ CFX_Color sBorderColor; // optional
+ CFX_Color sTextColor; // optional
+ int32_t nTransparency; // optional
+ float fFontSize; // optional
+ CPWL_Dash sDash; // optional
+ void* pAttachedData; // optional
+ CPWL_Wnd* pParentWnd; // ignore
+ CPWL_MsgControl* pMsgControl; // ignore
+ int32_t eCursorType; // ignore
+ CFX_Matrix mtChild; // ignore
+ };
+
CPWL_Wnd();
~CPWL_Wnd() override;
@@ -207,7 +184,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
void InvalidateFocusHandler(IPWL_FocusHandler* handler);
void InvalidateProvider(IPWL_Provider* provider);
- void Create(const PWL_CREATEPARAM& cp);
+ void Create(const CreateParams& cp);
void Destroy();
void Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh);
@@ -274,13 +251,13 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
// CPWL_TimerHandler
CFX_SystemHandler* GetSystemHandler() const override;
- virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+ virtual void CreateChildWnd(const CreateParams& cp);
virtual void RePosChildWnd();
virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device);
- virtual void OnCreate(PWL_CREATEPARAM& cp);
+ virtual void OnCreate(CreateParams* pParamsToAdjust);
virtual void OnCreated();
virtual void OnDestroy();
@@ -288,10 +265,9 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
virtual void OnKillFocus();
void SetNotifyFlag(bool bNotifying = true) { m_bNotifying = bNotifying; }
-
- bool IsValid() const;
- const PWL_CREATEPARAM& GetCreationParam() const;
bool IsNotifying() const { return m_bNotifying; }
+ bool IsValid() const { return m_bCreated; }
+ const CreateParams& GetCreationParams() const { return m_CreationParams; }
void InvalidateRectMove(const CFX_FloatRect& rcOld,
const CFX_FloatRect& rcNew);
@@ -322,8 +298,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
void AddChild(CPWL_Wnd* pWnd);
void RemoveChild(CPWL_Wnd* pWnd);
- void CreateScrollBar(const PWL_CREATEPARAM& cp);
- void CreateVScrollBar(const PWL_CREATEPARAM& cp);
+ void CreateScrollBar(const CreateParams& cp);
+ void CreateVScrollBar(const CreateParams& cp);
void AdjustStyle();
void CreateMsgControl();
@@ -331,8 +307,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
CPWL_MsgControl* GetMsgControl() const;
+ CreateParams m_CreationParams;
std::vector<CPWL_Wnd*> m_Children;
- PWL_CREATEPARAM m_sPrivateParam;
CFX_UnownedPtr<CPWL_ScrollBar> m_pVScrollBar;
CFX_FloatRect m_rcWindow;
CFX_FloatRect m_rcClip;