summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_wnd.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-09-15 15:32:01 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-09-15 22:42:04 +0000
commit134ac9105586407eb3b1e06001101ff893dd4a31 (patch)
tree42742a4d7867643a9e30d637204bc320407a66c0 /fpdfsdk/pwl/cpwl_wnd.h
parentbf15730b2c9577d4efd2124d84c6c8ccc5f66b43 (diff)
downloadpdfium-134ac9105586407eb3b1e06001101ff893dd4a31.tar.xz
Introduce CPWL_Wnd::PrivateData class.
First step in passing ownership of this memory to the CPWL_Wnd. In turn, nest two other classes that also require PrivateData to satisfy nesting rules. Move one stray #define to the appropriate file while at it. Change-Id: I565934565421f5843a3b792b3bdc21b5e8839eb8 Reviewed-on: https://pdfium-review.googlesource.com/14170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_wnd.h')
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.h88
1 files changed, 45 insertions, 43 deletions
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 4074e9369f..2fd5077a86 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -22,10 +22,8 @@
class CPWL_Edit;
class CPWL_MsgControl;
class CPWL_ScrollBar;
-class CPWL_Wnd;
class CFX_SystemHandler;
class IPVT_FontMap;
-class IPWL_Provider;
struct PWL_SCROLL_INFO;
// window styles
@@ -65,8 +63,6 @@ struct PWL_SCROLL_INFO;
// combobox styles
#define PCBS_ALLOWCUSTOMTEXT 0x0001L
-#define PWL_CLASSNAME_EDIT "CPWL_Edit"
-
struct CPWL_Dash {
CPWL_Dash() : nDash(0), nGap(0), nPhase(0) {}
CPWL_Dash(int32_t dash, int32_t gap, int32_t phase)
@@ -104,47 +100,53 @@ inline bool operator!=(const CFX_Color& c1, const CFX_Color& c2) {
#define PWL_DEFAULT_BLACKCOLOR CFX_Color(COLORTYPE_GRAY, 0)
#define PWL_DEFAULT_WHITECOLOR CFX_Color(COLORTYPE_GRAY, 1)
-class IPWL_Provider : public CFX_Observable<IPWL_Provider> {
+class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
public:
- virtual ~IPWL_Provider() {}
+ class PrivateData {
+ protected:
+ ~PrivateData() {}
+ };
- // get a matrix which map user space to CWnd client space
- virtual CFX_Matrix GetWindowMatrix(void* pAttachedData) = 0;
-};
+ class ProviderIface : public CFX_Observable<ProviderIface> {
+ public:
+ virtual ~ProviderIface() {}
-class IPWL_FocusHandler {
- public:
- virtual ~IPWL_FocusHandler() {}
- virtual void OnSetFocus(CPWL_Edit* pEdit) = 0;
-};
+ // get a matrix which map user space to CWnd client space
+ virtual CFX_Matrix GetWindowMatrix(PrivateData* pAttached) = 0;
+ };
-class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
- public:
- struct CreateParams {
+ class FocusHandlerIface {
+ public:
+ virtual ~FocusHandlerIface() {}
+ virtual void OnSetFocus(CPWL_Edit* pEdit) = 0;
+ };
+
+ class 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
+ ~CreateParams();
+
+ CFX_FloatRect rcRectWnd; // required
+ CFX_SystemHandler* pSystemHandler; // required
+ IPVT_FontMap* pFontMap; // required
+ ProviderIface::ObservedPtr pProvider; // required
+ CFX_UnownedPtr<FocusHandlerIface> 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
+ CFX_UnownedPtr<PrivateData> pAttachedData; // optional
+ CPWL_Wnd* pParentWnd; // ignore
+ CPWL_MsgControl* pMsgControl; // ignore
+ int32_t eCursorType; // ignore
+ CFX_Matrix mtChild; // ignore
};
CPWL_Wnd();
@@ -182,8 +184,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
virtual CFX_FloatRect GetFocusRect() const;
virtual CFX_FloatRect GetClientRect() const;
- void InvalidateFocusHandler(IPWL_FocusHandler* handler);
- void InvalidateProvider(IPWL_Provider* provider);
+ void InvalidateFocusHandler(FocusHandlerIface* handler);
+ void InvalidateProvider(ProviderIface* provider);
void Create(const CreateParams& cp);
void Destroy();
void Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh);
@@ -220,7 +222,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
const CFX_FloatRect& GetClipRect() const;
CPWL_Wnd* GetParentWindow() const;
- void* GetAttachedData() const;
+ PrivateData* GetAttachedData() const;
bool WndHitTest(const CFX_PointF& point) const;
bool ClientHitTest(const CFX_PointF& point) const;
@@ -234,8 +236,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
CPWL_ScrollBar* GetVScrollBar() const;
IPVT_FontMap* GetFontMap() const;
- IPWL_Provider* GetProvider() const;
- IPWL_FocusHandler* GetFocusHandler() const;
+ ProviderIface* GetProvider() const;
+ FocusHandlerIface* GetFocusHandler() const;
int32_t GetTransparency();
void SetTransparency(int32_t nTransparency);