When "Real-time Monitoring" is set in system settings, an icon should appear on the cell phone screen Indicator Panel, indicating thatProgramRun in the background.
This article discusses how to draw icons on the s60 indicator panel. To display the icon near the power panel, you must encode the icon.
I wrote a cindicatoricon class that inherits from ccoecontrol.
Constructl ()CodeAs follows:
Void Cindicatoricon: constructl ()
{
Imywindowgroup = Rwindowgroup (icoeenv -> Wssession ());
User: leaveiferror (imywindowgroup. Construct (tuint32) & Imywindowgroup ));
Imywindowgroup. setordinalposition (0, Ecoewinpriorityalwaysatfront );
Imywindowgroup. enablereceiptoffocus (efalse );
Createmediawl (&Imywindowgroup );
//By default setting the indicator icon to inactive
Setindicatoriconl (eindicatoriconappactive );
Activatel ();
}
Note: rwindowgroup requires the w32std. h header file, and ws32.lib must be added during connection.
In the constructor, call another function setindicatoriconl () to set the icon:
Void Cindicatoricon: setindicatoriconl (tindicatoricon aindicatoricontype, tbool aredraw)
{
Switch (Aindicatoricontype)
{
Case Eindicatoriconempty:
Iindicator = Ceikonenv: static () -> Createbitmapl (ksysiconfile, embmavkonqgn_prop_empty );
Iindicatormask = Ceikonenv: static () -> Createbitmapl (ksysiconfile, embmavkonqgn_prop_empty_mask );
Break ;
Case Eindicatoriconappactive:
Iindicator = Ceikonenv: static () -> Createbitmapl (ksysiconfile, embmavkonqgn_bt_connect_on );
Iindicatormask = Ceikonenv: static () -> Createbitmapl (ksysiconfile, embmavkonqgn_bt_connect_on_mask );
Break ;
Case Eindicatoriconappinactive:
Iindicator = Ceikonenv: static () -> Createbitmapl (ksysiconfile, embmavkonqgn_prop_bt_audio );
Iindicatormask = Ceikonenv: static () -> Createbitmapl (ksysiconfile, embmavkonqgn_prop_bt_audio_mask );
Break ;
Default:
Break;
}
Setrect (trect (tpoint (kindicatorposx, kindicatorposy), iindicator -> Sizeinpixels ()));
// If aredraw = etrue just draw the canvas again.
If (Aredraw)
{
Drawnow ();
}
}
Set the icon to be displayed on the indicator panel, but you must reload the draw () function of ccoecontrol to display the icon. The draw () code is as follows:
Void Cindicatoricon: Draw ( Const Trect & Arect) Const
{
Cwindowgc & GC = Systemgc ();
GC. Clear ();
GC. setbrushstyle (cgraphicscontext: enullbrush );
GC. bitbltmasked (tpoint (arect. ITL. IX, arect. ITL. Iy ),
Iindicator,
Trect (tpoint ( 0 , 0 ), Iindicator -> Sizeinpixels ()),
Iindicatormask,
Etrue );
}
Add the following two lines of code to the constructor of the Appui class:
Iindicatoricon = cindicatoricon: newl ();
// The next line will set the icon to draw and it'll draw to the screen.
Iindicatoricon-> setindicatoriconl (cindicatoricon: eindicatoriconappinactive, etrue );
As follows:
Indicator icon when application is running in the foreground. |
|
Indicator icon when application is running in the background .. |
|
|
|
Indicator icon when application is running in the background with the task view .. |
|
|
You can download the sample programSource code:
Sample Code for showing icon on the indicatorpane