int CSettings_New(IForm** ppo, IShell *piShell,IRootForm *pRootForm) 
{
	int result=0;
	IImage* m_pIImage;
	//allocate space for the form
	CSettings *pMe = MALLOCREC(CSettings);
	if(!pMe)
		return ENOMEMORY;

	pMe->pIShell = piShell;
	pMe->rootForm = pRootForm;

	if(ISHELL_CreateInstance(pMe->pIShell, AEECLSID_FORM, (void**) &pMe->csettings) == 0)
	
	{
		result =  ISHELL_CreateInstance(pMe->pIShell, AEECLSID_PROPCONTAINER, (void**) &pMe->mainContainer);
		*ppo = pMe->csettings;
		m_pIImage = ISHELL_LoadResImage(piShell,RIPPLEVAULT_RES_FILE,IDI_TITLE);
		IFORM_SetTitleImage((IForm*)pMe->csettings,m_pIImage);
		result += IFORM_SetResText((IForm*)pMe->csettings, FID_TITLE, RIPPLEVAULT_RES_FILE, IDS_CONTACTSETTINGS);
		result +=  IFORM_SetSoftkeys((IForm*)pMe->csettings, RIPPLEVAULT_RES_FILE, MAINSK1, PHOTOSK2);
		result += CSettings_PopulateMainContainer(pMe);	//add items to the form
	
	RELEASEIF(m_pIImage);
	}
	return result;
}
Example #2
0
/*
*	函数名称: 
		 PicBrowser::Init()
*  功能介绍:
		该函数为PicBrowser类的初始化函数,载入必要的资源。
*  输入参数:   
		N/A
*  输出参数:  
		N/A
*  返回值:   
		返回是否初始化成功
*	可能出现的意外:
		N/A
*/ 
boolean PicBrowser::Init()
{
	AEEImageInfo mi;
	int nByteLoad=0;
	m_pwszTitle=(AECHAR *)MALLOC(MAX_STRING_LEN+1);  //申请字符串资源空间
	if(m_pwszTitle!=NULL)
	{
		nByteLoad=ISHELL_LoadResString(m_pIShell,FK_RES_FILE,IDS_TITLE,m_pwszTitle,MAX_STRING_LEN); //载入字符串
	}

	m_pImage=ISHELL_LoadResImage(m_pIShell,FK_RES_FILE,IDB_PIC); //载入图片
	
	if(m_pImage==NULL || nByteLoad==0)
	{
		m_bInitSuccess=FALSE;  //资源装载失败
	}
	else
	{
		m_nRed=255;  //颜色值的R值初始化为255

		//取图片信息
		IIMAGE_GetInfo(m_pImage,&mi);
		m_nWidth=(int)mi.cx;
		m_nHeight=(int)mi.cy;

		//设置剪切矩形和图片初始位置
		SETAEERECT(&m_rctImage,0,pApp->nNoarmalFontH,pApp->lcdW,pApp->lcdH-pApp->nNoarmalFontH);
		m_nImageDrawX=m_rctImage.x+(m_rctImage.dx-m_nWidth)/2;
		m_nImageDrawY=m_rctImage.y+(m_rctImage.dy-m_nHeight)/2;
		
		m_bInitSuccess=TRUE;//装载成功
	}

	return m_bInitSuccess;
}
Example #3
0
void StatusBox_CtorZ(StatusBox *me,
                     IShell *piShell,IDisplay *piDisplay,
                     const char *cpszResFile, uint16 wResId,
                     AEERect *prcCenter,
                     PFNNOTIFY pfnInvalidate, 
                     void *pInvalidateData)
{
   me->piShell         = piShell;
   me->piDisplay       = piDisplay;
   me->pfnInvalidate   = pfnInvalidate;
   me->pInvalidateData = pInvalidateData;

   me->piImage = ISHELL_LoadResImage(piShell,cpszResFile,wResId);

   {
      uint32 nLen = sizeof(me->uFrameWidth)+sizeof(me->uFrameDuration);

      ISHELL_LoadResDataEx(piShell,cpszResFile,wResId,
                           RESTYPE_BINARY,
                           &me->uFrameWidth, /* uFrameDuration's right next */
                           &nLen);
   }
   
   CALLBACK_Init(&me->cb,StatusBox_AnimateTimer,me);

   me->rcCenter = *prcCenter;

   StatusBox_Init(me);
  
}
Example #4
0
static IWidget* MemChecker_CreateButton(MemChecker* pMe, const char* pszName, int x, int y, int dx, int dy, const AECHAR* pszText)
{
    IWidget *piwStatic = NULL;
    IWidget *piButton = NULL;
    IImage *piImage = NULL;
    IBitmap *piMaskBitmap = NULL;
    NativeColor ncTrans;

    IClassFactory_CreateInstance(pMe->m_pIClassFactory, XCLSID_Button, (void**)&piButton);
    IWidget_SetName(piButton, pszName);
    IWidget_SetPosition(piButton, x, y);
    IWidget_SetSize(piButton, dx, dy);
    IWidget_SetBorderWidth(piButton, 0);
    IWidget_SetBGColor(piButton, RGB_NONE);
    piImage = ISHELL_LoadResImage(pMe->a.m_pIShell, MEMCHECKER_RES_FILE, IDI_BUTTON_BG);
    IWidget_SetBGImage(piButton, piImage);
    RELEASEIF(piImage);
    piImage = ISHELL_LoadResImage(pMe->a.m_pIShell, MEMCHECKER_RES_FILE, IDI_BUTTON_BG_A);
    IWidget_SetProperty(piButton, PROP_ACTIVE_BGIMAGE, piImage);
    RELEASEIF(piImage);
    piImage = ISHELL_LoadResImage(pMe->a.m_pIShell, MEMCHECKER_RES_FILE, IDI_BUTTON_BG_S);
    IWidget_SetProperty(piButton, PROP_SELECTED_ACTIVE_BGIMAGE, piImage);
    RELEASEIF(piImage);
    piMaskBitmap = ISHELL_LoadResBitmap(pMe->a.m_pIShell, MEMCHECKER_RES_FILE, IDI_BUTTON_MASK);
    ncTrans = IBitmap_RGBToNative(piMaskBitmap, RGB_BLACK);
    IBitmap_SetTransparencyColor(piMaskBitmap, ncTrans);
    IWidget_SetMaskBitmap(piButton, piMaskBitmap);
    RELEASEIF(piMaskBitmap);
    {
        IClassFactory_CreateInstance(pMe->m_pIClassFactory, XCLSID_StaticCtl, (void **)&piwStatic);
        IWidget_SetSize(piwStatic, dx, dy);
        IWidget_SetBorderWidth(piwStatic, 0);
        IWidget_SetBGColor(piwStatic, RGB_NONE);
        IWidget_SetFGColor(piwStatic, RGB_WHITE);
        IWidget_SetText(piwStatic, pszText, TRUE);
        IContainer_Insert((IContainer*)piButton, piwStatic, -1, NULL);
        RELEASEIF(piwStatic);
    }

    return piButton;
}
Example #5
0
extern void	CGMENUCTL_SetScImage(CGMeuCtl* pCtl, const char * pszResFile, uint16 nResID)
{
	AEEApplet* pApp = (AEEApplet*)GETAPPINSTANCE();

	if (pCtl->m_pImageSe)
	{
		GM_RELEASEIF(pCtl->m_pImageSe);
	}

	pCtl->m_pImageSe = ISHELL_LoadResImage(pApp->m_pIShell, pszResFile, nResID);
	if (!pCtl->m_pImageSe) {
		return;
	}
}
Example #6
0
/*===========================================================================
   This function draws the splash screen and brings up the main window
   after the splash timer runs out.
===========================================================================*/
void  TS_DrawSplash(CTopSoupApp * pme,AECHAR* prompt,int msTimeout,PFNNOTIFY on_splashOver,void* pUser)
{
	if( NULL == prompt )
		return;
	
	if (pme->m_pWin)
		CTopSoupApp_DisableWin(pme);
   
   {
      IImage * pi = ISHELL_LoadResImage(pme->a.m_pIShell, NAVIGATE_RES_FILE, IDP_OBJECT_PROMPT);
	  IStatic * pInfoStatic = NULL;

      if (pi)
      {
         AEERect  rect;
		 AEEImageInfo      info;
		 int16 x,y;

		 IIMAGE_GetInfo(pi,&info);
		 x = ( pme->m_rectWin.dx - info.cx ) / 2;
		 y = pme->m_rectWin.y + ( pme->m_rectWin.dy - info.cy ) / 2;
         SETAEERECT(&rect,x,y,info.cx,info.cy);
         TS_DrawImage(pi, &rect, TRUE);


		 ISHELL_CreateInstance(pme->a.m_pIShell, AEECLSID_STATIC, (void **)&pInfoStatic);
		 ISTATIC_SetRect(pInfoStatic, &rect);
		 ISTATIC_SetProperties(pInfoStatic,  ST_MIDDLETEXT | ST_CENTERTEXT | ST_NOSCROLL);
         TS_FitStaticText(pme->a.m_pIDisplay, pInfoStatic, AEE_FONT_LARGE, prompt);

         TS_RELEASEIF(pi);
		 TS_RELEASEIF(pInfoStatic);
      }

      // start the timer.
	  if ( on_splashOver )
		  ISHELL_SetTimer(pme->a.m_pIShell, msTimeout, (PFNNOTIFY)on_splashOver, pUser);  
	  else
		  ISHELL_SetTimer(pme->a.m_pIShell, msTimeout, (PFNNOTIFY)CTopSoupApp_onSplashDrawOver, pme);
   }
}
Example #7
0
/*===========================================================================

FUNCTION: CGMENUCTL_Redraw

DESCRIPTION:
Redraws the control on the device screen.  If the control currently has
focus, the control is drawn with a border.

PARAMETERS:
pCtl [in] - A pointer to a CGMeuCtl instance

DEPENDENCIES:
None

RETURN VALUE:
None

SIDE EFFECTS:
Updates the device screen.
===========================================================================*/
extern void CGMENUCTL_Redraw(CGMeuCtl* pMe)
{
	AEEApplet* pApp = (AEEApplet*)GETAPPINSTANCE();
	AEERect rRect;

	if (pMe)
	{
		int i, j, height, h, a, b;
		AEEImageInfo infSe, infIc;
		AEERect rec;
		int xx, yy, dxx, dyy;
		RGBVAL oldColor;

		GMenuItem * pData = NULL;
		TQueueList * p = pMe->m_pDataList;

		ZEROAT(&infSe);

		IDISPLAY_EraseRect(pApp->m_pIDisplay, &pMe->m_Rect);

		h = IDISPLAY_GetFontMetrics(pApp->m_pIDisplay, AEE_FONT_NORMAL, &a, &b);

		//绘制背景图
		if (pMe->m_pImageBk)
		{
			IIMAGE_SetDrawSize(pMe->m_pImageBk, pMe->m_Rect.dx, pMe->m_Rect.dy);
			IIMAGE_Draw(pMe->m_pImageBk, pMe->m_Rect.x, pMe->m_Rect.y);
		}

		//确定菜单高度
		if (pMe->m_pImageSe)
		{
			IIMAGE_GetInfo(pMe->m_pImageSe, &infSe);
			IIMAGE_SetDrawSize(pMe->m_pImageSe, pMe->m_Rect.dx, infSe.cy);
		}
		else
		{
			infSe.cx = pMe->m_Rect.dx;
			infSe.cy = h;
		}

		//绘制菜单项
		i = 0;
		j = 0;
		height = pMe->m_Rect.y + 5;
		while (p)
		{
			AECHAR	iTemText[256];

			if (i < pMe->m_startIndex)
			{
				p = p->pNext;
				i++;
				continue;
			}

			if (j >= pMe->m_pageSize)
			{
				break;
			}

			pData = (GMenuItem*)p->pData;

			//加载菜单ICON
			if (pData->pImage == NULL && pData->pszResImage != NULL && pData->wImage != 0)
			{
				pData->pImage = ISHELL_LoadResImage(pApp->m_pIShell, pData->pszResImage, pData->wImage);
			}

			//加载菜单Text
			if (pData->pszResText != NULL && pData->wText != 0)
			{
				MEMSET(iTemText, 0, sizeof(AECHAR)*256);
				
				ISHELL_LoadResString(pApp->m_pIShell, pData->pszResText, pData->wText, iTemText, sizeof(AECHAR)* 256);

				pData->pText = iTemText;
			}

			if (i == pMe->m_Index)
			{
				if (pMe->m_pImageSe)
					IIMAGE_Draw(pMe->m_pImageSe, pMe->m_Rect.x, height + 2);

				ZEROAT(&infIc);
				if (pData->pImage)
				{
					IIMAGE_GetInfo(pData->pImage, &infIc);
					IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2);
				}

				xx = pMe->m_Rect.x + infIc.cx + 2;
				yy = height + (infSe.cy - h) / 2 + 2;
				dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx;
				dyy = h;
				SETAEERECT(&rec, xx, yy, dxx, dyy);

				oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cSelText);
				if (pMe->m_Properties & 0x02)
					IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT);
				IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT);

				if (pMe->m_isActive)
				{
					if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText) > dxx)
					{
						if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos) > dxx)
						{
							pMe->m_textPos++;
						}
						else
							pMe->m_textPos = 0;

						//单行太长的话,动态显示
						ISHELL_SetTimer(pApp->m_pIShell, 300, (PFNNOTIFY)CGMENUCTL_Redraw, (void*)pMe);
					}
				}

				height += infSe.cy;
				IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor);
			}
			else
			{
				ZEROAT(&infIc);
				if (pData->pImage)
				{
					IIMAGE_GetInfo(pData->pImage, &infIc);
					IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2);
				}

				xx = pMe->m_Rect.x + infIc.cx + 2;
				yy = height + (infSe.cy - h) / 2 + 2;
				dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx;
				dyy = h;
				SETAEERECT(&rec, xx, yy, dxx, dyy);

				oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cText);
				if (pMe->m_Properties & 0x01)
					IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT);
				IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT);

				height += infSe.cy;
				IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor);
			}

			p = p->pNext;
			i++;
			j++;
		}

		IDISPLAY_Update(pApp->m_pIDisplay);
		return ;
	}
}