nim.h
来自「This is a resource based on j2me embedde」· C头文件 代码 · 共 448 行 · 第 1/2 页
H
448 行
* needs to call a Java function, it stores its state into a state_data * array and returns; the calling function invokes the specified Java function * and then re-invokes nim_process_key. */typedef jint state_data[STATE_DATA_ARRAY_SIZE];/** * Return a pointer to the constraint_map for the specified native input mode. * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @return address of a constraint_map */constraint_map* nim_get_constraint_map(jint id, jint* pInstanceData);/** * Initialize a NativeInputMethod instance. * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @return 0 if ok, non-zero in case of an error. */jint nim_initialize(jint id, jint* pInstanceData);/** * Finalizer. Must free instance data allocated in nim_initialize(). * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. */void nim_finalize(jint id, jint* pInstanceData);/** * Implements NativeImputMode.supportsConstraints(int). * This method is called to determine if this InputMode supports * the given text input constraints. The semantics of the constraints * value are defined in the javax.microedition.lcdui.TextField API. * If this InputMode returns false, this InputMode must not be used * to process key input for the selected text component. * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @param constraints text input constraints. The semantics of the * constraints value are defined in the TextField API. * * @return true if this InputMode supports the given text component * constraints, as defined in the MIDP TextField API */jboolean nim_supports_constraints(jint id, jint* pInstanceData, jint constraints);/** * Implements NativeInputMode.getName(). * Returns the display name which will represent this InputMode to * the user, such as in a selection list or the softbutton bar. * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @param name output parameter, receives the display name. * The calling function must use pcsl_string_free to free the string * (pcsl_string_free does nothing on statically allocated literals). * @return error code, PCSL_STRING_OK for ok */pcsl_string_status nim_get_name(jint id, jint* pInstanceData, pcsl_string* name);/** * Implements NativeInputMode.getName(). * Returns the command name which will represent this InputMode in * the input menu * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @param name output parameter, receives the locale-appropriate name * to represent this InputMode to the user * @return error code, PCSL_STRING_OK for ok */pcsl_string_status nim_get_command_name(jint id, jint* pInstanceData, pcsl_string* name);/** * Implements NativeInputMode.beginInput(InputModeMediator, String, int). * * This method will be called before any input keys are passed * to this InputMode to allow the InputMode to perform any needed * initialization. A reference to the InputModeMediator which is * currently managing the relationship between this InputMode and * the input session is passed in. This reference can be used * by this InputMode to commit text input as well as end the input * session with this InputMode. The reference is only valid until * this InputMode's endInput() method is called. * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @param inputSubset current input subset * @param constraints text input constraints. The semantics of the * constraints value are defined in the TextField API. */void nim_begin_input(jint id, jint* pInstanceData, const pcsl_string* inputSubset, int constraints);/** * Implements NativeInputMode.processKey(int keyCode, boolean longPress). * * This function implements the functionality of processKey, but * when it needs to call some mediator function, it stores the current * state into stateArgs and returns; processKey calls the necessary * interface function and calls processKey0 again. * * stateArgs[STATE_CALLBACK_RES] -- mediator function result. <br> * stateArgs[STATE_FUNC_TOKEN] -- the mediator function id. <br> * stateArgs[STATE_NEXT_STATE] -- the integer id of the next state, * the processKey repeats calling processKey0 * until this value becomes zero. <br> * stateArgs[STATE_INT_ARG] -- int argument for the mediator function, * if required. <br> * stateArgs[STATE_FINAL_RES] -- the result to be returned * by processKey. <br> * stateArgs[STATE_INTERNAL] -- may be used by native code implementing * processKey0. <br> * stateArgs[STATE_INTERNAL_EXT] -- may be used by native code * implementing processKey0. <br> * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @param key the code of the key which was pressed * @param longPress true if it's a long key press otherwise false * @param isClearKey 1 if it's a clear key, 0 if it's not, * and -1 if this could not be determined because the mediator * instance variable points to null. * @param state containsArgs state information that survives across * repeated reinvocations of this function, and data * to be passed to/from the mediator functions. * @param stringRes output variable that receives the string to be returned * by NativeInputMode.processKey * @return string status: -1 -- string error, 0 -- no string returned, 1 -- a string is returned */jint nim_process_key(jint id, jint* pInstanceData, jint key, jboolean longPress, jint isClearKey, state_data* stateArgs, pcsl_string* stringRes);/** * Implements public native char NativeInputMode.getPendingChar() * * return the pending char * used to bypass the asynchronous commit mechanism * e.g. to immediately commit a char before moving the cursor * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @return return the pending char */jchar nim_get_pending_char(jint id, jint* pInstanceData);/** * Implements NativeInputMode.getNextMatch() * * Return the next possible match for the key input processed thus * far by this InputMode. A call to this method should be preceeded * by a check of hasMoreMatches(). If the InputMode has more available * matches for the given input, this method will return them one by one. * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @param name output parameter, receives a pcsl_string representing * the next available match to the key * input thus far, or 'null' if no pending input is available * @return error code, PCSL_STRING_OK for ok */pcsl_string_status nim_get_next_match(jint id, jint* pInstanceData, pcsl_string* name);/** * Implements NativeInputMode.hasMoreMatches() * * True, if after processing a key, there is more than one possible * match to the input. If this method returns true, the getNextMatch() * method can be called to return the value. * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @return true if after processing a key, there is more than the one * possible match to the given input */jboolean nim_has_more_matches(jint id, jint* pInstanceData);/** * Implements NativeInputMode.getMatchList() * * Gets the possible string matches * * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. * @param match_list output valiable that receives an address of array * of pcsl_strings, representing the possible matches. * May be null. * @param nmatches output valiable that receives the number of * strings in the pcsl_string array. * @return error code, PCSL_STRING_NULL for ok */pcsl_string_status nim_get_match_list(jint id, jint* pInstanceData, pcsl_string** match_list, int* nmatches);/** * Implements NativeInputMode.endInput() * * Mark the end of this InputMode's processing. The only possible call * to this InputMode after a call to endInput() is a call to beginInput() * to begin a new input session. * @param id the integer ID of the native input mode * @param pInstanceData points to an integer field that may be * used as room for a pointer to instance data. */void nim_end_input(jint id, jint* pInstanceData);/* * Return the address of a statically allocated array containing * the supported native input mode ids, and its size. * * @param n output variable that receives the number of elements in the array * (may be zero). * @return address of the array with supported input modes (may be null). */jint* nim_get_input_mode_ids(jint* n);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?