chxavfileviewwindow.h

来自「symbian 下的helix player源代码」· C头文件 代码 · 共 259 行

H
259
字号
/************************************************************************
 * chxavfileviewwindow.h
 * ---------------------
 *
 * Synopsis:
 * Contains the declaration of the CHXAvFileViewWindow class.  This class 
 * is instantiates and communicates with the actual controls of the file
 * view.
 *
 * Target:
 * Symbian OS
 *
 *
 * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
 *
 ************************************************************************/

#ifndef _chxavfileviewwindow_h_
#define _chxavfileviewwindow_h_

// Symbian includes...
#include <eiklbo.h> 
#include <aknlists.h>

// Helix includes...
#include "hxlist.h"

// Include from this project...
#include "chxavrefptr.h"
#include "chxavfileui.h"
#include "chxavfilestore.h"
#include "chxavplaylist.h"
#include "chxsmartptr.h"
#include "chxbody.h"
#include "chxavfileviewpageinfo.h"
#include "chxavnamedisplaytrait.h"
#include "chxavcommand.h"


// Forward declarations...
class CHXAvViewBase;
class CHXAvPlayerUI;
class CHXAvFileView;
class CEikColumnListBox;
//class CAknSearchField;
class CSendAppUi;


// CHXAvFileViewWindow 
class CHXAvFileViewWindow 
: public CCoeControl
, public MEikListBoxObserver
, public CHXBody
, private CHXAvNameDisplayTrait
{
public:
    CHXAvFileViewWindow();
    virtual ~CHXAvFileViewWindow();
    void ConstructL(const TRect& rc, CHXAvPlayerUI *playerUI, CHXAvFileView* pFileView, 
                    const refptr<CHXAvFileViewPageInfoVector>& spPageInfo, TInt idxCurrentPage = 0);

    void UpdateTopAndBottomL();
    void UpdateNaviPaneL();
    void SaveCurrentPageInfoL();


    // User commands...
    void UserNewFolderL();
    void UserEditCurrentItemL();
    void UserOpenCurrentItemL();
    void UserSwitchToParentFolderAndRefreshL();
    void UserDeleteSelectedItemsL();
    void UserRenameCurrentItemL();
    void UserMoveSelectedItemsL();
    void UserCopySelectedItemsL();
    void UserMarkL(TInt command);
    void UserSendSelectedItemsL(TInt command, CSendAppUi* pSendAppUi);
    void UserUnlockDriveL();
    //void UserAddSelectedToPinboardL();

    // CCoeControl overrides...
    CCoeControl* ComponentControl( TInt aIndex ) const;
    TInt CountComponentControls() const;
    void GetHelpContext(TCoeHelpContext& aContext) const;

    void SizeChanged();
    TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
    bool IsEmpty() const;
    TInt GetCurrentPageIndex() const;
   

    bool HilightItemIsMarked() const;
    bool IsCreateChildFolderAllowed() const;
    bool HilightItemIsFile() const;
    TInt GetMarkedItemCount() const;
    TInt GetUnmarkedItemCount() const;
    bool HilightItemIsPlaylist() const;
    bool IsAtRoot() const;
    bool IsDriveLocked() const;

    bool HasHilightItem() const;
    const TDesC& GetFullPath() const;
    const CHXAvFileStorePtr& GetStore() const;

    CDesCArray* GetModelTextArray();
    void OnCompleteUnlockAttempt(TInt err);

    // MEikListBoxObserver
    void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);

private:

    enum ShiftMarkState
    {
        smNotMarking,
        smShiftMark,
        smShiftUnMark
    };
private:
    
    // XXXLCM new
    void ReloadCurrentPageL();
    void ResetCurrentPageInfoToRootL();
    bool DoUpdateAndCheckDriveStateL();
    void LoadPageL(TInt idxPage);
    void InitFileStoreL();
    void InitEmptyListTextL();
    void BeginWatchingForDriveEventsL();
    void HandlePossibleCurrentFolderChangeL();

    // Helper functions...
    void CreateFileViewListBoxL();
    TInt SwitchToChildFolderAndRefreshL(const TDesC& folder);
    
    void CreateTabsL(TInt idxInitTab);
    void CleanUpTabs();
    TInt GetBestIndex(TInt idxWanted) const;
    void SyncToCurrentPageL();
    void RefreshListBoxL(TInt idxLastCurrentItem = 0, const TDesC& currentItemName = KNullDesC);
    void SetListBoxSelectionAndDrawL(TInt idxLastCurrentItem,const TDesC& currentItemName);
    void AddListItemsForCurrentPathL(CDesCArrayFlat*& pItems) const;
    CDesCArrayFlat* CreateListItemsL() const;
    const CHXAvFile::FileInfo&  GetFileInfoL(TInt idx) const;
    HBufC* AllocFolderItemTextL(const TEntry& entry) const;
    void OnFileSystemEvent();
    void HandleFileSystemEventL();
    HBufC* AllocFileItemTextL(const CHXAvFile::FileInfo& info) const;
    HBufC* AllocPlayListDescriptionL(const CHXAvFile::FileInfo& info) const;
   
    CHXAvPlaylistPtr CreatePlaylist(const TEntry& entry) const;
    
 
    // key handling implementation (OfferKeyEventL() helpers)
    TKeyResponse HandleEventKeyEventL(const TKeyEvent& event);
    TKeyResponse HandleKeyDownEventL(const TKeyEvent& event);
    TKeyResponse HandleKeyUpEventL(const TKeyEvent& event);
    TKeyResponse HandleShiftMarkKeyL(TInt keyCode);

    void CreateAndAddIconsL();

private:

    // Controls...
    CEikFormattedCellListBox* m_pListBox;
    CHXAvFileView* m_pFileView;
    CHXAvPlayerUI* m_playerUI;
    refptr<CHXAvFileViewPageInfoVector> m_spPageInfo;
    CHXAvFileViewPageInfoPtr m_spCurrentPage;

    CHXAvFileStorePtr     m_spStore;
    CHXAvFileUIPtr        m_spFileUI;

    refptr<CAknNavigationDecorator> m_spDecoratedTabGroup;
    CAknNavigationControlContainer *m_wpNaviPane;
    CAknTabGroup *m_wpTabGroup;

    bool m_bHideTabs;

    ShiftMarkState m_shiftMarkState;

    CHXAvCallback m_cbReloadPage;
    CHXAvFileSystemWatcher	m_fsWatcher;   
};

typedef CHXSmartPtr<CHXAvFileViewWindow> CHXAvFileViewWindowPtr;


////////////////////////////////////////////////////
// true if showing contents for root level folder
inline
bool CHXAvFileViewWindow::IsAtRoot() const
{
    return !m_spStore || m_spStore->IsAtRoot();
}


////////////////////////////////////////////////////////////
// return true if an item is higlighted
inline
bool CHXAvFileViewWindow::HasHilightItem() const
{
    return m_pListBox->CurrentItemIndex() >= 0;
}


////////////////////////////////////////////////////
// get number of items (files) in selection list
inline
TInt CHXAvFileViewWindow::GetMarkedItemCount() const
{
    return m_pListBox->SelectionIndexes()->Count();
}

////////////////////////////////////////////////////////////
// return NULL if media folder root not accessible (locked, not there, corrupt, etc.)
inline
const CHXAvFileStorePtr& CHXAvFileViewWindow::GetStore() const
{
    return m_spStore;
}



////////////////////////////////////////////////////////////
// get array to text items that are displayed in the listbox
inline
CDesCArray* CHXAvFileViewWindow::GetModelTextArray()
{
    // downcast is only way to do it...
    CTextListBoxModel* pModel = m_pListBox->Model();
    return static_cast<CDesCArray*>(pModel->ItemTextArray());
}



////////////////////////////////////////////////////////////
// return true if the current folder is empty
inline
bool CHXAvFileViewWindow::IsEmpty() const
{
    return !m_spStore || m_spStore->GetEntries().Nelements() == 0;
}



////////////////////////////////////////////////////////////
//
inline
bool CHXAvFileViewWindow::IsCreateChildFolderAllowed() const
{
    return true;
}




#endif // _chxavfileviewwindow_h_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?