Home | History | Annotate | Download | only in core
      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 FWL_TARGET_H_
      8 #define FWL_TARGET_H_
      9 
     10 #include "core/include/fxcrt/fx_basic.h"
     11 
     12 // FWL contains three parallel inheritance hierarchies, which reference each
     13 // other via pointers as follows:
     14 //
     15 //                                           m_pImpl
     16 //      (nonesuch)              IFWL_Target ----------> CFWL_TargetImp
     17 //                                   |                       |
     18 //                                   A                       A
     19 //                   m_pIface        |                       |
     20 //      CFWL_Widget ----------> IFWL_Widget             CFWL_WidgetImp
     21 //           |                       |                       |
     22 //           A                       A                       A
     23 //           |                       |                       |
     24 //      CFWL_...                IFWL_...                CFWL_...Imp
     25 //
     26 
     27 class CFWL_TargetImp;
     28 
     29 class IFWL_Target {
     30  public:
     31   IFWL_Target() : m_pImpl(nullptr) {}
     32   virtual ~IFWL_Target();
     33 
     34   // These call into equivalent polymorphic methods of m_pImpl. There
     35   // should be no need to override these in subclasses.
     36   FWL_ERR GetClassName(CFX_WideString& wsClass) const;
     37   FX_DWORD GetClassID() const;
     38   FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
     39   FWL_ERR Initialize();
     40   FWL_ERR Finalize();
     41 
     42   CFWL_TargetImp* GetImpl() const { return m_pImpl; }
     43 
     44  protected:
     45   void SetImpl(CFWL_TargetImp* pImpl) { m_pImpl = pImpl; }
     46 
     47  private:
     48   CFWL_TargetImp* m_pImpl;
     49 };
     50 
     51 #endif  // FWL_TARGET_H_
     52