Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
chxavplaylistnavicontrol.cpp
Package: 142_61_thumb_advanced.rar [view]
Upload User: dangjiwu
Upload Date: 2013-07-19
Package Size: 42019k
Code Size: 4k
Category:
Symbian
Development Platform:
Visual C++
- /*============================================================================*
- *
- * (c) 1995-2002 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- *============================================================================*/
- /*
- Description:
- draws and manages navi pane area shown during playlist navigate state
- */
- #include <aknutils.h>
- #include "chxavmisc.h"
- #include "chxavcleanupstack.h"
- #include "chxavcleanstring.h"
- #include "hxsym_debug.h"
- #include "chxavplaylistnavicontrol.h"
- ////////////////////////////////
- //
- CHXAvPlaylistNaviControl* CHXAvPlaylistNaviControl::NewL(CHXAvPlayer* pPlayer, const CCoeControl& parent)
- {
- CHXAvPlaylistNaviControl* pSelf = new(ELeave) CHXAvPlaylistNaviControl();
- AUTO_PUSH_POP(pSelf);
- pSelf->ConstructL(pPlayer, parent);
- return pSelf;
- }
- ///////////////////////////////////
- // ctor
- CHXAvPlaylistNaviControl::CHXAvPlaylistNaviControl()
- {
- }
- ///////////////////////////////////
- // dtor
- CHXAvPlaylistNaviControl::~CHXAvPlaylistNaviControl()
- {
- if(m_spPlayer)
- {
- m_spPlayer->GetPlayerState().RemoveObserver(this);
- }
- }
- ////////////////////////////
- //
- void CHXAvPlaylistNaviControl::ConstructL(CHXAvPlayer* pPlayer, const CCoeControl& parent)
- {
- m_spPlayer = pPlayer;
- m_spPlayer->GetPlayerState().AddObserver(this);
- SetContainerWindowL(parent);
- TRect rc(parent.Rect());
- SetRect(rc);
- // save this; we want to draw over whole navi control (see SizeChanged)
- m_rcParent = rc;
- //
- // playlist text
- //
- const TInt CID_PLAYLIST_TEXT = 1;
- m_spPlaylistText = CHXAvTextControl::NewL(*this, CID_PLAYLIST_TEXT);
- m_spPlaylistText->SetTextColor(KRgbWhite);
- m_spPlaylistText->UpdateFont(LatinBold12());
- m_spPlaylistText->MakeVisible(ETrue);
- m_spPlaylistText->SetRect(rc); // for now
- UpdatePlaylistTextL();
- }
- //////////////////////////////////////////////
- // hide or show playlist menu items depending
- // on whether or not a playlist is loaded
- void CHXAvPlaylistNaviControl::UpdatePlaylistTextL()
- {
- bool bHaveRam = m_spPlayer->IsPlaylistLoaded();
- if( bHaveRam )
- {
- // 1-based indexes
- TInt idxCount = m_spPlayer->GetPlaylistItemCount();
- TInt idxCurrent = m_spPlayer->GetPlaylistCurrentIndex() + 1;
- CHXAvCleanString playUrl(m_spPlayer->GetPlayURL());
- bool bLocal = CHXAvUtil::IsLocal(playUrl());
- HX_ASSERT(idxCount >= 1 && idxCurrent >= 1);
- if( idxCount > 1 )
- {
- //XXXLCM resource
- _LIT(KLocalClipFormat, "Local clip %d/%d");
- _LIT(KRemoteClipFormat, "Remote clip %d/%d");
- TBuf<40> buf;
- if( bLocal )
- {
- buf.Format(KLocalClipFormat, idxCurrent, idxCount);
- }
- else
- {
- buf.Format(KRemoteClipFormat, idxCurrent, idxCount);
- }
- // determine width needed
- const CFont* pFont = m_spPlaylistText->GetFont();
- TInt cxText = pFont->TextWidthInPixels(buf);
- const TUint CX_RIGHT_BORDER = 2;
- // size rect so text just fits
- TRect rcText = m_rcParent;
- rcText.iBr.iX -= CX_RIGHT_BORDER;
- rcText.iTl.iX = rcText.iBr.iX - cxText;
- if(rcText.iTl.iX < m_rcParent.iTl.iX )
- {
- rcText.iTl.iX = m_rcParent.iTl.iX;
- }
- m_spPlaylistText->SetRect(rcText);
- m_spPlaylistText->SetText(buf);
- }
- }
- }
- ////////////////////////////////////////
- //IHXSymPlayerStateObserver
- void CHXAvPlaylistNaviControl::OnAdvancePlaylist()
- {
- UpdatePlaylistTextL();
- m_spRefreshCmd->Execute();
- }
- ////////////////////////////////////////
- //
- void
- CHXAvPlaylistNaviControl::Draw(const TRect& /* rect */) const
- {
- // don't draw background; navi pane container draws background for us
- }
- //////////////////////////////
- //
- // CCoeControl
- //
- TInt CHXAvPlaylistNaviControl::CountComponentControls() const
- {
- return 1;
- }
- //////////////////////////////
- //
- // CCoeControl
- //
- CCoeControl* CHXAvPlaylistNaviControl::ComponentControl(TInt aIndex) const
- {
- HX_ASSERT(aIndex == 0);
- return m_spPlaylistText.Ptr();
- }