Back to index

im-sdk  12.3.91
IIIMQKeyEvent.cpp
Go to the documentation of this file.
00001 #include <qdatetime.h>
00002 #include "IIIMQKeyEvent.hh"
00003 
00004 static int
00005 q2icode(
00006     QKeyEvent *e
00007 )
00008 {
00009     int qc = e->key();
00010 
00011     switch (qc) {
00012       case Qt::Key_Escape:
00013        return IIIMF_KEYCODE_ESCAPE;
00014       case Qt::Key_Tab:
00015        return IIIMF_KEYCODE_TAB;
00016       case Qt::Key_Backtab:
00017        return 0;
00018       case Qt::Key_Backspace:
00019        return IIIMF_KEYCODE_BACK_SPACE;
00020       case Qt::Key_Return:
00021        return IIIMF_KEYCODE_ENTER;
00022       case Qt::Key_Enter:
00023        return IIIMF_KEYCODE_ENTER;
00024       case Qt::Key_Insert:
00025        return IIIMF_KEYCODE_INSERT;
00026       case Qt::Key_Delete:
00027        return IIIMF_KEYCODE_DELETE;
00028       case Qt::Key_Pause:
00029        return IIIMF_KEYCODE_PAUSE;
00030       case Qt::Key_Print:
00031        return -IIIMF_KEYCODE_PRINTSCREEN;
00032       case Qt::Key_SysReq:
00033        return 0;
00034       case Qt::Key_Home:
00035        return -IIIMF_KEYCODE_HOME;
00036       case Qt::Key_End:
00037        return -IIIMF_KEYCODE_END;
00038       case Qt::Key_Left:
00039        return -IIIMF_KEYCODE_LEFT;
00040       case Qt::Key_Up:
00041        return -IIIMF_KEYCODE_UP;
00042       case Qt::Key_Right:
00043        return -IIIMF_KEYCODE_RIGHT;
00044       case Qt::Key_Down:
00045        return -IIIMF_KEYCODE_DOWN;
00046       case Qt::Key_Prior:
00047        return -IIIMF_KEYCODE_PAGE_UP;
00048       case Qt::Key_Next:
00049        return -IIIMF_KEYCODE_PAGE_DOWN;
00050       case Qt::Key_Shift:
00051        return -IIIMF_KEYCODE_SHIFT;
00052       case Qt::Key_Control:
00053        return -IIIMF_KEYCODE_CONTROL;
00054       case Qt::Key_Meta:
00055        return -IIIMF_KEYCODE_META;
00056       case Qt::Key_Alt:
00057        return -IIIMF_KEYCODE_ALT;
00058       case Qt::Key_CapsLock:
00059        return -IIIMF_KEYCODE_CAPS_LOCK;
00060       case Qt::Key_NumLock:
00061        return -IIIMF_KEYCODE_NUM_LOCK;
00062       case Qt::Key_ScrollLock:
00063        return -IIIMF_KEYCODE_SCROLL_LOCK;
00064       case Qt::Key_Clear:
00065        return -IIIMF_KEYCODE_CLEAR;
00066       case Qt::Key_F1:
00067        return -IIIMF_KEYCODE_F1;
00068       case Qt::Key_F2:
00069        return -IIIMF_KEYCODE_F2;
00070       case Qt::Key_F3:
00071        return -IIIMF_KEYCODE_F3;
00072       case Qt::Key_F4:
00073        return -IIIMF_KEYCODE_F4;
00074       case Qt::Key_F5:
00075        return -IIIMF_KEYCODE_F5;
00076       case Qt::Key_F6:
00077        return -IIIMF_KEYCODE_F6;
00078       case Qt::Key_F7:
00079        return -IIIMF_KEYCODE_F7;
00080       case Qt::Key_F8:
00081        return -IIIMF_KEYCODE_F8;
00082       case Qt::Key_F9:
00083        return -IIIMF_KEYCODE_F9;
00084       case Qt::Key_F10:
00085        return -IIIMF_KEYCODE_F10;
00086       case Qt::Key_F11:
00087        return -IIIMF_KEYCODE_F11;
00088       case Qt::Key_F12:
00089        return -IIIMF_KEYCODE_F12;
00090       case Qt::Key_F13:
00091        return -IIIMF_KEYCODE_F13;
00092       case Qt::Key_F14:
00093        return -IIIMF_KEYCODE_F14;
00094       case Qt::Key_F15:
00095        return -IIIMF_KEYCODE_F15;
00096       case Qt::Key_F16:
00097        return -IIIMF_KEYCODE_F16;
00098       case Qt::Key_F17:
00099        return -IIIMF_KEYCODE_F17;
00100       case Qt::Key_F18:
00101        return -IIIMF_KEYCODE_F18;
00102       case Qt::Key_F19:
00103        return -IIIMF_KEYCODE_F19;
00104       case Qt::Key_F20:
00105        return -IIIMF_KEYCODE_F20;
00106       case Qt::Key_F21:
00107        return -IIIMF_KEYCODE_F21;
00108       case Qt::Key_F22:
00109        return -IIIMF_KEYCODE_F22;
00110       case Qt::Key_F23:
00111        return -IIIMF_KEYCODE_F23;
00112       case Qt::Key_F24:
00113        return -IIIMF_KEYCODE_F24;
00114 
00115       case Qt::Key_F25:
00116       case Qt::Key_F26:
00117       case Qt::Key_F27:
00118       case Qt::Key_F28:
00119       case Qt::Key_F29:
00120       case Qt::Key_F30:
00121       case Qt::Key_F31:
00122       case Qt::Key_F32:
00123       case Qt::Key_F33:
00124       case Qt::Key_F34:
00125       case Qt::Key_F35:
00126        return 0;
00127 
00128       case Qt::Key_Super_L:
00129       case Qt::Key_Super_R:
00130       case Qt::Key_Menu:
00131       case Qt::Key_Hyper_L:
00132       case Qt::Key_Hyper_R:
00133        return 0;
00134       case Qt::Key_Help:
00135        return -IIIMF_KEYCODE_HELP;
00136 
00137       case Qt::Key_Space:
00138        // case Qt::Key_Any:
00139        return IIIMF_KEYCODE_SPACE;
00140 
00141       case Qt::Key_Exclam:
00142       case Qt::Key_QuoteDbl:
00143       case Qt::Key_NumberSign:
00144       case Qt::Key_Dollar:
00145       case Qt::Key_Percent:
00146       case Qt::Key_Ampersand:
00147       case Qt::Key_Apostrophe:
00148       case Qt::Key_ParenLeft:
00149       case Qt::Key_ParenRight:
00150       case Qt::Key_Asterisk:
00151       case Qt::Key_Plus:
00152       case Qt::Key_Comma:
00153       case Qt::Key_Minus:
00154       case Qt::Key_Period:
00155       case Qt::Key_Slash:
00156       case Qt::Key_0:
00157       case Qt::Key_1:
00158       case Qt::Key_2:
00159       case Qt::Key_3:
00160       case Qt::Key_4:
00161       case Qt::Key_5:
00162       case Qt::Key_6:
00163       case Qt::Key_7:
00164       case Qt::Key_8:
00165       case Qt::Key_9:
00166       case Qt::Key_Colon:
00167       case Qt::Key_Semicolon:
00168       case Qt::Key_Less:
00169       case Qt::Key_Equal:
00170       case Qt::Key_Greater:
00171       case Qt::Key_Question:
00172       case Qt::Key_At:
00173       case Qt::Key_A:
00174       case Qt::Key_B:
00175       case Qt::Key_C:
00176       case Qt::Key_D:
00177       case Qt::Key_E:
00178       case Qt::Key_F:
00179       case Qt::Key_G:
00180       case Qt::Key_H:
00181       case Qt::Key_I:
00182       case Qt::Key_J:
00183       case Qt::Key_K:
00184       case Qt::Key_L:
00185       case Qt::Key_M:
00186       case Qt::Key_N:
00187       case Qt::Key_O:
00188       case Qt::Key_P:
00189       case Qt::Key_Q:
00190       case Qt::Key_R:
00191       case Qt::Key_S:
00192       case Qt::Key_T:
00193       case Qt::Key_U:
00194       case Qt::Key_V:
00195       case Qt::Key_W:
00196       case Qt::Key_X:
00197       case Qt::Key_Y:
00198       case Qt::Key_Z:
00199       case Qt::Key_BracketLeft:
00200       case Qt::Key_Backslash:
00201       case Qt::Key_BracketRight:
00202       case Qt::Key_AsciiCircum:
00203       case Qt::Key_Underscore:
00204       case Qt::Key_QuoteLeft:
00205       case Qt::Key_BraceLeft:
00206       case Qt::Key_Bar:
00207       case Qt::Key_BraceRight:
00208       case Qt::Key_AsciiTilde:
00209        return qc;
00210 
00211       case Qt::Key_nobreakspace:
00212       case Qt::Key_exclamdown:
00213       case Qt::Key_cent:
00214       case Qt::Key_sterling:
00215       case Qt::Key_currency:
00216       case Qt::Key_yen:
00217       case Qt::Key_brokenbar:
00218       case Qt::Key_section:
00219       case Qt::Key_diaeresis:
00220       case Qt::Key_copyright:
00221       case Qt::Key_ordfeminine:
00222       case Qt::Key_guillemotleft:
00223       case Qt::Key_notsign:
00224       case Qt::Key_hyphen:
00225       case Qt::Key_registered:
00226       case Qt::Key_macron:
00227       case Qt::Key_degree:
00228       case Qt::Key_plusminus:
00229       case Qt::Key_twosuperior:
00230       case Qt::Key_threesuperior:
00231       case Qt::Key_acute:
00232       case Qt::Key_mu:
00233       case Qt::Key_paragraph:
00234       case Qt::Key_periodcentered:
00235       case Qt::Key_cedilla:
00236       case Qt::Key_onesuperior:
00237       case Qt::Key_masculine:
00238       case Qt::Key_guillemotright:
00239       case Qt::Key_onequarter:
00240       case Qt::Key_onehalf:
00241       case Qt::Key_threequarters:
00242       case Qt::Key_questiondown:
00243       case Qt::Key_Agrave:
00244       case Qt::Key_Aacute:
00245       case Qt::Key_Acircumflex:
00246       case Qt::Key_Atilde:
00247       case Qt::Key_Adiaeresis:
00248       case Qt::Key_Aring:
00249       case Qt::Key_AE:
00250       case Qt::Key_Ccedilla:
00251       case Qt::Key_Egrave:
00252       case Qt::Key_Eacute:
00253       case Qt::Key_Ecircumflex:
00254       case Qt::Key_Ediaeresis:
00255       case Qt::Key_Igrave:
00256       case Qt::Key_Iacute:
00257       case Qt::Key_Icircumflex:
00258       case Qt::Key_Idiaeresis:
00259       case Qt::Key_ETH:
00260       case Qt::Key_Ntilde:
00261       case Qt::Key_Ograve:
00262       case Qt::Key_Oacute:
00263       case Qt::Key_Ocircumflex:
00264       case Qt::Key_Otilde:
00265       case Qt::Key_Odiaeresis:
00266       case Qt::Key_multiply:
00267       case Qt::Key_Ooblique:
00268       case Qt::Key_Ugrave:
00269       case Qt::Key_Uacute:
00270       case Qt::Key_Ucircumflex:
00271       case Qt::Key_Udiaeresis:
00272       case Qt::Key_Yacute:
00273       case Qt::Key_THORN:
00274       case Qt::Key_ssharp:
00275       case Qt::Key_agrave:
00276       case Qt::Key_aacute:
00277       case Qt::Key_acircumflex:
00278       case Qt::Key_atilde:
00279       case Qt::Key_adiaeresis:
00280       case Qt::Key_aring:
00281       case Qt::Key_ae:
00282       case Qt::Key_ccedilla:
00283       case Qt::Key_egrave:
00284       case Qt::Key_eacute:
00285       case Qt::Key_ecircumflex:
00286       case Qt::Key_ediaeresis:
00287       case Qt::Key_igrave:
00288       case Qt::Key_iacute:
00289       case Qt::Key_icircumflex:
00290       case Qt::Key_idiaeresis:
00291       case Qt::Key_eth:
00292       case Qt::Key_ntilde:
00293       case Qt::Key_ograve:
00294       case Qt::Key_oacute:
00295       case Qt::Key_ocircumflex:
00296       case Qt::Key_otilde:
00297       case Qt::Key_odiaeresis:
00298       case Qt::Key_division:
00299       case Qt::Key_oslash:
00300       case Qt::Key_ugrave:
00301       case Qt::Key_uacute:
00302       case Qt::Key_ucircumflex:
00303       case Qt::Key_udiaeresis:
00304       case Qt::Key_yacute:
00305       case Qt::Key_thorn:
00306       case Qt::Key_ydiaeresis:
00307        return 0;
00308     }
00309 
00310     return 0;
00311 }
00312 
00313 enum IIIMF_MODIFIERS {
00314        IIIMF_SHIFT_MODIFIER = 1,
00315        IIIMF_CONTROL_MODIFIER = 2,
00316        IIIMF_META_MODIFIER = 4,
00317        IIIMF_ALT_MODIFIER = 8
00318 };
00319 
00320 static int
00321 modifier(
00322     QKeyEvent *e
00323 )
00324 {
00325     int mod = 0;
00326     int st = e->state();
00327 
00328     if (st & Qt::ShiftButton) {
00329        mod |= IIIMF_SHIFT_MODIFIER;
00330     }
00331     if (st & Qt::ControlButton) {
00332        mod |= IIIMF_CONTROL_MODIFIER;
00333     }
00334     if (st & Qt::MetaButton) {
00335        mod |= IIIMF_META_MODIFIER;
00336     }
00337     if (st & Qt::AltButton) {
00338        mod |= IIIMF_ALT_MODIFIER;
00339     }
00340 
00341     return mod;
00342 }
00343     
00344 
00345 IIIMF_status
00346 convert_QKeyEvent_to_IIIMCF_keyevent(
00347     QKeyEvent *e,
00348     IIIMCF_keyevent *pkev
00349 )
00350 {
00351     int c;
00352 
00353     c = q2icode(e);
00354     if (c == 0) return IIIMF_STATUS_FAIL;
00355 
00356     if (c < 0) {
00357        pkev->keychar = 0;
00358        pkev->keycode = -c;
00359     } else {
00360        pkev->keychar = e->ascii();
00361        pkev->keycode = c;
00362     }
00363     pkev->modifier = modifier(e);
00364 
00365     QTime t = QTime::currentTime();
00366     pkev->time_stamp = t.msec();
00367 
00368     return IIIMF_STATUS_SUCCESS;
00369 }
00370 
00371 static int
00372 i2qcode(
00373     int iiimcode
00374 )
00375 {
00376     switch (iiimcode) {
00377       case IIIMF_KEYCODE_UNDEFINED:
00378        return 0;
00379       case IIIMF_KEYCODE_CANCEL:
00380        return 0;
00381       case IIIMF_KEYCODE_BACK_SPACE:
00382        return Qt::Key_Backspace;
00383       case IIIMF_KEYCODE_TAB:
00384        return Qt::Key_Tab;
00385       case IIIMF_KEYCODE_ENTER:
00386        return Qt::Key_Enter;
00387       case IIIMF_KEYCODE_CLEAR:
00388        return Qt::Key_Clear;
00389       case IIIMF_KEYCODE_SHIFT:
00390        return Qt::Key_Shift;
00391       case IIIMF_KEYCODE_CONTROL:
00392        return Qt::Key_Control;
00393       case IIIMF_KEYCODE_ALT:
00394        return Qt::Key_Alt;
00395       case IIIMF_KEYCODE_PAUSE:
00396        return Qt::Key_Pause;
00397       case IIIMF_KEYCODE_CAPS_LOCK:
00398        return Qt::Key_CapsLock;
00399       case IIIMF_KEYCODE_KANA:
00400       case IIIMF_KEYCODE_FINAL:
00401       case IIIMF_KEYCODE_KANJI:
00402        return 0;
00403       case IIIMF_KEYCODE_ESCAPE:
00404        return Qt::Key_Escape;
00405       case IIIMF_KEYCODE_CONVERT:
00406       case IIIMF_KEYCODE_NONCONVERT:
00407       case IIIMF_KEYCODE_ACCEPT:
00408       case IIIMF_KEYCODE_MODECHANGE:
00409        return 0;
00410       case IIIMF_KEYCODE_SPACE:
00411        return Qt::Key_Space;
00412       case IIIMF_KEYCODE_PAGE_UP:
00413        return Qt::Key_Prior;
00414       case IIIMF_KEYCODE_PAGE_DOWN:
00415        return Qt::Key_Next;
00416       case IIIMF_KEYCODE_END:
00417        return Qt::Key_End;
00418       case IIIMF_KEYCODE_HOME:
00419        return Qt::Key_Home;
00420       case IIIMF_KEYCODE_LEFT:
00421        return Qt::Key_Left;
00422       case IIIMF_KEYCODE_UP:
00423        return Qt::Key_Up;
00424       case IIIMF_KEYCODE_RIGHT:
00425        return Qt::Key_Right;
00426       case IIIMF_KEYCODE_DOWN:
00427        return Qt::Key_Down;
00428       case IIIMF_KEYCODE_COMMA:
00429        return Qt::Key_Comma;
00430       case IIIMF_KEYCODE_MINUS:
00431        return Qt::Key_Minus;
00432       case IIIMF_KEYCODE_PERIOD:
00433        return Qt::Key_Period;
00434       case IIIMF_KEYCODE_SLASH:
00435        return Qt::Key_Slash;
00436 
00437       case IIIMF_KEYCODE_0:
00438       case IIIMF_KEYCODE_1:
00439       case IIIMF_KEYCODE_2:
00440       case IIIMF_KEYCODE_3:
00441       case IIIMF_KEYCODE_4:
00442       case IIIMF_KEYCODE_5:
00443       case IIIMF_KEYCODE_6:
00444       case IIIMF_KEYCODE_7:
00445       case IIIMF_KEYCODE_8:
00446       case IIIMF_KEYCODE_9:
00447 
00448       case IIIMF_KEYCODE_SEMICOLON:
00449       case IIIMF_KEYCODE_EQUALS:
00450 
00451       case IIIMF_KEYCODE_A:
00452       case IIIMF_KEYCODE_B:
00453       case IIIMF_KEYCODE_C:
00454       case IIIMF_KEYCODE_D:
00455       case IIIMF_KEYCODE_E:
00456       case IIIMF_KEYCODE_F:
00457       case IIIMF_KEYCODE_G:
00458       case IIIMF_KEYCODE_H:
00459       case IIIMF_KEYCODE_I:
00460       case IIIMF_KEYCODE_J:
00461       case IIIMF_KEYCODE_K:
00462       case IIIMF_KEYCODE_L:
00463       case IIIMF_KEYCODE_M:
00464       case IIIMF_KEYCODE_N:
00465       case IIIMF_KEYCODE_O:
00466       case IIIMF_KEYCODE_P:
00467       case IIIMF_KEYCODE_Q:
00468       case IIIMF_KEYCODE_R:
00469       case IIIMF_KEYCODE_S:
00470       case IIIMF_KEYCODE_T:
00471       case IIIMF_KEYCODE_U:
00472       case IIIMF_KEYCODE_V:
00473       case IIIMF_KEYCODE_W:
00474       case IIIMF_KEYCODE_X:
00475       case IIIMF_KEYCODE_Y:
00476       case IIIMF_KEYCODE_Z:
00477 
00478       case IIIMF_KEYCODE_OPEN_BRACKET:
00479       case IIIMF_KEYCODE_BACK_SLASH:
00480       case IIIMF_KEYCODE_CLOSE_BRACKET:
00481        return iiimcode;
00482 
00483       case IIIMF_KEYCODE_NUMPAD0:
00484       case IIIMF_KEYCODE_NUMPAD1:
00485       case IIIMF_KEYCODE_NUMPAD2:
00486       case IIIMF_KEYCODE_NUMPAD3:
00487       case IIIMF_KEYCODE_NUMPAD4:
00488       case IIIMF_KEYCODE_NUMPAD5:
00489       case IIIMF_KEYCODE_NUMPAD6:
00490       case IIIMF_KEYCODE_NUMPAD7:
00491       case IIIMF_KEYCODE_NUMPAD8:
00492       case IIIMF_KEYCODE_NUMPAD9:
00493       case IIIMF_KEYCODE_MULTIPLY:
00494       case IIIMF_KEYCODE_ADD:
00495       case IIIMF_KEYCODE_SEPARATOR:
00496        //case IIIMF_KEYCODE_SEPARATER:
00497       case IIIMF_KEYCODE_SUBTRACT:
00498       case IIIMF_KEYCODE_DECIMAL:
00499       case IIIMF_KEYCODE_DIVIDE:
00500        return iiimcode;
00501 
00502       case IIIMF_KEYCODE_F1:
00503        return Qt::Key_F1;
00504       case IIIMF_KEYCODE_F2:
00505        return Qt::Key_F2;
00506       case IIIMF_KEYCODE_F3:
00507        return Qt::Key_F3;
00508       case IIIMF_KEYCODE_F4:
00509        return Qt::Key_F4;
00510       case IIIMF_KEYCODE_F5:
00511        return Qt::Key_F5;
00512       case IIIMF_KEYCODE_F6:
00513        return Qt::Key_F6;
00514       case IIIMF_KEYCODE_F7:
00515        return Qt::Key_F7;
00516       case IIIMF_KEYCODE_F8:
00517        return Qt::Key_F8;
00518       case IIIMF_KEYCODE_F9:
00519        return Qt::Key_F9;
00520       case IIIMF_KEYCODE_F10:
00521        return Qt::Key_F10;
00522       case IIIMF_KEYCODE_F11:
00523        return Qt::Key_F11;
00524       case IIIMF_KEYCODE_F12:
00525        return Qt::Key_F12;
00526 
00527       case IIIMF_KEYCODE_DELETE:
00528        return Qt::Key_Delete;
00529       case IIIMF_KEYCODE_DEAD_GRAVE:
00530       case IIIMF_KEYCODE_DEAD_ACUTE:
00531       case IIIMF_KEYCODE_DEAD_CIRCUMFLEX:
00532       case IIIMF_KEYCODE_DEAD_TILDE:
00533       case IIIMF_KEYCODE_DEAD_MACRON:
00534       case IIIMF_KEYCODE_DEAD_BREVE:
00535       case IIIMF_KEYCODE_DEAD_ABOVEDOT:
00536       case IIIMF_KEYCODE_DEAD_DIAERESIS:
00537       case IIIMF_KEYCODE_DEAD_ABOVERING:
00538       case IIIMF_KEYCODE_DEAD_DOUBLEACUTE:
00539       case IIIMF_KEYCODE_DEAD_CARON:
00540       case IIIMF_KEYCODE_DEAD_CEDILLA:
00541       case IIIMF_KEYCODE_DEAD_OGONEK:
00542       case IIIMF_KEYCODE_DEAD_IOTA:
00543       case IIIMF_KEYCODE_DEAD_VOICED_SOUND:
00544       case IIIMF_KEYCODE_DEAD_SEMIVOICED_SOUND:
00545        return 0;
00546 
00547       case IIIMF_KEYCODE_NUM_LOCK:
00548        return Qt::Key_NumLock;
00549       case IIIMF_KEYCODE_SCROLL_LOCK:
00550        return Qt::Key_ScrollLock;
00551       case IIIMF_KEYCODE_AMPERSAND:
00552        return Qt::Key_Ampersand;
00553       case IIIMF_KEYCODE_ASTERISK:
00554        return Qt::Key_Asterisk;
00555       case IIIMF_KEYCODE_QUOTEDBL:
00556        return Qt::Key_QuoteDbl;
00557       case IIIMF_KEYCODE_LESS:
00558        return Qt::Key_Less;
00559       case IIIMF_KEYCODE_PRINTSCREEN:
00560        return Qt::Key_Print;
00561       case IIIMF_KEYCODE_INSERT:
00562        return Qt::Key_Insert;
00563       case IIIMF_KEYCODE_HELP:
00564        return Qt::Key_Help;
00565       case IIIMF_KEYCODE_META:
00566        return Qt::Key_Meta;
00567       case IIIMF_KEYCODE_GREATER:
00568        return Qt::Key_Greater;
00569       case IIIMF_KEYCODE_BRACELEFT:
00570        return Qt::Key_BraceLeft;
00571       case IIIMF_KEYCODE_BRACERIGHT:
00572        return Qt::Key_BraceRight;
00573 
00574       case IIIMF_KEYCODE_BACK_QUOTE:
00575       case IIIMF_KEYCODE_QUOTE:
00576       case IIIMF_KEYCODE_KP_UP:
00577       case IIIMF_KEYCODE_KP_DOWN:
00578       case IIIMF_KEYCODE_KP_LEFT:
00579       case IIIMF_KEYCODE_KP_RIGHT:
00580       case IIIMF_KEYCODE_ALPHANUMERIC:
00581       case IIIMF_KEYCODE_KATAKANA:
00582       case IIIMF_KEYCODE_HIRAGANA:
00583       case IIIMF_KEYCODE_FULL_WIDTH:
00584       case IIIMF_KEYCODE_HALF_WIDTH:
00585       case IIIMF_KEYCODE_ROMAN_CHARACTERS:
00586       case IIIMF_KEYCODE_ALL_CANDIDATES:
00587       case IIIMF_KEYCODE_PREVIOUS_CANDIDATE:
00588       case IIIMF_KEYCODE_CODE_INPUT:
00589       case IIIMF_KEYCODE_JAPANESE_KATAKANA:
00590       case IIIMF_KEYCODE_JAPANESE_HIRAGANA:
00591       case IIIMF_KEYCODE_JAPANESE_ROMAN:
00592       case IIIMF_KEYCODE_KANA_LOCK:
00593       case IIIMF_KEYCODE_INPUT_METHOD_ON_OFF:
00594       case IIIMF_KEYCODE_AT:
00595       case IIIMF_KEYCODE_COLON:
00596       case IIIMF_KEYCODE_CIRCUMFLEX:
00597       case IIIMF_KEYCODE_DOLLAR:
00598       case IIIMF_KEYCODE_EURO_SIGN:
00599       case IIIMF_KEYCODE_EXCLAMATION_MARK:
00600       case IIIMF_KEYCODE_INVERTED_EXCLAMATION_MARK:
00601       case IIIMF_KEYCODE_LEFT_PARENTHESIS:
00602       case IIIMF_KEYCODE_NUMBER_SIGN:
00603       case IIIMF_KEYCODE_PLUS:
00604       case IIIMF_KEYCODE_RIGHT_PARENTHESIS:
00605       case IIIMF_KEYCODE_UNDERSCORE:
00606        return 0;
00607 
00608       case IIIMF_KEYCODE_F13:
00609        return Qt::Key_F13;
00610       case IIIMF_KEYCODE_F14:
00611        return Qt::Key_F14;
00612       case IIIMF_KEYCODE_F15:
00613        return Qt::Key_F15;
00614       case IIIMF_KEYCODE_F16:
00615        return Qt::Key_F16;
00616       case IIIMF_KEYCODE_F17:
00617        return Qt::Key_F17;
00618       case IIIMF_KEYCODE_F18:
00619        return Qt::Key_F18;
00620       case IIIMF_KEYCODE_F19:
00621        return Qt::Key_F19;
00622       case IIIMF_KEYCODE_F20:
00623        return Qt::Key_F20;
00624       case IIIMF_KEYCODE_F21:
00625        return Qt::Key_F21;
00626       case IIIMF_KEYCODE_F22:
00627        return Qt::Key_F22;
00628       case IIIMF_KEYCODE_F23:
00629        return Qt::Key_F23;
00630       case IIIMF_KEYCODE_F24:
00631        return Qt::Key_F24;
00632 
00633       case IIIMF_KEYCODE_COMPOSE:
00634       case IIIMF_KEYCODE_ALT_GRAPH:
00635       case IIIMF_KEYCODE_STOP:
00636       case IIIMF_KEYCODE_AGAIN:
00637       case IIIMF_KEYCODE_PROPS:
00638       case IIIMF_KEYCODE_UNDO:
00639       case IIIMF_KEYCODE_COPY:
00640       case IIIMF_KEYCODE_PASTE:
00641       case IIIMF_KEYCODE_FIND:
00642       case IIIMF_KEYCODE_CUT:
00643        return 0;
00644     }
00645 
00646     return 0;
00647 }
00648 
00649 IIIMF_status
00650 convert_IIIMCF_keyevent_to_QKeyEvent(
00651     IIIMCF_keyevent *pkev,
00652     int pressp,
00653     QKeyEvent **pe
00654 )
00655 {
00656     int c, s;
00657 
00658     c = i2qcode(pkev->keycode);
00659 
00660     if (!c) return IIIMF_STATUS_FAIL;
00661 
00662     s = 0;
00663     if (pkev->modifier & IIIMF_SHIFT_MODIFIER) {
00664        s |= Qt::ShiftButton;
00665     }
00666     if (pkev->modifier & IIIMF_CONTROL_MODIFIER) {
00667        s |= Qt::ControlButton;
00668     }
00669     if (pkev->modifier & IIIMF_META_MODIFIER) {
00670        s |= Qt::MetaButton;
00671     }
00672     if (pkev->modifier & IIIMF_ALT_MODIFIER) {
00673        s |= Qt::AltButton;
00674     }
00675 
00676     if (pressp)
00677        *pe = new QKeyEvent(QEvent::KeyPress, c, pkev->keychar, s);
00678     else
00679        *pe = new QKeyEvent(QEvent::KeyRelease, c, pkev->keychar, s);
00680 
00681     return IIIMF_STATUS_SUCCESS;
00682 }
00683 
00684 /* Local Variables: */
00685 /* c-file-style: "iiim-project" */
00686 /* End: */