Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi All,

I want list widget item text in Bold. I was created list widget and added scroll bar. Now for highlighting, want a item text in bold. For bold, I am taking an image and add list widget text on that image and paste that image on the list widget item, so it look like Bold text.

so list widget & scroll bar is done , problem in Bold text for highlighting list item.
so can any body help with code.

code is here:
-----------------------------------------
{
IMenuModel *pimenumodel;
IWidget *piwidget;
int wid, index, caret_x, caret_y;
int result1=SUCCESS, result2=SUCCESS;
WExtent size;
WidgetPos wpos;
AEERect rect, rect1;
IXYContainer *picontainer;
IWidget *picontainerwidget,*pimenuwidget;
//IDecorator *pid = 0;
IWidget *pid = 0;
IFont *piFont;
IImage *piImage = NULL;
boolean bFocus = FALSE;
ICanvas *piCanvas = NULL;
AECHAR *itemstr = (AECHAR*)MALLOC(25);
AEECLSID *clsid = NULL;

result1=ISHELL_CreateInstance(pMe->piShell, AEECLSID_DisplayCanvas,(void **)&(pMe->piDisplayCanvas));
IDisplayCanvas_SetDisplay(pMe->piDisplayCanvas, pMe->piDisplay);

result1=ISHELL_CreateInstance(pMe->piShell, AEECLSID_RootContainer,(void **) &(pMe->picRoot));
IRootContainer_QueryInterface(pMe->picRoot, AEEIID_IWidget,(void**) &pMe->piwRoot);

SETAEERECT(&rect, 0, 0, pMe->deviceInfo.cxScreen, pMe->deviceInfo.cyScreen);

(void)IWidget_HandleEvent(pMe->piwRoot,EVT_WDG_ENABLETOUCH, 0, 1);
HANDLERDESC_Init(&pMe->hdRoot, SampleTouchApp_RootHandler,pMe, 0);
IHandler_SetHandler(CAST(IHandler*, pMe->piwRoot), &pMe->hdRoot);
IRootContainer_SetCanvas(pMe->picRoot, (ICanvas*)pMe->piDisplayCanvas, &rect);

(void) IWidget_SetBGColor(pMe->piwRoot, MAKE_RGB(255, 255, 255));

if(result1==SUCCESS)
result1=ISHELL_CreateInstance(pMe->piShell,AEECLSID_MenuModel,(void **)&pimenumodel);

if(result1==SUCCESS)
result1=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ListWidget,(void **)&pMe->pilistmenu);

if(result1==SUCCESS)
result1=ISHELL_CreateInstance(pMe->piShell,AEECLSID_StaticWidget,(void **)&pMe->piwidget);

IWidget_SetModel(pMe->pilistmenu,IMenuModel_to_IModel(pimenumodel));

IMenuModel_Add(pimenumodel,L"List 1",0,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 22",1,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 3",2,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 4",3,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 5",4,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 6",5,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 7",6,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 8",7,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 9",8,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 10",9,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 11",10,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 12",11,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 13",12,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 14",13,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 15",14,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 16",15,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 17",16,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 18",17,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 19",18,MMF_ENABLED);
IMenuModel_Add(pimenumodel,L"List 20",19,MMF_ENABLED);

IDecorator_SetWidget((IDecorator *)(void*)pMe->pilistmenu,pMe->piwidget);

//IWidget_SetSelectedBGColor(pMe->piwidget, MAKE_RGB(0, 251, 251));
IWidget_SetSelectedFGColor(pMe->piwidget, MAKE_RGB(0, 0, 255));

//IWIDGET_SetProperty(pMe->pilistmenu, PROP_TEXT_SELECTED_FGCOLOR, MAKE_RGB(0,0,255));
(void)IWidget_SetFlags(pMe->piwidget,IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);// | SWF_NOSHORTENTEXT); // for center algn of texts

IWidget_SetProperty( pMe->pilistmenu, PROP_FLAGS,LWF_WRAP); //to circular menu top-down-top
IWIDGET_SetProperty(pMe->pilistmenu, PROP_SELITEMSIZE, 30);

(void) IWidget_SetBorderWidth(pMe->pilistmenu, 2);
(void) IWidget_SetBGColor(pMe->pilistmenu, MAKE_RGB(255,255,255));
(void) IWidget_SetBorderColor(pMe->pilistmenu, MAKE_RGB(125,125,125));

IWidget_GetPreferredExtent(pMe->pilistmenu, &size);
size.width +=150;
size.height+=80;
IWidget_SetExtent(pMe->pilistmenu, &size);

(void) IWidget_SetItemWidth(pMe->pilistmenu, ((pMe->deviceInfo.cxScreen*3)/4)-15);//170
(void) IWidget_SetItemHeight(pMe->pilistmenu, (pMe->deviceInfo.cyScreen)/12); // 26
(void) IWidget_SetHintRows(pMe->pilistmenu,(pMe->deviceInfo.cyScreen)/32);//10

//-------------------------------------------- scrolling ---------------------
ISHELL_CreateInstance(pMe->piShell, AEECLSID_ScrollbarWidget, (void**)&pid);
IDecorator_SetWidget((IDecorator*)pid, pMe->pilistmenu);

// return the wrapping decorator
pMe->pilistmenu = CAST(IWidget*, pid);

// setup scrollbar properties
(void) IWidget_GetScrollHandleWidth(pMe->pilistmenu, &wid);
(void) IWidget_SetScrollHandleWidth(pMe->pilistmenu, wid+5);

(void) IWidget_SetScrollStyle(pMe->pilistmenu, SCROLL_BOTH);
(void) IWidget_SetFlags(pMe->pilistmenu, SBWF_ARROWS);

// //------- padding for list & scrolling ---------
(void) IWidget_SetPadding(pMe->pilistmenu, 4);
IWidget_SetTransparency( pMe->pilistmenu, 125 );

//-------------------------------------------- scrolling -------------------------

//-------------------------------------------- add image on list widget ---------------------
if(result1==SUCCESS)
result1=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ImageWidget,(void **)&pMe->piImgWidget);

if(!piImage)
piImage = ISHELL_LoadResImage(pMe->piShell, RES_FILE, IDI_OBJECT_5001);

IWidget_SetImage(pMe->piImgWidget, piImage);

// return the wrapping decorator
IDecorator_SetWidget((IDecorator *)pMe->pilistmenu,pMe->piImgWidget);

//pMe->pilistmenu = CAST(IWidget*, pMe->piImgWidget);

//-------------- get item string -----------------
//index = IWidget_GetSelected(pMe->pilistmenu, &bFocus);

//IWidget_GetProperty(pMe->pilistmenu, PROP_FORMATSTRING, itemstr);
//IWidget_GetFormatString(pMe->pilistmenu, &itemstr);

//-------------- get item string -----------------

//-------------------------------------------- add image on list widget ---------------------

wpos.bVisible=TRUE;
wpos.x=20;
wpos.y=20;

(void)IROOTCONTAINER_Insert(pMe->picRoot,pMe->pilistmenu , WIDGET_ZNORMAL, &wpos);
(void)IWidget_MoveFocus(pMe->piwRoot, pMe->pilistmenu);
RELEASEIF(pMe->pilistmenu);

IDISPLAY_Update(pMe->piDisplay);