📄 biaofengmainwindow.cpp
字号:
iStartLogo=1;
iPeriodicTimer->Start(200000,200000,TCallBack(CMainWinControl::TimerFun,this) );
/*
m_iPeriodicTimer->Cancel();
m_CurPage->Draw(m_BackSurface);
if(m_Net->m_iNetState!=ENET_NON)
DrawWait(m_BackSurface);
...
*/
}
// The following two functions have to be implemented for all compound controls.
TInt CMainWinControl::CountComponentControls() const
{
/*
if( iCurrentPage!=this )
return 1 ;
else
return 0 ;
**/
}
//加载选择文本
void CMainWinControl::LoadTextListL(TInt aTextResource)
{
}
void CMainWinControl::LoadTextListL(const TDesC& aText)
{
}
void CMainWinControl::AddControlL(CCoeControl* aControl,TInt aControlId)
{
/*
* 2009-4-27
* Desciptor:
* */
((CMySelectionControl*)aControl)->InitControlL(this);
// NOTE: Transfer ownership of CCoeControl to CMyContainerControl
Components().AppendLC(aControl,aControlId);
CleanupStack::Pop(aControl);
if (Components().Count()==1)
{
iFocusedIndex = 0;
aControl->SetFocus(ETrue);
}
Components().SortById(); // Sort components
UpdateControls();
// UpdateScrollBarFrameL();
}
void CMainWinControl::UpdateControls()
{
TPoint position;
// Goes throught all components of this container control
CCoeControlArray::TCursor cursor = Components().Begin();
CCoeControl* ctrl = NULL;
while ((ctrl = cursor.Control<CCoeControl>()) != NULL)
{
// If control is not visible does not handle it
if (!ctrl->IsVisible())
{
cursor.Next();
continue;
}
// Set position
ctrl->SetPosition(position);
// Set size
TSize size = ctrl->MinimumSize();
size.SetSize(Rect().Width(),size.iHeight);
ctrl->SetSize(size);
// Store position of last component
position.iY += size.iHeight+5;
// Does control fit to view?
if (position.iY >= Rect().iBr.iY)
{
ctrl->MakeVisible(EFalse);
}
else
{
ctrl->MakeVisible(ETrue);
}
cursor.Next();
}
}
void CMainWinControl::VertMoveControl(TInt aSpan)
{
TPoint movePonit(0,aSpan);
SetExtent(Position()+ movePonit,Size());
}
CCoeControl* CMainWinControl::ComponentControl(TInt aIndex) const
{
/*
if( iCurrentPage!=this )
return iCurrentPage ;
else
return NULL ;
#if 0
switch(aIndex)
{
case 0:
return iCurrentPage ; //return iAppView;
//case 1:
// return iContainer;
default:
return NULL;
}
#endif
**/
}
void CMainWinControl::SizeChanged()
{
// iLabel1->SetExtent( TPoint(10,30), iLabel1->MinimumSize() );
}
void CMainWinControl::InitControlL(const CCoeControl* aParent)
{
}
void CMainWinControl::OutputText(CWindowGc & aGc,const TRgb &aColor ) const
{
}
// Draw the main window.
void CMainWinControl::Draw(const TRect& aRect ) const
{
CWindowGc& gc=SystemGc();
//TRect allRect=TRect(50,20,100,50); // SetRect(allRect);
gc.SetBrushColor(KRgbWhite);
gc.Clear( Rect() );
if (iIsLoadFinished)
{
gc.BitBltMasked(TPoint(0, 0), iMap, aRect, iMapMask, EFalse);
}
// gc.BitBlt( TPoint(30,10), m_BackSurface->GetFbsBitmap() );
if( 0==iStartLogo )
{
gc.BitBlt( TPoint(0,0), iImage_logo->m_iBitmap );
}
else
{
gc.BitBlt( TPoint(0,0), iImage_bk01->m_iBitmap );
gc.BitBlt( TPoint(0,257), iImageArray[2]->m_iBitmap ); // "bottombg.png") );
gc.BitBlt( TPoint(0,0), iImageArray[6]->m_iBitmap ); //title01.png") );
gc.BitBlt( TPoint(0,0), iImageArray[8]->m_iBitmap ); //_L("titlelogo.png") );
//gc.BitBlt( TPoint(50,10), iImageArray[19]->m_iBitmap ); //"text_title01.png") );
gc.BitBlt( TPoint(190,12), iImageArray[20]->m_iBitmap ); // ("searchicon.png") );
gc.BitBlt( TPoint(15,257), iImageArray[9]->m_iBitmap ); // "menubook1.png") );
gc.BitBlt( TPoint(55,257), iImageArray[15]->m_iBitmap ); // menunet1.png") );
gc.BitBlt( TPoint(86,257), iImageArray[12]->m_iBitmap ); // menudown2.png") );
gc.BitBlt( TPoint(165,257), iImageArray[13]->m_iBitmap ); // menufile1.png") );
gc.BitBlt( TPoint(195,257), iImageArray[17]->m_iBitmap ); // "menurecom1.png") );
// m_BackSurface->BitBlt(0,302, iImageArray[4] );
// m_BackSurface->BitBlt(0,302, iImageArray[5] );
gc.BitBlt( TPoint(0,302), iImageArray[4]->m_iBitmap ); // "bottommenu_left.png") );
gc.BitBlt( TPoint(192,302), iImageArray[5]->m_iBitmap ); // "bottommenu_right.png") );
TRect Rect1=TRect(60,10,170,25);
gc.SetPenSize(TSize(1,1));
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.SetPenColor(KRgbWhite);
gc.SetBrushColor(KRgbWhite); // KRgbBlue KRgbWhite
gc.DrawRect( Rect1 );
gc.SetBrushStyle(CGraphicsContext::ENullBrush);
}
//gc.SetPenSize(TSize(5,5));
//gc.SetPenColor(KRgbRed);
//gc.DrawLine( TPoint(10,10), TPoint(200,10) );
}
void CMainWinControl::HandleCommandL(TInt aCommand)
{
//if(m_Net->m_iNetState!=ENET_NON)
// return;
iStartLogo=1;
TBuf<400> text;
text.AppendNum(aCommand);
/*
#if 0
switch(aCommand)
{
case EtravelCmdExplain:
{
TBuf8<10240> *p=new TBuf8<10240>;
ReadFile(_L("about.data"),*p);
UTFToUnicode(m_TextSurface->m_ShowText,*p);
delete p;
m_TextSurface->m_Title=CH_TEXT("���˵��");
ShowText();
}
break;
case EtravelCmdMyTravel:
{
m_MainSurface->Release();
TBuf8<400> url;
GetUrlHeader(url,6007);
m_Net->DownloadFile(url,_L("mytravel"),ETrue);
}
break;
case EtravelCmdOpen:
{
TKeyEvent aKeyEvent;
TEventCode aType;
aKeyEvent.iCode=EKeyDevice3;
aKeyEvent.iScanCode=-100;
aType=EEventKey;
m_CurPage->OfferKeyEventL(aKeyEvent,aType);
}
break;
case EtravelCmdWeather:
{
GotoSurface(SUR_WEATHER);
}
break;
default:
{
}
break;
}
#endif
*/
}
//void CMainWinControl::VertMoveControl(TInt aSpan)
//{
// TPoint movePonit(0,aSpan);
// SetExtent(Position()+ movePonit,Size());
//}
// CSmileyContainer can't be put on the control stack, because it's a component of this
// control. The main window control goes on the stack and passes on any key events it gets
// to the CSmileyContainer.
TKeyResponse CMainWinControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
/*
iStartLogo=1;
// if( iContainer )
// return (iContainer->OfferKeyEventL(aKeyEvent, aType));
// return
if( iCurrentPage!=this )
TKeyResponse keyResp =iCurrentPage->OfferKeyEventL(aKeyEvent, aType);
TRect allRect=TRect(0,0,240,320);
switch ( aKeyEvent.iScanCode )
{
case EStdKeyUpArrow: // EStdKeyLeftArrow
// iCurrentPage=iContainer;
// iCurrentView->DrawNow( allRect );
// return (iContainer->OfferKeyEventL(aKeyEvent, aType));
return EKeyWasConsumed;
break;
case EStdKeyDownArrow: // EStdKeyRightArrow:
// iCurrentView=iAppView;
// iCurrentPage=iAppView;
// iCurrentView->DrawNow( allRect );
// return (iAppView->OfferKeyEventL(aKeyEvent, aType));
return EKeyWasConsumed;
break;
default:
break;
}
return EKeyWasNotConsumed; // EKeyWasNotConsumed; EKeyWasConsumed
**/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -