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

Developer

Forums

Forums:

HI all

 

Is it possible to attach a image to a moving progress bar, the image should move with the progress bar.

 

Please suggest something.

 

Regards

Gautam

Yes, you can display image with moving progess bar by inserting custom draw handler for progress widget.
//Create progress widget and set properties

//Query for the draw handler and set custom draw method
IWidget_QueryInterface(pMe->piwProgress, AEEIID_IDrawHandler, (void **)&piDrawHandler);
DRAWHANDLERDESC_Init(&pMe->drawdesc, c_widgetsapp_Draw, pMe,c_widgetsapp_DrawHandlerFree);
IDrawHandler_SetDraw(piDrawHandler, &pMe->drawdesc);

//Draw image in custom draw method
void c_widgetsapp_Draw(c_widgetsapp *pMe, ICanvas *piCanvas, int x, int y)
{
/* Pre-widget draw buffer modifications*/

// Call the widget's default draw
DRAWHANDLERDESC_Call(&pMe->drawdesc, piCanvas, x, y);

/* Post-widget draw buffer modifications
We will draw image that will be drawn over the widget. */

if(pMe->pImg)
IIMAGE_Draw(pMe->pImg, x+pMe->uPrgs, y);//uPrgs is progress index

void c_widgetsapp_DrawHandlerFree(c_widgetsapp *pMe)
{
DRAWHANDLERDESC_Free(&pMe->drawdesc);

Yes, you can display image with moving progess bar by inserting custom draw handler for progress widget.
//Create progress widget and set properties

//Query for the draw handler and set custom draw method
IWidget_QueryInterface(pMe->piwProgress, AEEIID_IDrawHandler, (void **)&piDrawHandler);
DRAWHANDLERDESC_Init(&pMe->drawdesc, c_widgetsapp_Draw, pMe,c_widgetsapp_DrawHandlerFree);
IDrawHandler_SetDraw(piDrawHandler, &pMe->drawdesc);

//Draw image in custom draw method
void c_widgetsapp_Draw(c_widgetsapp *pMe, ICanvas *piCanvas, int x, int y)
{
/* Pre-widget draw buffer modifications*/

// Call the widget's default draw
DRAWHANDLERDESC_Call(&pMe->drawdesc, piCanvas, x, y);

/* Post-widget draw buffer modifications
We will draw image that will be drawn over the widget. */

if(pMe->pImg)
IIMAGE_Draw(pMe->pImg, x+pMe->uPrgs, y);//uPrgs is progress index

void c_widgetsapp_DrawHandlerFree(c_widgetsapp *pMe)
{
DRAWHANDLERDESC_Free(&pMe->drawdesc);

HI Adhudase.
 
Thanks for ur reply, its drawing and moving with the progress bar. but the image is visible inside the progress boarder. i want something like tat image should be outised the boarder of progress bar widget
 
Regards
Gautam
 
 

HI Adhudase.
 
Thanks for ur reply, its drawing and moving with the progress bar. but the image is visible inside the progress boarder. i want something like tat image should be outised the boarder of progress bar widget
 
Regards
Gautam
 
 

HI Adhudase.
 
Please reply...
 
Regards
Gautam
 

HI Adhudase.
 
Please reply...
 
Regards
Gautam
 

In that case, you can apply mover transition to image widget and control the steps based on progress index. See AEECLSID_Transition2_Mover, ITransition2, ITransitionMgr API reference.

In that case, you can apply mover transition to image widget and control the steps based on progress index. See AEECLSID_Transition2_Mover, ITransition2, ITransitionMgr API reference.

Hi Adhudase,
We Tried using AEECLSID_Transition2_Mover and some what we achieved in moving an image in progress bar according to the song duration. But the problem what we are facing is for Fast Farward and Rewind....
is there any Transition API for forward and rewind of the image.....
 
Please reply.....
 
Regards
Srinag

Hi Adhudase,
We Tried using AEECLSID_Transition2_Mover and some what we achieved in moving an image in progress bar according to the song duration. But the problem what we are facing is for Fast Farward and Rewind....
is there any Transition API for forward and rewind of the image.....
 
Please reply.....
 
Regards
Srinag

Hi Adhudase,
We Tried using AEECLSID_Transition2_Mover and some what we achieved in moving an image in progress bar according to the song duration. But the problem what we are facing is for Fast Farward and Rewind....
is there any Transition API for forward and rewind of the image.....
 
Please reply.....
 
Regards
Srinag

Hi Adhudase,
We Tried using AEECLSID_Transition2_Mover and some what we achieved in moving an image in progress bar according to the song duration. But the problem what we are facing is for Fast Farward and Rewind....
is there any Transition API for forward and rewind of the image.....
 
Please reply.....
 
Regards
Srinag

You should be able to do that with ITransition2_Step().

You should be able to do that with ITransition2_Step().

Hi Adhudase
Thanks for ur reply can u give me any suggestion on how to drag the image on progress bar for Touch Events........
 
Regards 
Srinag

Hi Adhudase
Thanks for ur reply can u give me any suggestion on how to drag the image on progress bar for Touch Events........
 
Regards 
Srinag

Do you mean drag and drop? You need to attach custom event handler to Image widget and then perform dragging based on pointer events. Here is how I would do it:
1. Attach handler to image widget
HANDLERDESC_INIT(&pMe->hdImage, (PFNHANDLER) Test_ImageHandler, (void*) pMe, (PFNFREEHANDLER) Test_ImageFreeHandler);
IWidget_SetHandler(pMe->piwImage, &pMe->hdImage);
2. Image handler method
static boolean Test_ImageHandler(FontTest *pMe, AEEEvent evt, uint16 wParam, uint32 dwParam)
{
WidgetExtent we;
IWidget_GetExtent(pMe->piwImage, &we);
switch(evt) {
case EVT_POINTER_DOWN:
(void) IWIDGET_SetCapture(pMe->piwImage, TRUE);
pMe->x = (int16) AEE_POINTER_GET_X((const char*) dwParam);
pMe->y = (int16) AEE_POINTER_GET_Y((const char*) dwParam);
pMe->bStart = TRUE;//start dragging
return TRUE;

case EVT_POINTER_MOVE:
{
int16 x,y;
WidgetPos WidPos;
WidgetPos oldWidPos;

if(!pMe->bStart) {
return FALSE;
}
x = (int16) AEE_POINTER_GET_X((const char*) dwParam);
y = (int16) AEE_POINTER_GET_Y((const char*) dwParam);
(void) IRootContainer_GetPos(pMe->picRoot, pMe->piwImage, &WidPos);
oldWidPos = WidPos;
IWidget_GetExtent(pMe->piwImage, &we);
// This is the dragging case
WidPos.x = WidPos.x + x - pMe->x;
WidPos.y = WidPos.y + y - pMe->y;
if(WidPos.x < 0) {
WidPos.x = 0;
}
else if ( WidPos.x + we.width > pMe->DeviceInfo.cxScreen) {
WidPos.x = pMe->DeviceInfo.cxScreen - we.width;
}
if(WidPos.y < 0) {
WidPos.y = 0;
}
else if ( WidPos.y + we.height > pMe->DeviceInfo.cyScreen) {
WidPos.y = pMe->DeviceInfo.cyScreen - we.height;
}

(void) IRootContainer_SetPos(pMe->picRoot, pMe->piwImage, WIDGET_ZNORMAL, &WidPos);

}
return TRUE;

case EVT_POINTER_UP:
pMe->bStart = FALSE;//end dragging
(void) IWIDGET_SetCapture(pMe->piwImage, FALSE);
return TRUE;

default:
break;
}
return HANDLERDESC_CALL(&pMe->hdImage, evt, wParam, dwParam);

 

Do you mean drag and drop? You need to attach custom event handler to Image widget and then perform dragging based on pointer events. Here is how I would do it:
1. Attach handler to image widget
HANDLERDESC_INIT(&pMe->hdImage, (PFNHANDLER) Test_ImageHandler, (void*) pMe, (PFNFREEHANDLER) Test_ImageFreeHandler);
IWidget_SetHandler(pMe->piwImage, &pMe->hdImage);
2. Image handler method
static boolean Test_ImageHandler(FontTest *pMe, AEEEvent evt, uint16 wParam, uint32 dwParam)
{
WidgetExtent we;
IWidget_GetExtent(pMe->piwImage, &we);
switch(evt) {
case EVT_POINTER_DOWN:
(void) IWIDGET_SetCapture(pMe->piwImage, TRUE);
pMe->x = (int16) AEE_POINTER_GET_X((const char*) dwParam);
pMe->y = (int16) AEE_POINTER_GET_Y((const char*) dwParam);
pMe->bStart = TRUE;//start dragging
return TRUE;

case EVT_POINTER_MOVE:
{
int16 x,y;
WidgetPos WidPos;
WidgetPos oldWidPos;

if(!pMe->bStart) {
return FALSE;
}
x = (int16) AEE_POINTER_GET_X((const char*) dwParam);
y = (int16) AEE_POINTER_GET_Y((const char*) dwParam);
(void) IRootContainer_GetPos(pMe->picRoot, pMe->piwImage, &WidPos);
oldWidPos = WidPos;
IWidget_GetExtent(pMe->piwImage, &we);
// This is the dragging case
WidPos.x = WidPos.x + x - pMe->x;
WidPos.y = WidPos.y + y - pMe->y;
if(WidPos.x < 0) {
WidPos.x = 0;
}
else if ( WidPos.x + we.width > pMe->DeviceInfo.cxScreen) {
WidPos.x = pMe->DeviceInfo.cxScreen - we.width;
}
if(WidPos.y < 0) {
WidPos.y = 0;
}
else if ( WidPos.y + we.height > pMe->DeviceInfo.cyScreen) {
WidPos.y = pMe->DeviceInfo.cyScreen - we.height;
}

(void) IRootContainer_SetPos(pMe->picRoot, pMe->piwImage, WIDGET_ZNORMAL, &WidPos);

}
return TRUE;

case EVT_POINTER_UP:
pMe->bStart = FALSE;//end dragging
(void) IWIDGET_SetCapture(pMe->piwImage, FALSE);
return TRUE;

default:
break;
}
return HANDLERDESC_CALL(&pMe->hdImage, evt, wParam, dwParam);

 

how to drag the image moving on progress bar for fastfarword and rewind according to song duration

how to drag the image moving on progress bar for fastfarword and rewind according to song duration

You should be able to do that with mover transition as discussed above. Change the movement rate for forward/rewind, better to update it on seek end to make it exact.

You should be able to do that with mover transition as discussed above. Change the movement rate for forward/rewind, better to update it on seek end to make it exact.