(config_command): Set NAME before using it.
[m17n/m17n-lib.git] / src / m17n.h
index 979ba43..4d267cb 100644 (file)
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the m17n library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    02111-1307, USA.  */
 
 #ifndef _M17N_H_
@@ -838,12 +838,25 @@ typedef struct MLocale MLocale;
 
 /*=*/
 
-extern MSymbol Mlanguage;
 extern MSymbol Miso639_1, Miso639_2;
 extern MSymbol Mterritory;
 extern MSymbol Mmodifier;
 extern MSymbol Mcodeset;
 
+extern MPlist *mlanguage_list (void);
+
+extern MSymbol mlanguage_code (MSymbol language, int len);
+
+extern MPlist *mlanguage_name_list (MSymbol language, MSymbol target);
+
+extern MText *mlanguage_text (MSymbol language);
+
+extern MPlist *mscript_list (void);
+
+extern MPlist *mscript_language_list (MSymbol script);
+
+extern MSymbol mlanguage_name (MSymbol language);
+
 extern MLocale *mlocale_set (int category, const char *locale);
 
 extern MSymbol mlocale_get_prop (MLocale *locale, MSymbol key);
@@ -1068,7 +1081,8 @@ typedef struct MInputDriver
       #Minput_preedit_done, #Minput_status_start, #Minput_status_draw,
       #Minput_status_done, #Minput_candidates_start,
       #Minput_candidates_draw, #Minput_candidates_done,
-      #Minput_set_spot, #Minput_toggle, #Minput_reset.
+      #Minput_set_spot, #Minput_toggle, #Minput_reset,
+      #Minput_get_surrounding_text, #Minput_delete_surrounding_text.
       Values are functions of type #MInputCallbackFunc.  */
   /***ja
       @brief ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î¥ê¥¹¥È.
@@ -1078,7 +1092,8 @@ typedef struct MInputDriver
       #Minput_preedit_done, #Minput_status_start, #Minput_status_draw,
       #Minput_status_done, #Minput_candidates_start,
       #Minput_candidates_draw, #Minput_candidates_done,
-      #Minput_set_spot, #Minput_toggle, #Minput_reset¡£ 
+      #Minput_set_spot, #Minput_toggle, #Minput_reset,
+      #Minput_get_surrounding_text, #Minput_delete_surrounding_text¡£
       ÃͤÏ#MInputCallbackFunc ·¿¤Î´Ø¿ô¡£  */
   MPlist *callback_list;
 
@@ -1104,6 +1119,18 @@ extern MSymbol Minput_candidates_done;
 extern MSymbol Minput_set_spot;
 extern MSymbol Minput_toggle;
 extern MSymbol Minput_reset;
+extern MSymbol Minput_get_surrounding_text;
+extern MSymbol Minput_delete_surrounding_text;
+
+/** Symbols for special input key event.  */
+extern MSymbol Minput_focus_move;
+extern MSymbol Minput_focus_in;
+extern MSymbol Minput_focus_out;
+
+/** Symbols describing input method command/variable.  */
+extern MSymbol Minherited;
+extern MSymbol Mcustomized;
+extern MSymbol Mconfigured;
 
 /***en
     @brief Structure of input method.
@@ -1147,6 +1174,23 @@ struct MInputMethod
 /*=*/
 
 /***en
+    @brief Bit-masks to specify how candidates of input method is changed.  */
+
+/***ja
+    @brief ÆþÎϥ᥽¥Ã¥É¤ÎÆþÎϸõÊ䤬¤É¤¦Êѹ¹¤µ¤ì¤¿¤«¤ò¼¨¤¹¥Ó¥Ã¥È¥Þ¥¹¥¯.  */
+
+enum MInputCandidatesChanged
+  {
+    MINPUT_CANDIDATES_LIST_CHANGED = 1,
+    MINPUT_CANDIDATES_INDEX_CHANGED = 2,
+    MINPUT_CANDIDATES_SHOW_CHANGED = 4,
+    MINPUT_CANDIDATES_CHANGED_MAX
+  };
+
+
+/*=*/
+
+/***en
     @brief Structure of input context.
 
     The type @c MInputContext is the structure of input context
@@ -1292,23 +1336,27 @@ struct MInputContext
       1 ¤Ë¡¢¤½¤ì°Ê³°¤Î»þ 0 ¤ËÀßÄꤹ¤ë¡£  */
   int candidate_show;
 
-  /***en The function <im>->driver.filter () sets the value to 1 when
-      it changed any of the above members (<candidate_XXX>), and sets
-      the value to 0 otherwise.  */
-  /***ja ´Ø¿ô <im>->driver.filter () ¤Ï¡¢¾åµ­¤Î¥á¥ó¥Ð <candidate_XXX> 
-      ¤Î£±¤Ä¤Ç¤âÊѹ¹¤·¤¿ºÝ¤Ë¤Ï¡¢¤³¤ÎÃͤò 1 ¤ËÀßÄꤹ¤ë¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤ËÀßÄꤹ¤ë¡£ */
+  /***en The function <im>->driver.filter () sets the value to bitwise
+      OR of @c enum @c MInputCandidatesChanged when it changed any of
+      the above members (<candidate_XXX>), and sets the value to 0
+      otherwise.  */
+  /***ja ´Ø¿ô <im>->driver.filter () ¤Ï¡¢¾åµ­¤Î¥á¥ó¥Ð <candidate_XXX>
+      ¤Î£±¤Ä¤Ç¤âÊѹ¹¤·¤¿ºÝ¤Ë¤Ï¡¢¤³¤ÎÃͤò @c enum @c
+      MInputCandidatesChanged ¤Î¥Ó¥Ã¥Èñ°Ì¤Ç¤ÎÏÀÍý OR ¤ËÀßÄꤹ¤ë¡£¤½¤¦
+      ¤Ç¤Ê¤±¤ì¤Ð 0 ¤ËÀßÄꤹ¤ë¡£ */
   int candidates_changed;
 
   /***en Plist that can be freely used by <im>->driver functions.
-      The driver of internal input method never use it.  The function
+      The driver of internal input method uses it to exchange extra
+      arguments and result for callback functions.  The function
       <im>->driver.create_ic () sets this to an empty plist, and the
       function <im>->driver.destroy_ic () frees it by using
       m17n_object_unref ().  */
   /***ja <im>->driver ¤Î´Ø¿ô·²¤Ë¤è¤Ã¤Æ¼«Í³¤Ë»ÈÍѤǤ­¤ë plist¡£
-      ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥɥ饤¥Ð¤Ï¤³¤ì¤ò»ÈÍѤ·¤Ê¤¤¡£´Ø¿ô 
-      <im>->driver.create_ic () ¤Ï¤³¤Î plist ¤ò¶õ¤ËÀßÄꤹ¤ë¡£´Ø¿ô
-      <im>->driver.destroy_ic () ¤Ï m17n_object_unref () ¤òÍѤ¤¤Æ¤³¤Î 
-      plist ¤ò²òÊü¤¹¤ë¡£  */
+      ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥɥ饤¥Ð¤Ï¤³¤ì¤ò¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤È¤Î°ú¿ô¤äÊÖÃÍ
+      ¤Î¼õÅϤ·¤Ë»ÈÍѤ¹¤ë¡£´Ø¿ô <im>->driver.create_ic () ¤Ï¤³¤Î plist
+      ¤ò¶õ¤ËÀßÄꤹ¤ë¡£´Ø¿ô<im>->driver.destroy_ic () ¤Ï
+      m17n_object_unref () ¤òÍѤ¤¤Æ¤³¤Î plist ¤ò²òÊü¤¹¤ë¡£  */
   MPlist *plist;
 };
 
@@ -1329,30 +1377,39 @@ extern int minput_filter (MInputContext *ic, MSymbol key, void *arg);
 
 extern int minput_lookup (MInputContext *ic, MSymbol key, void *arg,
                          MText *mt);
-
-extern void minput_set_spot (MInputContext *ic, int x, int y,
-                            int ascent, int descent, int fontsize,
-                            MText *mt, int pos);
-
+extern void minput_set_spot (MInputContext *ic, int x, int y, int ascent,
+                            int descent, int fontsize, MText *mt, int pos);
 extern void minput_toggle (MInputContext *ic);
 
 extern void minput_reset_ic (MInputContext *ic);
 
-extern MSymbol Mdetail_text;
-
 extern MText *minput_get_description (MSymbol language, MSymbol name);
 
+extern MPlist *minput_get_title_icon (MSymbol language, MSymbol name);
+
+extern MPlist *minput_get_command (MSymbol language, MSymbol name,
+                                  MSymbol command);
+extern int minput_config_command (MSymbol language, MSymbol name,
+                                 MSymbol command, MPlist *keyseq);
+extern MPlist *minput_get_variable (MSymbol language, MSymbol name,
+                                   MSymbol variable);
+extern int minput_config_variable (MSymbol language, MSymbol name,
+                                  MSymbol variable, MPlist *value);
+extern char *minput_config_file (void);
+
+extern int minput_save_config (void);
+
+extern int minput_callback (MInputContext *ic, MSymbol command);
+
+/* obsolete functions */
 extern MPlist *minput_get_commands (MSymbol language, MSymbol name);
 
 extern int minput_assign_command_keys (MSymbol language, MSymbol name,
                                       MSymbol command, MPlist *keys);
-
 extern MPlist *minput_get_variables (MSymbol language, MSymbol name);
 
 extern int minput_set_variable (MSymbol language, MSymbol name,
                                MSymbol variable, void *value);
-
-
 /*=*/
 /***     @} */