How to draw a tip icon at the top of the permanent position for Series60-[symbian]

Source: Internet
Author: User

Applicable version

S60 2nd Edition FP3, S60 3rd Edition

This article describes how to draw a front-end icon prompt in Series60. The actual effect is shown in, the icons of a single note are always visible. This can serve as a prompt for some applications. For example, in an IM software, it can be used to prompt for unread messages.

1. Build the following build process based on the sample program provided by me: Build a CIndicatorIcon class to represent this prompt icon, which is inherited from CCoeControl. Its second-stage ConstructL () ConstructL is as 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, the prompt icon is set to inactive SetIndicatorIconL (EIndicatorIconAppActive); ActivateL ();}

In ConstructL (), SetIndicatorIconL () is called to set the icon. The following describes the specific implementation of this function:

Void CIndicatorIcon: Adjust (TIndicatorIcon release, TBool aRedraw) {switch (release) {case when: iIndicator = CEikonEnv: Static ()-> CreateBitmapL (KSysIconFile, release ); response = CEikonEnv: Static ()-> CreateBitmapL (KSysIconFile, callback); break; case when: iIndicator = CEikonEnv: Static ()-> CreateBitmapL (KSysIconFile, callback ); response = CEikonEnv: Static ()-> CreateBitmapL (KSysIconFile, callback); break; case when: iIndicator = CEikonEnv: Static ()-> CreateBitmapL (KSysIconFile, callback ); iIndicatorMask = CEikonEnv: Static ()-> CreateBitmapL (KSysIconFile, secret); break; default: break;} SetRect (TRect (TPoint (KIndicatorPosX, dickinatorposy ), iIndicator-> SizeInPixels (); // when aRedraw = ETrue, only if (aRedraw) {DrawNow ();}}

At the same time, you must rewrite the Draw () function of CCoeControl to Draw a prompt icon at the appropriate position.

 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);       }

By now, you have completed the construction of the CIndicatorIcon class.

2. Add the following statement to the ConstructL () of the AppUi of your program:

IIndicatorIcon = CIndicatorIcon: NewL (); // set the iIndicatorIcon icon to be drawn in the following row-> SetIndicatorIconL (CIndicatorIcon: EIndicatorIconAppInactive, ETrue );

Yes, it's that simple.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.