#ifndef __MMI_CON_C__
#define __MMI_CON_C__
#include "MMI_features.h"
#include "ConDefs.h"
#include "HistoryGprot.h"
#include "GlobalDefs.h"
#include "wgui_categories.h"
#include "wgui_categories_inputs.h"
#include "wgui_inline_edit.h"
#include "Unicodexdcl.h"
#include "settingprofile.h"
#include "Organizerdef.h"
#include "CommonScreens.h"
#include "Calculator.h"
typedef struct
{
S8 Name;
S8 NameBuf[20];
S32 Gender;
U8 *GenderList[2];
S32 BloodType;
U8 *BloodTypeList[4];
U8 *Result;
U8 CurrHilite;
} con_context_struct;
/* * Local Variable */
/* * Local Function */
U8 ConDelScrCB(void *p);
/*
* Global Variable
*/
con_context_struct *g_con_cntx = NULL;
extern wgui_inline_item wgui_inline_items[];
/*
* Global Function
*/
extern void gui_float_string(DOUBLE dob_val, S32 prec_val, S8 *out_buffer);
extern void set_leading_zero(U8 u8type);
void ConInit(void)
{
SetHiliteHandler(MENU_ID_CONSTELLATION, HighlightConMenu);
}
void HighlightConMenu(void)
{
SetLeftSoftkeyFunction(EntryConInputScreen, KEY_EVENT_UP);
SetKeyHandler(EntryConInputScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
void EntryConInputScreen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *guiBuffer;
U8 *inputBuffer; /* added for inline edit history */
U16 inputBufferSize; /* added for inline edit history */
U16 ConImageList[6] = {0, 0, 0, 0, 0, 0};
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (g_con_cntx == NULL)
{
g_con_cntx = OslMalloc(sizeof(con_context_struct));
memset(g_con_cntx, 0, sizeof(con_context_struct));
}
EntryNewScreen(SCR_CON_INPUT, ExitConInputScreen, NULL, NULL);
SetDelScrnIDCallbackHandler(SCR_CON_INPUT, (HistoryDelCBPtr) ConDelScrCB);
InitializeCategory57Screen();
guiBuffer = GetCurrGuiBuffer(SCR_CON_INPUT);
ConFillInlineStruct();
RegisterHighlightHandler(HighlightConInlineEditor);
if (g_con_cntx->Gender == 0)
{
ConImageList[CON_GENDER] = IMG_CON_BLUE_FLOWER;
}
else
{
ConImageList[CON_GENDER] = IMG_CON_RED_FLOWER;
}
inputBuffer = GetCurrNInputBuffer(SCR_CON_INPUT, &inputBufferSize); /* added for inline edit history */
if (inputBuffer != NULL) /* added for inline edit history */
{
SetCategory57Data(wgui_inline_items, LAB_RES_CON_TOTAL, inputBuffer); /* sets the data */
}
DisableCategory57ScreenDone();
#ifdef __MMI_SLIM_LISTMENU_NUMBER__
wgui_override_list_menu_slim_style(WGUI_LIST_MENU_SLIM_STYLE_DRAW_ICON);
#endif
/* 041205 Calvin added : Add an image on top of category57 */
/* Category57AppendTopImage(IMG_BMI_WELCOME_SCREEN, TRUE); */
/* Calvin end */
/*ShowCategory57Screen(
STR_CON_MENU_CAPTION,
GetRootTitleIcon(MENU_ID_CONSTELLATION),
STR_GLOBAL_OK,
IMG_GLOBAL_OK,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
LAB_RES_CON_TOTAL,
ConImageList,
wgui_inline_items,
g_con_cntx->CurrHilite,
guiBuffer);
*/
ShowCategory357Screen(
STR_CON_MENU_CAPTION,
GetRootTitleIcon(MENU_ID_CONSTELLATION),
STR_GLOBAL_OK,
IMG_GLOBAL_OK,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
IMG_CON_LOGO,
LAB_RES_CON_TOTAL,
ConImageList,
wgui_inline_items,
g_con_cntx->CurrHilite,
guiBuffer);
SetCategory57RightSoftkeyFunctions(ConComputeResult, GoBackHistory);
}
void EntryConResultScreen(void)
{
U8 *guiBuffer;
U8 *resultBuffer;
/*memset(g_con_cntx->Result, 0, sizeof(g_con_cntx->Result));*/
guiBuffer = GetCurrGuiBuffer(SCR_CON_RESULT);
/*resultBuffer=GetCurrGuiBuffer(SCR_CON_RESULT);*/
EntryNewScreen(SCR_CON_RESULT, NULL, EntryConResultScreen, NULL);
switch(g_con_cntx->BloodType)
{
case 0:
g_con_cntx->Result=(U8*) GetString(STR_CON_RESULT_A);
break;
case 1:
g_con_cntx->Result=(U8*) GetString(STR_CON_RESULT_B);
break;
case 2:
g_con_cntx->Result=(U8*) GetString(STR_CON_RESULT_O);
break;
case 3:
g_con_cntx->Result=(U8*) GetString(STR_CON_RESULT_AB);
break;
}
ShowCategory74Screen(STR_CON_MENU_CAPTION,GetRootTitleIcon(MENU_ID_CONSTELLATION),
STR_GLOBAL_OK,
IMG_GLOBAL_OK,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
g_con_cntx->Result,
((S32)sizeof(g_con_cntx->Result)),
guiBuffer);
SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}
U8 ConDelScrCB(void *p)
{
if (GetActiveScreenId() == SCR_CON_INPUT)
{
CloseCategory57Screen();
}
ConDeInit();
return MMI_FALSE;
}
void ConDeInit(void)
{
if (g_con_cntx)
{
OslMfree(g_con_cntx);
g_con_cntx = NULL;
}
}
void ConFillInlineStruct(void)
{
set_leading_zero(FALSE);
/* name Caption*/
SetInlineItemActivation(&wgui_inline_items[CON_NAME_LAB], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
SetInlineItemCaption(&wgui_inline_items[CON_NAME_LAB], (U8*) GetString(STR_CON_NAME));
SetInlineItemFullWidth(&wgui_inline_items[CON_NAME_LAB]);
/* name */
SetInlineItemActivation(&wgui_inline_items[CON_NAME], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
SetInlineItemTextEdit(
&wgui_inline_items[CON_NAME],
(U8*) g_con_cntx->NameBuf,
(20 + 1),
INPUT_TYPE_SM_MULTITAP_PINYIN);
RightJustifyInlineItem(&wgui_inline_items[CON_NAME]);
SetInlineItemFullWidth(&wgui_inline_items[CON_NAME]);
EnableInlineItemBoundary(&wgui_inline_items[CON_NAME]);
g_con_cntx->GenderList[0] = (U8*) GetString(STR_CON_GENDER_MALE);
g_con_cntx->GenderList[1] = (U8*) GetString(STR_CON_GENDER_FEMALE);
/* gender */
SetInlineItemActivation(&wgui_inline_items[CON_GENDER], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
SetInlineItemSelect(&wgui_inline_items[CON_GENDER], 2, (U8 **) g_con_cntx->GenderList, &g_con_cntx->Gender);
RegisterInlineSelectHighlightHandler(&wgui_inline_items[CON_GENDER], HighlightConGender);
/* Blood Caption*/
SetInlineItemActivation(&wgui_inline_items[CON_BLOODTYPE_LAB], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
SetInlineItemCaption(&wgui_inline_items[CON_BLOODTYPE_LAB], (U8*) GetString(STR_CON_BLOODTYPE));
SetInlineItemFullWidth(&wgui_inline_items[CON_BLOODTYPE_LAB]);
/* Blood */
g_con_cntx->BloodTypeList[0] = (U8*) GetString(STR_CON_BLOODTYPE_A);
g_con_cntx->BloodTypeList[1] = (U8*) GetString(STR_CON_BLOODTYPE_B);
g_con_cntx->BloodTypeList[2] = (U8*) GetString(STR_CON_BLOODTYPE_O);
g_con_cntx->BloodTypeList[3] = (U8*) GetString(STR_CON_BLOODTYPE_AB);
SetInlineItemActivation(&wgui_inline_items[CON_BLOODTYPE], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
SetInlineItemSelect(&wgui_inline_items[CON_BLOODTYPE], 4, (U8 **) g_con_cntx->BloodTypeList, &g_con_cntx->BloodType);
RegisterInlineSelectHighlightHandler(&wgui_inline_items[CON_BLOODTYPE], HighlightConBloodType);
}
void HighlightConBloodType(S32 index)
{
if (g_con_cntx->BloodType == 0)
{
Category57ChangeItemIcon(4, IMG_CON_BLUE_FLOWER);
}
else if(g_con_cntx->BloodType == 1)
{
Category57ChangeItemIcon(4, IMG_CON_RED_FLOWER);
}
else if(g_con_cntx->BloodType == 2)
{
Category57ChangeItemIcon(4, IMG_CON_BLUE_FLOWER);
}
else
{
Category57ChangeItemIcon(4, IMG_CON_RED_FLOWER);
}
RedrawCategory57Screen();
}
void HighlightConGender(S32 index)