chxavviewbase.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:3k
源码类别:

Symbian

开发平台:

Visual C++

  1. /************************************************************************
  2.  * chxavviewbase.h
  3.  * ---------------
  4.  *
  5.  * Synopsis:
  6.  * Contains the declaration of the CHXAvViewBase class.  This class 
  7.  * constains some common routines to all of the views.
  8.  *
  9.  * Target:
  10.  * Symbian OS
  11.  *
  12.  *
  13.  * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
  14.  *
  15.  ************************************************************************/
  16. #ifndef _chxavviewbase_h_
  17. #define _chxavviewbase_h_
  18. // Includes...
  19. #include <aknview.h>
  20. #include <aknconsts.h>
  21. #include <akntitle.h>
  22. #include <aknnavide.h>
  23. #include <akncontext.h>
  24. #include "chxavrefptr.h"
  25. // Forward declarations...
  26. class CHXAvPlayerUI;
  27. // CHXAvVewBase declaration...
  28. class CHXAvViewBase : public CAknView
  29. {
  30. public:
  31.     virtual ~CHXAvViewBase();
  32. protected:
  33.     // Keeping this a virtual class only....
  34.     CHXAvViewBase(TInt viewIndex, CHXAvPlayerUI *playerUI);
  35.     virtual void ConstructL();    
  36. public:
  37.     
  38.     CHXAvPlayerUI *GetPlayerUI();
  39.     TUid Id() const;
  40.     TInt GetBackView() const;
  41.     void SetBackView(TInt idxView);
  42.     virtual void HandleLosePlayFocus();
  43.     void SetDefaultAppTitleL();
  44.     void RestoreDefaultNaviPaneL();
  45. public:
  46.     // CAknView methods...
  47.     void DoActivateL(const TVwsViewId& prevViewID, TUid customMsgID, const TDesC8& customMsg);
  48.     void DoDeactivate();
  49.     void HandleStatusPaneSizeChange();
  50.     void HandleForegroundEventL(TBool bEnterForeground);
  51.     void HandleCommandL(TInt command);
  52.     void ProcessCommandL(TInt cmd);
  53.     // CHXAvViewBase
  54.     virtual void UpdateViewStateL();
  55.     virtual CCoeControl* CreateViewWindowForActivatingViewL() = 0; 
  56.     virtual void FinishViewActivateL();
  57.     virtual void FinishViewDeactivateL() = 0;
  58.     CCoeControl* GetWindow();
  59. protected:
  60.     void ShowPopupMenuL(TInt idRes);
  61.     void ClosePopupMenu();
  62.     void ShowPopupMenuHelperL(TInt idRes);
  63. protected:
  64.     TInt m_backViewIndex;
  65.     TInt m_viewIndex;
  66.     CAknContextPane*                    m_contextPane;
  67.     CEikStatusPane*                     m_statusPane;
  68.     CAknNavigationControlContainer*     m_naviPane;
  69.     CAknTitlePane*                      m_titlePane;
  70.     CHXAvPlayerUI*                      m_playerUI;
  71.     refptr<CEikMenuBar>                 m_pMenuPopup;
  72. private:
  73.     CCoeControl* m_window;
  74.     bool m_bFirstForegroundEventPending;
  75. };
  76. #define HXPLAYER_DEFINE_CREATE(CLASS_NAME) 
  77. public: 
  78.     static CLASS_NAME* NewL(TInt idxView, CHXAvPlayerUI *pContext); 
  79.     virtual ~CLASS_NAME(); 
  80. private: 
  81.     CLASS_NAME(TInt idxView, CHXAvPlayerUI *pContext); 
  82.     virtual void ConstructL();
  83.     
  84. #define HXPLAYER_IMPLEMENT_STATIC_CREATE(CLASS_NAME) 
  85. CLASS_NAME* CLASS_NAME::NewL(TInt idxView, CHXAvPlayerUI* pContext) 
  86.     CLASS_NAME* pView = new(ELeave) CLASS_NAME(idxView, pContext); 
  87.     AUTO_PUSH_POP(pView); 
  88.     pView->ConstructL(); 
  89.     return pView; 
  90. }
  91. inline
  92. CCoeControl* CHXAvViewBase::GetWindow()
  93. {
  94.     return m_window;
  95. }
  96. inline
  97. CHXAvPlayerUI *CHXAvViewBase::GetPlayerUI() 
  98. {
  99.     return m_playerUI;
  100. }
  101. inline
  102. TInt CHXAvViewBase::GetBackView() const
  103. {
  104.     return m_backViewIndex;
  105. }
  106. inline
  107. void CHXAvViewBase::SetBackView(TInt idxView)
  108. {
  109.     HX_ASSERT(idxView != m_viewIndex); // back to self
  110.     m_backViewIndex = idxView;
  111. }
  112. #endif // _chxavviewbase_h_