basesite.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:40k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. #ifndef _BASESITE_H_
  36. #define _BASESITE_H_
  37. #include "hxslist.h"
  38. #include "chxpckts.h"
  39. #include "hxwin.h"
  40. #include "hxwintyp.h"
  41. #include "hxsite2.h"
  42. #include "hxvctrl.h"
  43. #include "hxcomm.h"
  44. #include "hxengin.h"
  45. #include "region.h"
  46. #include "sitetran.h"
  47. #include "coloracc.h"
  48. class   CHXBaseSite;
  49. class   CBaseSurface;
  50. class   CBaseRootSurface;
  51. class   CHXSiteStatusText;
  52. class   BaseSiteCallback;
  53. class   ScrollSiteCallback;
  54. class   HXMutex;
  55. class   HXThread;
  56. /*
  57.  *  reasons to schedule call backs.
  58.  */
  59. #define REPAINT    0
  60. #define CLIP       1
  61. #define MOUSE      2  
  62. #define REDRAW_ALL 3
  63. #define MOVE       4
  64. #if defined(_UNIX) || defined(_MACINTOSH)
  65. #  define HX_SHOW_WINDOW 1
  66. #  define HX_HIDE_WINDOW 2
  67. #endif
  68. #if defined(_WINDOWS)
  69. #  define HX_SHOW_WINDOW SW_SHOW
  70. #  define HX_HIDE_WINDOW SW_HIDE
  71. #endif
  72. //Defines for sensitivity.
  73. #define SENSITIVITY_NOT_SET     -3
  74. #define SENSITIVITY_OPAQUE      -2
  75. #define SENSITIVITY_TRANSPARENT -1
  76. /****************************************************************************
  77.  * 
  78.  *  Class:
  79.  *
  80.  *      NonDelegatingUnknown
  81.  *
  82.  *  Purpose:
  83.  *
  84.  *      Same signature as IUnknown, allows an object to implement 
  85.  *      aggregation.
  86.  *
  87.  */
  88. class SiteNonDelegatingUnknown
  89. {
  90.   public:
  91.     /*
  92.      * DelegatingUnknown methods
  93.      */
  94.     STDMETHOD(SiteNonDelegatingQueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE;
  95.     STDMETHOD_(ULONG32,SiteNonDelegatingAddRef) (THIS) PURE;
  96.     STDMETHOD_(ULONG32,SiteNonDelegatingRelease) (THIS) PURE;
  97. };
  98. /****************************************************************************
  99.  * 
  100.  *  Class:
  101.  *
  102.  *      CHXBaseSite
  103.  *
  104.  *  Purpose:
  105.  *
  106.  *      Implementation for IHXSite objects which are associated with
  107.  *      platform specific window objects on Microsoft Windows and X-Windows.
  108.  *
  109.  */
  110. class CHXBaseSite : 
  111. public SiteNonDelegatingUnknown,
  112.  public IHXSite2,
  113.  public IHXSiteWindowed,
  114.  public IHXSiteWindowless,
  115.  public IHXCallback,
  116.  public IHXStatusMessage,
  117.  public IHXSiteFullScreen,
  118.  public IHXVideoControl,
  119.  public IHXInterruptSafe,
  120.  public IHXSiteTransition,
  121.  public IHXSiteComposition,
  122.  public IHXKeyBoardFocus,
  123.  public IHXDrawFocus,
  124.  public IHXSubRectSite
  125. {
  126.   public:
  127.     
  128.     static CHXBaseSite* CreateSite( IUnknown* pContext,
  129.                                     IUnknown* pUnkOuter = NULL,
  130.                                     INT32 lZorder = 0);
  131.     static BOOL             zm_bInFullScreenTest;
  132.     ColorFuncAccess*        zm_pColorAcc;
  133.     static CHXSimpleList    zm_YUVSiteList;
  134.     LONG32                 m_lRefCount;
  135.     IUnknown*              m_pUnkOuter;
  136.     CHXHeader*             m_pValues;
  137.     CHXMapPtrToPtr         m_ChildrenMap;
  138.     CHXSimpleList          m_ChildrenInZOrder;
  139.     CHXSimpleList          m_PassiveSiteWatchers;
  140.     IHXSiteUser*          m_pUser;
  141.     CHXBaseSite*           m_pParentSite;
  142.     CHXBaseSite*           m_pTopLevelSite;
  143.     CHXBaseSite*           m_pFocusSite;
  144.     CBaseSurface*          m_pVideoSurface;
  145.     CHXSiteStatusText*     m_pStatusText;
  146.     UINT32                 m_nStatusTextExpireTime;
  147.     BaseSiteCallback*      m_pCallback;
  148.     ScrollSiteCallback*    m_pScrollSiteCallback;
  149.     IHXCommonClassFactory*m_pCCF;
  150.     IHXSiteWatcher*       m_pWatcher;
  151.     IUnknown*              m_pContext;
  152.     HXxSize                m_size;
  153.     HXMutex*              m_pMutex;
  154.     HXxPoint               m_position;
  155.     HXxPoint               m_positionOrig;
  156.     HXxPoint               m_CreateWindowPos;
  157.     HXxPoint               m_topleft;
  158.     INT32                  m_lZOrder;
  159.     BOOL                   m_bIsVisible;
  160.     LONG32                 m_lBltEntryCount;
  161.     BOOL                   m_bInDestructor;
  162.     BOOL                   m_bIsChildWindow;
  163.     BOOL                   m_bRecomputeClipScheduled;
  164.     BOOL                   m_bForceRedrawNeeded;
  165.     BOOL                   m_bRepaintScheduled;
  166.     BOOL                   m_bInFullScreen;
  167.     BOOL                   m_bSettingDisplayMode;
  168.     BOOL                   m_bDisableForceRedraw;
  169.     BOOL                   m_bProcessRepaint;
  170.     BOOL                   m_bWasTopMost;
  171.     BOOL                   m_bModeSharpness;
  172.     BOOL                   m_bAboutToBlt;
  173.     CBaseRootSurface*      m_pRootSurface;
  174.     HXREGION*                m_pDirtyRegion;
  175.     BOOL                   m_bSetCaptureOn;
  176.     IHXSiteUser*          m_pCaptureUser;
  177.     IHXSiteUser*          m_pLastUser;
  178.     CHXBaseSite*           m_pMouseInSite;
  179.     CallbackHandle         m_CallbackHandle;
  180.     CallbackHandle         m_ScrollSiteCallbackHandle;
  181.     IHXScheduler*         m_pScheduler;
  182.     HXxPoint               m_windowPosition;
  183.     HXxSize                m_windowSize;
  184.     HXxPoint               m_screenOffset;
  185.     BOOL                   m_bDoNotGenerateWMPPaint;
  186.     UINT32                 m_nLastMoveTime;
  187.     BOOL                   m_bAttachWindowPending;
  188.     BOOL                   m_bDetachWndMsgPending;
  189.     UINT16                 m_nOldBitsPerPixel;
  190.     UINT16                 m_nOldHorzRes;
  191.     UINT16                 m_nOldVertRes;
  192.     float                  m_fSharpness;
  193.     float                  m_fHue;
  194.     float                  m_fSaturation;
  195.     float                  m_fContrast;
  196.     float                  m_fBrightness;
  197.     INT32                  m_XSliderPos;   
  198.     INT32                  m_YSliderPos;   
  199.     INT32                  m_XSliderRange;
  200.     INT32                  m_YSliderRange;
  201.     CHXSimpleList          m_PendingTaskList;
  202.     TransitionType         m_fpTransitionEffect;
  203.     HXxWindow              m_TopLevelWindow;
  204.     HXxWindow*             m_pWindow;
  205.     HXxRect                m_rectOldClientRect;
  206.     HXREGION*                m_Region;
  207.     HXREGION*                m_RegionForMouse;
  208.     HXREGION*                m_RegionWithoutChildren;
  209.     INT32                  m_nDelayFillBorders;
  210.     INT32                  m_nTransitionState;
  211.     BOOL                   m_bTransitionReversed;
  212.     BOOL                   m_bTransitionTranIn;
  213.     INT32                  m_nTransitionVertRepeat;
  214.     INT32                  m_nTransitionHorzRepeat;
  215.     INT32                  m_nTransitionBorderWidth;
  216.     tranLines              m_TransitionBorderLines;
  217.     ULONG32                m_ulTransitionBorderColor;
  218.     ULONG32                m_ulTransitionFadeColor;
  219.     BOOL                   m_bTransitionBlendBorder;
  220.     BOOL                   m_bTransitionCoordinated;
  221.     BOOL                   m_bTransitionCoordTranIsParentClip;
  222.     BOOL                   m_bRegionIsValid;
  223.     BOOL                   m_bWindowCreatedByCreate;
  224.     BOOL                   m_bCalledComputeClipFromTransition;
  225.     INT32                  m_nEventSensitivity;
  226.     CHXMapPtrToPtr         m_upgradeMap;
  227.     BOOL                   m_bScheduleUpgrade;
  228.     CHXSimpleList          m_ListOfRealVideoSites;
  229.     BOOL                   m_bVideoUnderTransition;
  230.     BOOL                   m_bInForceRedraw;
  231.     BOOL                   m_bSiteRefresh;
  232.     BOOL                   m_bTestWindowing;
  233.     INT32                  m_nWindowColor;
  234.     BOOL                   m_bPostageStamp;
  235.     BOOL                   m_bBltHasBeenCalled;
  236.     HXxRect                m_UpdateBltStatsRect;
  237.     BOOL                   m_bScrollingSite;
  238.    
  239.     // IHXKeyBoardFocus
  240.     IHXSiteUser*          m_pKeyBoardFocusUser;
  241.     // IHXDrawFocus
  242.     enum
  243.         {
  244.             DRAW_RECT           = 1, 
  245.             DRAW_ELLIPSE        = 1<<1, 
  246.             DRAW_POLYGON        = 1<<2
  247.         };
  248.     
  249.     typedef struct _FocusRect_t
  250.     {
  251.         union
  252.         {
  253.             HXxRect rcFocus;
  254.             
  255.             struct
  256.             {
  257.                 HXxPoint* pFocusPoints;
  258.                 UINT32    ulFocusPoints;
  259.             } polygon;
  260.         };
  261.         
  262.         UINT32     ulShape;
  263.         UINT32     ulLineStyle;
  264.         UINT32     ulLineWidth;
  265.       
  266.         UINT8      red, green, blue;
  267.         UINT8      red2, green2, blue2;
  268.         IHXBuffer *pCustomPattern;
  269.         UINT32     ulCustomEntries;
  270.         BOOL       bRectActive;
  271.         BOOL       bSecondaryColors;
  272.         
  273.     } tFocusRect;
  274.     
  275.     tFocusRect             m_rcFocusRect;
  276.    
  277.     typedef enum 
  278.     {
  279.         ONMOVEWINDOW = 0
  280.         , ONUPDATEWINDOW
  281.         , ONSHOWWINDOW
  282.         , ONSETWINDOWPOS
  283.         , ONSETWINDOWREGION
  284.         , ONSETXSLIDER
  285.         , ONSETYSLIDER
  286.         , ONSETFOCUS
  287.         , ONSETSIZE
  288.         , ONSETPOSITION
  289.     } PendingTaskType;
  290.     struct PendingTask
  291.     {
  292.         PendingTask( PendingTaskType uTaskType,
  293.                      CHXBaseSite*    pThis,
  294.                      void*           ulArg1 = 0,
  295.                      void*           ulArg2 = 0,
  296.                      void*           ulArg3 = 0,
  297.                      void*           ulArg4 = 0,
  298.                      void*           ulArg5 = 0,
  299.                      void*           ulArg6 = 0,
  300.                      void*           ulArg7 = 0
  301.                      )
  302.             {
  303.                 m_pThis    = pThis;
  304.                 m_TaskType = uTaskType;
  305.                 m_ulArg1   = ulArg1;
  306.                 m_ulArg2   = ulArg2;
  307.                 m_ulArg3   = ulArg3;
  308.                 m_ulArg4   = ulArg4;
  309.                 m_ulArg5   = ulArg5;
  310.                 m_ulArg6   = ulArg6;
  311.                 m_ulArg7   = ulArg7;
  312.             };
  313.       
  314.         PendingTaskType m_TaskType;
  315.         CHXBaseSite*    m_pThis;
  316.         void*           m_ulArg1;
  317.         void*           m_ulArg2;
  318.         void*           m_ulArg3;
  319.         void*           m_ulArg4;
  320.         void*           m_ulArg5;
  321.         void*           m_ulArg6;
  322.         void*           m_ulArg7;
  323.     };
  324.     /*
  325.      * SiteNonDelegatingUnknown methods
  326.      */
  327.     STDMETHOD(SiteNonDelegatingQueryInterface)  (THIS_ REFIID riid, void** ppvObj);
  328.     STDMETHOD_(ULONG32,SiteNonDelegatingAddRef) (THIS);
  329.     STDMETHOD_(ULONG32,SiteNonDelegatingRelease) (THIS);
  330.     
  331.     /*
  332.      * IUnknown
  333.      */
  334.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
  335.     STDMETHOD_(ULONG32,AddRef) (THIS);
  336.     STDMETHOD_(ULONG32,Release) (THIS);
  337.     /*
  338.      * IHXSiteWindowless
  339.      */
  340.     STDMETHOD(EventOccurred)(THIS_ HXxEvent* /*IN*/ pEvent);
  341.     STDMETHOD_(HXxWindow*,GetParentWindow)(THIS);
  342.     /*
  343.      * IHXSiteWindowed
  344.      */
  345.     STDMETHOD(AttachWindow) (THIS_ HXxWindow* /*IN*/ pWindow);
  346.     STDMETHOD(DetachWindow) (THIS);
  347.     STDMETHOD(Create) (THIS_ void* ParentWindow, UINT32 style);
  348.     STDMETHOD(Destroy) (THIS);
  349.     STDMETHOD_(HXxWindow*,GetWindow)(THIS);
  350.     /*
  351.      * IHXSite methods
  352.      */
  353.     STDMETHOD(AttachUser) (THIS_ IHXSiteUser*   /*IN*/  pUser);
  354.     STDMETHOD(DetachUser) (THIS);
  355.     STDMETHOD(GetUser) (THIS_ REF(IHXSiteUser*) /*OUT*/ pUser);
  356.     STDMETHOD(CreateChild) (THIS_ REF(IHXSite*)  /*OUT*/ pChildSite);
  357.     STDMETHOD(DestroyChild) (THIS_ IHXSite*       /*IN*/  pChildSite);
  358.     STDMETHOD(AttachWatcher) (THIS_ IHXSiteWatcher* /*IN*/ pWatcher);
  359.     STDMETHOD(DetachWatcher) (THIS);
  360.     STDMETHOD(SetPosition) (THIS_ HXxPoint position);
  361.     STDMETHOD(GetPosition) (THIS_ REF(HXxPoint) position);
  362.     STDMETHOD(SetSize) (THIS_ HXxSize size);
  363.     STDMETHOD(GetSize) (THIS_ REF(HXxSize) size);
  364.     STDMETHOD(DamageRect) (THIS_ HXxRect rect);
  365.     STDMETHOD(DamageRegion) (THIS_ HXxRegion region);
  366.     STDMETHOD(ForceRedraw) (THIS);
  367.     //
  368.     // IHXComposition methods
  369.     //
  370.     STDMETHOD(LockComposition) (THIS);
  371.     STDMETHOD(UnlockComposition) (THIS);
  372.     STDMETHOD(BltComposition) (THIS);
  373.     STDMETHOD(SetCompositionMode) (THIS_ BOOL OnOrOff);
  374.     STDMETHOD_(BOOL, IsCompositionLocked) (THIS);
  375.     STDMETHOD_(BOOL, IsCompositionMode) (THIS);
  376.     /*
  377.      * IHXSite2 methods
  378.      */
  379.     STDMETHOD(UpdateSiteWindow) (THIS_ HXxWindow* /*IN*/ pWindow);
  380.     STDMETHOD(ShowSite) (THIS_ BOOL    bShow);
  381.     STDMETHOD_(BOOL, IsSiteVisible) (THIS);
  382.     STDMETHOD(SetZOrder) (THIS_ INT32 lZOrder);
  383.     STDMETHOD(GetZOrder) (THIS_ REF(INT32) lZOrder);
  384.     STDMETHOD(MoveSiteToTop) (THIS);
  385.     STDMETHOD(GetVideoSurface) (THIS_ REF(IHXVideoSurface*) pSurface);
  386.     STDMETHOD_(UINT32,GetNumberOfChildSites) (THIS);
  387.     STDMETHOD(AddPassiveSiteWatcher) (THIS_ IHXPassiveSiteWatcher* pWatcher);
  388.     STDMETHOD(RemovePassiveSiteWatcher) (THIS_ IHXPassiveSiteWatcher* pWatcher);
  389.     STDMETHOD(SetCursor) (THIS_ HXxCursor cursor, REF(HXxCursor) oldCursor);
  390.     /*
  391.      *  IHXCallback methods
  392.      */
  393.     STDMETHOD(Func) (THIS);
  394.     /*
  395.      * IHXStatusMessage methods
  396.      */
  397.     
  398.     STDMETHOD(SetStatus) (THIS_ const char* pText);
  399.     /*
  400.      * IHXSiteFullScreen methods
  401.      */
  402.     STDMETHOD(EnterFullScreen) (THIS);
  403.     STDMETHOD(ExitFullScreen) (THIS);
  404.     STDMETHOD(TestFullScreen) (THIS_ void* hTestBitmap,const char* pszStatusText);
  405.     STDMETHOD_(BOOL, IsFullScreen) (THIS);
  406.     
  407.     /*
  408.      * IHXVideoControls methods
  409.      */
  410.     STDMETHOD_(float, GetBrightness) (THIS);
  411.     STDMETHOD(SetBrightness) (THIS_ float Brightness);
  412.     STDMETHOD_(float, GetContrast) (THIS);
  413.     STDMETHOD(SetContrast) (THIS_ float Contrast);
  414.     STDMETHOD_(float, GetSaturation) (THIS);
  415.     STDMETHOD(SetSaturation) (THIS_ float Saturation);
  416.     STDMETHOD_(float, GetHue) (THIS);
  417.     STDMETHOD(SetHue) (THIS_ float Hue);
  418.     STDMETHOD_(float, GetSharpness) (THIS);
  419.     STDMETHOD(SetSharpness) (THIS_ float Sharpness);
  420.     STDMETHOD(SetModeSharpness) (THIS_ UINT16 dFlag);
  421.     /************************************************************************
  422.      *  Method:
  423.      *      IHXInterruptSafe::IsInterruptSafe
  424.      *  Purpose:
  425.      *      This is the function that will be called to determine if
  426.      *      interrupt time execution is supported.
  427.      */
  428.     STDMETHOD_(BOOL,IsInterruptSafe) (THIS);
  429.     /*
  430.      * IHXSiteTransition methods
  431.      */
  432.     STDMETHOD(Initialize) (THIS_ IHXValues* pParams) ;
  433.     STDMETHOD(SetPercentage) (THIS_ UINT32 nThousandnthsComplete) ;
  434.     /*
  435.      * IHXKeyBoardFocus methods
  436.      */
  437.     STDMETHOD(SetKeyboardFocus)(THIS_ IHXSiteUser* pSiteUser );
  438.     STDMETHOD(GetKeyboardFocus)(THIS_ IHXSiteUser* &pSiteUser );
  439.     /*
  440.      * IHXDrawFocus methods
  441.      */
  442.     STDMETHOD(SetStyle)(THIS_ IHXValues* pProperties);
  443.     STDMETHOD(ClearFocus)(THIS);
  444.     STDMETHOD(SetFocusPolygon)(THIS_  HXxPoint* pPoints, ULONG32 numPoints);
  445.     STDMETHOD(SetFocusRect) (THIS_ HXxRect* pRect);
  446.     STDMETHOD(SetFocusEllipse) (THIS_ HXxRect* pRect);
  447.     /*
  448.      * IHXSubRectSite methods
  449.      */
  450.     STDMETHOD(SendSubRectMessages) (THIS_ BOOL bRet );
  451.     STDMETHOD(SubRectDamageRegion) (THIS_ HXxBoxRegion* pRegion );
  452.     STDMETHOD(GetSubRectVideoSurface)(THIS_ REF(IHXSubRectVideoSurface*) pSurface );
  453.     //
  454.     // Debug methods...
  455.     //
  456.     void DisplaySiteData(const char *);
  457.     void DisplayChildSiteData(const char *);
  458.     void DisplayAllSiteData();
  459.     void VerifyNoDups( CHXMapPtrToPtr& map, HXREGION* reg );
  460.    
  461.     //
  462.     //InLine Methods
  463.     //
  464.     void SetOrigin(HXxPoint* pOrigin) {memcpy(&m_topleft, pOrigin, sizeof(HXxPoint));} /* Flawfinder: ignore */
  465.     HXxPoint* GetOrigin() {return &m_topleft;}
  466.     void SetInternalZOrder(INT32 lZOrder) {m_lZOrder = lZOrder;};
  467.     void SetFocusSite(CHXBaseSite* pFocusSite) {m_pFocusSite = pFocusSite;}
  468.     CHXBaseSite* GetFocusSite() {return m_pFocusSite;}
  469.     BOOL IsMoving() {return FALSE;}//m_bMoving;}
  470.    
  471.     //
  472.     // Internal Functions
  473.     //
  474.     CHXBaseSite(IUnknown* pContext, IUnknown* pUnkOuter = NULL, INT32 lZorder = 0);
  475.     virtual         ~CHXBaseSite();
  476.     CBaseRootSurface* GetRootSurface();
  477.    
  478.     void            SetParentSite(CHXBaseSite* pParentSite);
  479.     void            SetTopLevelSite(CHXBaseSite* pTop);
  480.     CHXBaseSite*    GetParentSite() {return m_pParentSite;}
  481.     CHXBaseSite*    GetTopLevelSite();
  482.     CHXBaseSite*    GetContainingCHXBaseSite();
  483.     void            UpdateZOrder( CHXBaseSite* pUpdatedChildSite,
  484.                                   INT32 lOldZOrder,
  485.                                   INT32 lNewZOrder);
  486.     HXxPoint        GetScreenOffset();
  487.     void            SetXSliderRange(INT32);
  488.     INT32           GetXSliderRange();
  489.     void            SetYSliderRange(INT32);
  490.     INT32           GetYSliderRange();
  491.     INT32           GetXSliderPos();
  492.     INT32           GetYSliderPos();
  493.     INT32           GetSliderWidth();
  494.     INT32           GetSliderHeight();
  495.     void            GetWindowRect(HXxRect* pRect);
  496.     void            GetExtentsWithoutChildren(HXxRect* pRect);
  497.     void            RecursiveSizeSliders();
  498.     void            SizeSliders();
  499.     void            FuncSizeSliders();
  500.     HX_RESULT       ConvertStringToXYDepth(const char* pszModeString,
  501.                                            REF(INT32) x,
  502.                                            REF(INT32) y,
  503.                                            REF(INT32) depth);
  504.     void            SetDisplayMode();
  505.     BOOL            GenerateMouseLeaveMessage();
  506.     void            CheckExposeEvents();
  507.     BOOL            ComputeSubRects();
  508.     void            BuildParnetClipping( HXREGION* hClip, CHXBaseSite* pChild );
  509.     BOOL            m_bUsingList;
  510.     void            SetClipping();
  511.     BOOL            AreVideoControlsActive();
  512.     BOOL            IsHigherZOrderTranstitionActive();
  513.     void            FindLinkedSites();
  514.    
  515.     //Alpha blending support....
  516.     CHXMapPtrToPtr  m_AlphaBlendSites;     //Who is under us that we blend with
  517.     CHXMapPtrToPtr  m_AlphaBlendNotifiers; //who we notify when we change.
  518.     BOOL            m_bSiteNeverBlts;
  519.     BOOL            _CheckForVisibleChild();
  520.     void            AlphaBlendComputeSubRects( CHXBaseSite* pIgnoredSite );
  521.     void            AlphaBlendBuildParnetClipping( HXREGION* hClip,
  522.                                                    CHXBaseSite* pChild,
  523.                                                    CHXBaseSite* pIgnoredSite );
  524.     void            _RemoveAllNotifiers();
  525.     void            _RemoveAllYUVImageLists();
  526.     void            _EmptyBlenderList();
  527.     void            _EmptyNotifierList();
  528.     void            _AlphaBlendAddNotifier(CHXBaseSite* it);
  529.     void            _RemoveHigherOrderSiblings( HXREGION* hClip, CHXBaseSite* pChild );
  530.     BOOL            _BlendedBordersActive();
  531.     BOOL            _FadeTransitionActive();
  532.     BOOL            _BordersActive();
  533.     BOOL            _IsAlphaBlending();
  534.    
  535.     //End alpha support....
  536.     //IHXComposition support
  537.     BOOL            m_bCompositionLocked;
  538.     BOOL            m_bCompositionMode;
  539.     void            UpdateModes();
  540.     BOOL            DoesPrefExist(INT32 resolutionX,
  541.                                   INT32 resolutionY,
  542.                                   INT32 colorDepth);
  543.     void            UpdatePrefs(INT32 resolutionX,
  544.                                 INT32 resolutionY,
  545.                                 INT32 colorDepth,
  546.                                 ULONG32 ulBltTime,
  547.                                 BOOL bPassed,
  548.                                 BOOL bTested);
  549.    
  550.     void              ScheduleCallback( INT32 nWhichCallback,
  551.                                         INT32 nMilliseconds,
  552.                                         BOOL  bOverrideCompositionMode=FALSE);
  553.     BOOL            IsPointInClippingRegion(HXxPoint* pPoint);
  554.     void            SetEvent(REF(HXxEvent) theEvent,
  555.                              ULONG32 event,
  556.                              void* window,
  557.                              void* param1,
  558.                              void* param2);
  559.     void            CheckDisplayMode(void* hdc);
  560.     void            ChangeResolution();
  561.     void            DestroySurfaces();
  562.     void            ReInitSurfaces();
  563.     void            RecomputeClip();
  564.     void             FindVideoSites();
  565.     INT32           GetTopMostSiteZOrder();
  566.     void            SetParentWindow(HXxWindow* pWindow);
  567.     void            SetRootSurface(CBaseRootSurface* pSurface);
  568.     void            CheckColorSettings();
  569.     BOOL            SharpenImage( HXBitmapInfoHeader* pOptimizedFormat,
  570.                                   UCHAR* pImageBits,
  571.                                   REF(HXxRect) rSrcRect);
  572.     void            SiteMoving(INT32 x, INT32 y);
  573.     void            ResetOrigin();
  574.     void            GetAbsoluteCords(REF(HXxPoint) point);
  575.     void            AboutToBlt();
  576.     void            FillColorKey();
  577.     BOOL            SafeMoveWindow(void* hWnd,
  578.                                    INT32 X,
  579.                                    INT32 Y,
  580.                                    INT32 nWidth,
  581.                                    INT32 nHeight,
  582.                                    BOOL bRepaint);
  583.     BOOL            SafeUpdateWindow(void* hWnd);
  584.     BOOL            SafeShowWindow(void* hWnd, INT32 nCmdShow);
  585.     BOOL            SafeSetWindowPos(void* hWnd,
  586.                                      void* hWndInsertAfter,
  587.                                      INT32 X,
  588.                                      INT32 Y,
  589.                                      INT32 cx,
  590.                                      INT32 cy,
  591.                                      UINT uFlags);
  592.     INT32           SafeSetWindowRgn(void* hWnd, HXREGION* hRgn, BOOL bRedraw);
  593.     void            SafeSetXSliderRange(INT32 range);
  594.     void            SafeSetYSliderRange(INT32 range);
  595.     void            SafeSetFocus(HXxWindow* pWindow);
  596.     HX_RESULT       _SafeSetSize(HXxSize size);
  597.     HX_RESULT       _SafeSetPosition(HXxPoint position);
  598.    
  599.     void            ExecutePendingTasks();
  600.     void            RemovePendingTasks(CHXBaseSite*);
  601.     void            ResetUpdateOverlay();
  602.     void            SiteNotMoving();
  603.     void            _ForceRedrawAll();
  604.     void            InternalForceRedraw();
  605.     void            LockBlitters();
  606.     void            UnlockBlitters();
  607.     void            FlushSurfaces();
  608.     
  609.     void            DisableColorControls(float &fBrightness,
  610.                                          float &fContrast,
  611.                                          float &fSaturation,
  612.                                          float &fHue);
  613.     void            EnableColorControls(float fBrightness,
  614.                                         float fContrast,
  615.                                         float fSaturation,
  616.                                         float fHue);
  617.     /*
  618.      * Small HXColor support
  619.      */
  620.     void ColorConverterRequest(int CIDin, int CIDout, BOOL bFoundConverter);
  621.     void InternalColorConverterRequest(int CIDin, int CIDout, BOOL bFoundConverter, CHXBaseSite* pSite);
  622.     void ScheduleUpgrade();
  623.     void InternalScheduleUpgrade(UINT32 CIDIn, UINT32 CIDOut, IHXSite* pSite);
  624.     /*
  625.      *  OS Specific Functions
  626.      */
  627.     /************************************************************************
  628.      *  Method:
  629.      *      _NeedWindowedSite
  630.      *  Purpose:
  631.      *      Create a windowed site
  632.      */
  633.     virtual void        _NeedWindowedSite() = 0;
  634.     /************************************************************************
  635.      *  Method:
  636.      *      _AttachWindow
  637.      *  Purpose:
  638.      *      A window is assigned to the site so perform any required window
  639.      *      initialization code.
  640.      */
  641.     virtual void        _AttachWindow() = 0;
  642.     /************************************************************************
  643.      *  Method:
  644.      *      _DetachWindow
  645.      *  Purpose:
  646.      *      The window is removed from the site so perform any required window
  647.      *      clean-up code.
  648.      */
  649.     virtual void        _DetachWindow() = 0;
  650.     /************************************************************************
  651.      *  Method:
  652.      *      _Create
  653.      *  Purpose:
  654.      *      Create a window of type style with ParentWindow as its parent
  655.      */
  656.     virtual void*       _Create(void* ParentWindow, UINT32 style) = 0;
  657.     /************************************************************************
  658.      *  Method:
  659.      *      _Destroy
  660.      *  Purpose:
  661.      *      Destroy this window
  662.      */
  663.     virtual void        _Destroy(HXxWindow* pWindow) = 0;
  664.     /************************************************************************
  665.      *  Method:
  666.      *      _SetSize
  667.      *  Purpose:
  668.      *      Set the size of the window to size
  669.      */
  670.     virtual void        _SetSize(HXxSize size) = 0;
  671.     /************************************************************************
  672.      *  Method:
  673.      *      _SetPosition
  674.      *  Purpose:
  675.      *      Set the position of the window to position
  676.      */
  677.     virtual void        _SetPosition(HXxPoint position) = 0;
  678.     /************************************************************************
  679.      *  Method:
  680.      *      _DamageRect
  681.      *  Purpose:
  682.      *      Mark this area of the window for redrawing
  683.      */
  684.     virtual void        _DamageRect(HXxRect rect) = 0;
  685.     /************************************************************************
  686.      *  Method:
  687.      *      _DamageRegion
  688.      *  Purpose:
  689.      *      Mark this area of the window for redrawing
  690.      */
  691.     virtual void        _DamageRegion(HXxRegion rect) = 0;
  692.     /************************************************************************
  693.      *  Method:
  694.      *      _ShouldEnterForceRedraw
  695.      *  Purpose:
  696.      *      Serialize our drawing routines
  697.      */
  698.     virtual BOOL        _ShouldEnterForceRedraw() = 0;
  699.     /************************************************************************
  700.      *  Method:
  701.      *      _ExitForceRedraw
  702.      *  Purpose:
  703.      *      Serialize our drawing routines
  704.      */
  705.     virtual void        _ExitForceRedraw() = 0;
  706.     /************************************************************************
  707.      *  Method:
  708.      *      _SendOSUpdateMessage
  709.      *  Purpose:
  710.      *      Instruct the window to update itself
  711.      */
  712.     virtual void        _SendOSUpdateMessage() = 0;
  713.     /************************************************************************
  714.      *  Method:
  715.      *      _ShowSite
  716.      *  Purpose:
  717.      *      Show/hide the site
  718.      */
  719.     virtual void        _ShowSite(BOOL bShow) = 0;
  720.     /************************************************************************
  721.      *  Method:
  722.      *      _AtSystemTime
  723.      *  Purpose:
  724.      *      Determines if this call is on the main app thread
  725.      */
  726.     virtual BOOL        _AtSystemTime() = 0;
  727.     /************************************************************************
  728.      *  Method:
  729.      *      _EventOccurred
  730.      *  Purpose:
  731.      *      Process the current event
  732.      */
  733.     virtual HX_RESULT   _EventOccurred(HXxEvent* /*IN*/ pEvent) = 0;
  734.     /************************************************************************
  735.      *  Method:
  736.      *      _GetDeviceCaps
  737.      *  Purpose:
  738.      *      Query the current display mode for bit depth, width and height
  739.      */
  740.     virtual void        _GetDeviceCaps( void* hdc,
  741.                                         UINT16& uBitesPerPixel,
  742.                                         UINT16& uHorzRes,
  743.                                         UINT16& uVertRes) = 0;
  744.     /************************************************************************
  745.      *  Method:
  746.      *      _GetWindowRect
  747.      *  Purpose:
  748.      *      Get the screen coordinates of the window
  749.      */
  750.     virtual void        _GetWindowRect(HXxRect* destRect) = 0;
  751.     /************************************************************************
  752.      *  Method:
  753.      *      _DestroySliders
  754.      *  Purpose:
  755.      *      Destroys the x/y scroll bars
  756.      */
  757.     virtual void        _DestroySliders() = 0;
  758.     /************************************************************************
  759.      *  Method:
  760.      *      _HandleOSEvents
  761.      *  Purpose:
  762.      *      Handle this event
  763.      */
  764.     virtual BOOL        _HandleOSEvents(HXxEvent* /*IN*/ pEvent) = 0;
  765.     /************************************************************************
  766.      *  Method:
  767.      *      _ConvertToHXEvent
  768.      *  Purpose:
  769.      *      Convert an OS event to a Helix event
  770.      */
  771.     virtual BOOL        _ConvertToHXEvent( HXxEvent* pEvent ) = 0;
  772.     /************************************************************************
  773.      *  Method:
  774.      *      _GenerateOSEvent
  775.      *  Purpose:
  776.      *      Generate an OS event from a Helix event
  777.      */
  778.     virtual void        _GenerateOSEvent(HXxEvent* pEvent, HXxEvent* pEvent2) = 0;
  779.     /************************************************************************
  780.      *  Method:
  781.      *      _GenerateSetCursorEvent
  782.      *  Purpose:
  783.      *      Generate as OS set cursor event
  784.      */
  785.     virtual void        _GenerateSetCursorEvent() = 0;
  786.     /************************************************************************
  787.      *  Method:
  788.      *      _EnterFullScreen
  789.      *  Purpose:
  790.      *      Enter into full screen display mode
  791.      */
  792.     virtual HX_RESULT   _EnterFullScreen() = 0;
  793.     /************************************************************************
  794.      *  Method:
  795.      *      _ExitFullScreen
  796.      *  Purpose:
  797.      *      Leave full screen display mode
  798.      */
  799.     virtual HX_RESULT   _ExitFullScreen() = 0;
  800.     /************************************************************************
  801.      *  Method:
  802.      *      _TestFullScreen
  803.      *  Purpose:
  804.      *      Test full screen performance
  805.      */
  806.     virtual HX_RESULT   _TestFullScreen( void* hTestBitmap,
  807.                                          const char* pszStatusText) = 0;
  808.     /************************************************************************
  809.      *  Method:
  810.      *      _TryCreateXSlider
  811.      *  Purpose:
  812.      *      Create a horizontal scroll bar
  813.      */
  814.     virtual void _TryCreateXSlider() = 0;
  815.     /************************************************************************
  816.      *  Method:
  817.      *      _SetXSliderValues
  818.      *  Purpose:
  819.      *      Set the range and step size of the horizontal scroll bar
  820.      */
  821.     virtual void _SetXSliderValues(INT32 range, INT32 pageSize) = 0;
  822.     /************************************************************************
  823.      *  Method:
  824.      *      _TryCreateYSlider
  825.      *  Purpose:
  826.      *      Create a vertical scroll bar
  827.      */
  828.     virtual void _TryCreateYSlider() = 0;
  829.     /************************************************************************
  830.      *  Method:
  831.      *      _SetYSliderValues
  832.      *  Purpose:
  833.      *      Set the range and step size of the vertical scroll bar
  834.      */
  835.     virtual void _SetYSliderValues(INT32 range, INT32 pageSize) = 0;
  836.     /************************************************************************
  837.      *  Method:
  838.      *      _GetSystemSizeOfSliders
  839.      *  Purpose:
  840.      *      Get the pixel size of a scroll bar
  841.      */
  842.     virtual void _GetSystemSizeOfSliders(INT32* pWidth, INT32* pHeight) = 0;
  843.     /************************************************************************
  844.      *  Method:
  845.      *      _IsWindowVisible
  846.      *  Purpose:
  847.      *      Is this site's window visible
  848.      */
  849.     virtual BOOL _IsWindowVisible() = 0;
  850.     /************************************************************************
  851.      *  Method:
  852.      *      _ShowXSlider
  853.      *  Purpose:
  854.      *      Show/hide the horizontal scroll bar
  855.      */
  856.     virtual void _ShowXSlider(BOOL bShow) = 0;
  857.     /************************************************************************
  858.      *  Method:
  859.      *      _MoveXSlider
  860.      *  Purpose:
  861.      *      Set the size and position of the horizontal scroll bar
  862.      */
  863.     virtual void _MoveXSlider(INT32 left, INT32 top,
  864.                               INT32 right, INT32 bottom,
  865.                               BOOL bRedraw) = 0;
  866.     /************************************************************************
  867.      *  Method:
  868.      *      _ShowXSlider
  869.      *  Purpose:
  870.      *      Show/hide the vertical scroll bar
  871.      */
  872.     virtual void _ShowYSlider(BOOL bShow) = 0;
  873.     /************************************************************************
  874.      *  Method:
  875.      *      _MoveYSlider
  876.      *  Purpose:
  877.      *      Set the size and position of the vertical scroll bar
  878.      */
  879.     virtual void _MoveYSlider(INT32 left, INT32 top,
  880.                               INT32 right, INT32 bottom,
  881.                               BOOL bRedraw) = 0;
  882.     
  883.     /************************************************************************
  884.      *  Method:
  885.      *      _DoesXSliderExist
  886.      *  Purpose:
  887.      *      Have we created a horizontal slider
  888.      */
  889.     virtual BOOL _DoesXSliderExist() = 0;
  890.     /************************************************************************
  891.      *  Method:
  892.      *      _GetContainingWindow
  893.      *  Purpose:
  894.      *      Get the window that contains the full screen window
  895.      */
  896.     virtual void*_GetContainingWindow() = 0; // XXXAH void*? Not HXxWindow??
  897.     /************************************************************************
  898.      *  Method:
  899.      *      _GetCursorPos
  900.      *  Purpose:
  901.      *      Get the position of the cursor in screen coordinates
  902.      */
  903.     virtual void _GetCursorPos(HXxPoint* pPoint) = 0;
  904.     /************************************************************************
  905.      *  Method:
  906.      *      _MapPointToOSWindow
  907.      *  Purpose:
  908.      *      Find which window contains this point
  909.      */
  910.     virtual void _MapPointToOSWindow(HXxPoint* pPt, void** pWindowHandle) = 0;
  911.    
  912.     /************************************************************************
  913.      *  Method:
  914.      *      _GetWindowWithCursor
  915.      *  Purpose:
  916.      *      This returns the OS specific window handle, as void*, that the
  917.      *      pointer is currently in.
  918.      */
  919.     virtual void* _GetWindowWithCursor() = 0;
  920.     /************************************************************************
  921.      *  Method:
  922.      *      _ReInitPrimarySurface
  923.      *  Purpose:
  924.      *      Restore the primary surface, if necessary, after a mode/resolution
  925.      *      change.
  926.      */
  927.     virtual void  _ReInitPrimarySurface() = 0; // XXXAH may want to move this to root.
  928.                  
  929.     /************************************************************************
  930.      *  Method:
  931.      *      _MoveWindow
  932.      *  Purpose:
  933.      *      Change the size and position of the window.  For the top level
  934.      *      site, these are screen coordinates, for children sites, they
  935.      *      are relative.
  936.      */
  937.     virtual BOOL  _MoveWindow( void* ,
  938.                                INT32 X, INT32 Y,
  939.                                INT32 nWidth, INT32 nHeight,
  940.                                BOOL bRepaint) = 0;
  941.     /************************************************************************
  942.      *  Method:
  943.      *      _UpdateWindow
  944.      *  Purpose:
  945.      *      Sends an OS message to the window to updat the client area
  946.      */
  947.     virtual BOOL  _UpdateWindow(void* hWnd) = 0;
  948.     /************************************************************************
  949.      *  Method:
  950.      *      _ShowWindow
  951.      *  Purpose:
  952.      *      Show/hide the window
  953.      */
  954.     virtual BOOL  _ShowWindow(void* hWnd, INT32 nCmdShow) = 0;
  955.     /************************************************************************
  956.      *  Method:
  957.      *      _SetWindowPos
  958.      *  Purpose:
  959.      *      Sets the size, position, and z-order of the window
  960.      */
  961.     virtual BOOL  _SetWindowPos(void* hWnd,
  962.                                 void* hWndInsertAfter,
  963.                                 INT32 X, INT32 Y,
  964.                                 INT32 cx, INT32 cy,
  965.                                 INT32 uFlags) = 0;
  966.     virtual void  _DrawFocusRect(UCHAR* pImage,
  967.                                  HXBitmapInfoHeader* pImageInfo,
  968.                                  HXxRect* pImageSize,
  969.                                  void* pOsSpecificData=NULL);
  970.     BOOL           HasFocusRect() {return m_rcFocusRect.bRectActive;}
  971.     
  972.     void ManageExposeEvents( HXxRect* dirtyRect );
  973.     void _RecursiveDamageRect( HXxRect* dirtyRect, BOOL bForce=FALSE );
  974.     void DamageRectWindowRel(HXxRect rect);
  975.     // this is going to be a nice one.
  976.     virtual BOOL _SetWindowRgn(void* hWnd, HXREGION* hRgn, BOOL bRedraw) = 0;
  977.     // XXXAH it would be nice to get the return value here
  978.     virtual void _SetFocus(void* pWindow) = 0;
  979.     BOOL         _TakesPartInAlphaChain();
  980.     HXREGION*      Transition(INT32 left, INT32 top, INT32 right, INT32 bottom, tranLines* lines = NULL);
  981.     //XXXgfw just some hacks to help us get trylocks with the top
  982.     //level site mutexes.
  983.     void _TLSLock();
  984.     void _TLSUnlock();
  985.     BOOL _TLSIsLocked();
  986.     inline BOOL SiteScaleingInfoAvailable(){
  987.         return m_bSiteScalingInfo;
  988.     }
  989.     
  990.   protected:
  991.     void         _HandleMouseEvent(HXxEvent* pEvent);
  992.     CHXBaseSite* _GetSiteFromPixel(HXxPoint& point);
  993.     virtual void CreateColorAccess(IUnknown* pUnk) {zm_pColorAcc = new ColorFuncAccess(pUnk);}
  994.     
  995.     INT32      m_nTLSMutexLockCount;
  996.     UINT32     m_ulTLSMutexOwningThread;
  997.     HXThread* m_pDummyThread;
  998.     BOOL       m_bMoving;
  999.     BOOL       m_bUserWantsSubRects;
  1000.     BOOL       m_bSiteScalingInfo;
  1001. };
  1002. class BaseSiteCallback : public IHXCallback
  1003. {
  1004.   public:
  1005.     CHXBaseSite*  m_pSite;
  1006.     CBaseSurface* m_pSurf;
  1007.    
  1008.     BaseSiteCallback(CHXBaseSite* pSite);
  1009.     ~BaseSiteCallback();
  1010.     /*
  1011.      *  IUnknown methods
  1012.      */
  1013.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
  1014.     STDMETHOD_(ULONG32,AddRef) (THIS);
  1015.     STDMETHOD_(ULONG32,Release) (THIS);
  1016.     /*
  1017.      *  IHXCallback methods
  1018.      */
  1019.     STDMETHOD(Func) (THIS);
  1020.   protected:
  1021.     LONG32 m_lRefCount;
  1022. };
  1023. class ScrollSiteCallback : public IHXCallback
  1024. {
  1025. public:
  1026.     ScrollSiteCallback(CHXBaseSite* pSite);
  1027.     ~ScrollSiteCallback();
  1028.     /*
  1029.      *  IUnknown methods
  1030.      */
  1031.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
  1032.     STDMETHOD_(ULONG32,AddRef) (THIS);
  1033.     STDMETHOD_(ULONG32,Release) (THIS);
  1034.     /*
  1035.      *  IHXCallback methods
  1036.      */
  1037.     STDMETHOD(Func) (THIS);
  1038. protected:
  1039.     LONG32       m_lRefCount;
  1040.     CHXBaseSite* m_pSite;
  1041. };
  1042. #endif /* _BASESITE_H_ */