/** * Create the native peer of a DateField. * Upon successful return, *datefieldPtr should be filled in properly. * Param time is number of milliseconds since the standard base time known as * "the epoch", namely January 1, 1970, 00:00:00 GMT. * (defined in midp_datefield.h) */ extern "C" MidpError lfpport_datefield_create(MidpItem* datefieldPtr, MidpDisplayable* formPtr, const pcsl_string* label, int layout, int input_mode, long time, const pcsl_string* timezoneID) { QString qlabel, qtzone; TRACE_DF(lfpport_datefield_Create); REPORT_INFO1(LC_HIGHUI, "\tinput_mode=%d\n", input_mode); pcsl_string2QString(*label, qlabel); pcsl_string2QString(*timezoneID, qtzone); // Fill in MidpItem structure datefieldPtr->widgetPtr = new DateField((formPtr == INVALID_NATIVE_ID ? 0 : (QWidget *)formPtr->frame.widgetPtr), qlabel, layout, time, input_mode, qtzone); initItemPtr(datefieldPtr, formPtr); return KNI_OK; }
/** * Creates a StringImageItem native peer without showing it yet. * Upon successful return, fields in *itemPtr should be set properly. */ MidpError lfpport_imageitem_create(MidpItem* itemPtr, MidpDisplayable* formPtr, const pcsl_string* label, int layout, unsigned char* imgPtr, const pcsl_string* altText, int appearanceMode) { QString labelStr; QString altTextStr; pcsl_string2QString(*label, labelStr); pcsl_string2QString(*altText, altTextStr); itemPtr->widgetPtr = new StringImageItem((formPtr == INVALID_NATIVE_ID ? 0 : (QWidget *)formPtr->frame.widgetPtr), labelStr, layout, gxpportqt_get_immutableimage_pixmap(imgPtr), altTextStr, appearanceMode); initItemPtr(itemPtr, formPtr); return KNI_OK; }
/** * Create a TextField Qt peer without showing it yet. * Upon successful return, fields in *itemPtr should be set properly. */ extern "C" MidpError lfpport_textfield_create(MidpItem* itemPtr, MidpDisplayable* formPtr, const pcsl_string* label, int layout, const pcsl_string* text, int maxSize, int constraints, const pcsl_string* inputMode) { QString qlabel, qtext, qinputMode; pcsl_string2QString(*label, qlabel); pcsl_string2QString(*text, qtext); pcsl_string2QString(*inputMode, qinputMode); /* Fill in MidpItem structure */ itemPtr->widgetPtr = new TextField((formPtr == INVALID_NATIVE_ID ? 0 : (QWidget *)formPtr->frame.widgetPtr), qlabel, layout, qtext, maxSize, constraints, qinputMode); initItemPtr(itemPtr, formPtr); return KNI_OK; }
/** * Creates a StringImageItem native peer without showing it yet. * Upon successful return, fields in *itemPtr should be set properly. */ MidpError lfpport_stringitem_create(MidpItem* itemPtr, MidpDisplayable* formPtr, const pcsl_string* label, int layout, const pcsl_string* text, PlatformFontPtr fontPtr, int appearanceMode) { /* Suppress unused-parameter warning */ (void)fontPtr; QString labelStr; QString textStr; pcsl_string2QString(*label, labelStr); pcsl_string2QString(*text, textStr); itemPtr->widgetPtr = new StringImageItem((formPtr == INVALID_NATIVE_ID ? 0 : (QWidget *)formPtr->frame.widgetPtr), labelStr, layout, textStr, (QFont *)fontPtr, appearanceMode); initItemPtr(itemPtr, formPtr); return KNI_OK; }
/** * Creates a custom item's native peer, but does not display it. * When this function returns successfully, *itemPtr will be filled. * * @param itemPtr pointer to the custom item's MidpItem structure. * @param ownerPtr pointer to the item's owner(form)'s MidpDisplayable * structure. * @param label the item label. * @param layout the item layout directive. * * @return an indication of success or the reason for failure */ extern "C" MidpError lfpport_customitem_create(MidpItem* customitemPtr, MidpDisplayable* formPtr, const pcsl_string* label, int layout) { QString qlabel; pcsl_string2QString(*label, qlabel); // Fill in MidpItem structure customitemPtr->widgetPtr = new CustomItem(formPtr == INVALID_NATIVE_ID ? 0 : (QWidget *)formPtr->frame.widgetPtr, qlabel, layout); initItemPtr(customitemPtr, formPtr); return KNI_OK; }