1 /** 2 * @file scim_imengine.h 3 * @brief Defines scim::IMEngineFactoryBase and scim::IMEngineInstanceBase interfaces. 4 * 5 * scim::IMEngineFactoryBase and scim::IMEngineInstanceBase are the most important 6 * part of SCIM platform. 7 * 8 * These interfaces are used to write input method engine modules. 9 */ 10 11 /* 12 * Smart Common Input Method 13 * 14 * Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn> 15 * 16 * 17 * This library is free software; you can redistribute it and/or 18 * modify it under the terms of the GNU Lesser General Public 19 * License as published by the Free Software Foundation; either 20 * version 2 of the License, or (at your option) any later version. 21 * 22 * This library is distributed in the hope that it will be useful, 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * GNU Lesser General Public License for more details. 26 * 27 * You should have received a copy of the GNU Lesser General Public 28 * License along with this program; if not, write to the 29 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 30 * Boston, MA 02111-1307 USA 31 * 32 * $Id: scim_imengine.h,v 1.19 2005/08/15 12:45:46 suzhe Exp $ 33 */ 34 35 #ifndef __SCIM_IMENGINE_H 36 #define __SCIM_IMENGINE_H 37 38 namespace scim { 39 /** 40 * @addtogroup IMEngine 41 * The base classes for input method engine modules. 42 * @{ 43 */ 44 45 /** 46 * @brief Enum values of all Client Capabilities bitmask. 47 * 48 * These capabilities are not always supported by all kinds of clients. 49 * So if an IMEngine requires some of them to realize some features, 50 * it should make sure that they are supported by client by checking the cap value 51 * sent by update_client_capabilities() action. 52 */ 53 enum ClientCapability 54 { 55 SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT = (1 << 0), /**< The client support OnTheSpot preedit (embed preedit string into client window) */ 56 SCIM_CLIENT_CAP_SINGLE_LEVEL_PROPERTY = (1 << 1), /**< The client support displaying single level property, property tree may not be supported*/ 57 SCIM_CLIENT_CAP_MULTI_LEVEL_PROPERTY = (1 << 2), /**< The client support displaying multiple level property, aka. property tree */ 58 SCIM_CLIENT_CAP_TRIGGER_PROPERTY = (1 << 3), /**< The client is capabile to trigger the IMEngine property. */ 59 SCIM_CLIENT_CAP_HELPER_MODULE = (1 << 4), /**< The client support helper module */ 60 SCIM_CLIENT_CAP_SURROUNDING_TEXT = (1 << 5), /**< The client support get/delete surrounding text operations */ 61 SCIM_CLIENT_CAP_ALL_CAPABILITIES = 0x3F 62 }; 63 64 /** 65 * @brief An exception class to hold IMEngine related errors. 66 * 67 * scim::IMEngineBase and its derived classes must throw 68 * scim::IMEngineError object when error. 69 */ 70 class IMEngineError: public Exception 71 { 72 public: IMEngineError(const String & what_arg)73 IMEngineError (const String& what_arg) 74 : Exception (String("scim::IMEngine: ") + what_arg) { } 75 }; 76 77 class IMEngineFactoryBase; 78 class IMEngineInstanceBase; 79 80 /** 81 * @typedef typedef Pointer <IMEngineFactoryBase> IMEngineFactoryPointer; 82 * 83 * A smart pointer for scim::IMEngineFactoryBase and its derived classes. 84 */ 85 typedef Pointer <IMEngineFactoryBase> IMEngineFactoryPointer; 86 87 /** 88 * @typedef typedef Pointer <IMEngineInstanceBase> IMEngineInstancePointer; 89 * 90 * A smart pointer for scim::IMEngineInstanceBase and its derived classes. 91 */ 92 typedef Pointer <IMEngineInstanceBase> IMEngineInstancePointer; 93 94 typedef Slot1<void, IMEngineInstanceBase*> 95 IMEngineSlotVoid; 96 97 typedef Slot2<void, IMEngineInstanceBase*,int> 98 IMEngineSlotInt; 99 100 typedef Slot2<void, IMEngineInstanceBase*,bool> 101 IMEngineSlotBool; 102 103 typedef Slot2<void, IMEngineInstanceBase*,const String&> 104 IMEngineSlotString; 105 106 typedef Slot2<void, IMEngineInstanceBase*,const WideString&> 107 IMEngineSlotWideString; 108 109 typedef Slot2<void, IMEngineInstanceBase*,const KeyEvent&> 110 IMEngineSlotKeyEvent; 111 112 typedef Slot2<void, IMEngineInstanceBase*,const LookupTable&> 113 IMEngineSlotLookupTable; 114 115 typedef Slot2<void, IMEngineInstanceBase*,const Property&> 116 IMEngineSlotProperty; 117 118 typedef Slot2<void, IMEngineInstanceBase*,const PropertyList&> 119 IMEngineSlotPropertyList; 120 121 typedef Slot3<void, IMEngineInstanceBase*,const String&,const Transaction&> 122 IMEngineSlotStringTransaction; 123 124 typedef Slot3<void, IMEngineInstanceBase*,const WideString&,const AttributeList&> 125 IMEngineSlotWideStringAttributeList; 126 127 typedef Slot5<bool, IMEngineInstanceBase*,WideString&,int&,int,int> 128 IMEngineSlotGetSurroundingText; 129 130 typedef Slot3<bool, IMEngineInstanceBase*,int,int> 131 IMEngineSlotDeleteSurroundingText; 132 133 /** 134 * @brief The base class of the real input methods' IMEngineFactory classes. 135 * 136 * Each input method should implement a class derived from scim::IMEngineFactoryBase, 137 * which takes charge of holding shared data, creating IMEngineInstances etc. 138 */ 139 class IMEngineFactoryBase : public ReferencedObject 140 { 141 class IMEngineFactoryBaseImpl; 142 143 IMEngineFactoryBaseImpl *m_impl; 144 145 public: 146 IMEngineFactoryBase (); 147 148 /** 149 * @brief Virtual destructor. 150 */ 151 virtual ~IMEngineFactoryBase (); 152 153 /** 154 * @name Pure virtual members. 155 * 156 * These member functions must be implemented in derived classes. 157 * 158 * @{ 159 */ 160 161 /** 162 * @brief Get the name of this input method engine. 163 * 164 * This name should be a localized string. 165 * 166 * @return A WideString containing the name. 167 */ 168 virtual WideString get_name () const = 0; 169 170 /** 171 * @brief Get the UUID of this input method engine. 172 * 173 * Each input method engine has an unique UUID to 174 * distinguish itself from other engines. 175 * 176 * You may use uuidgen command shipped with e2fsprogs package to generate this UUID. 177 * 178 * @return A String containing an unique UUID. 179 */ 180 virtual String get_uuid () const = 0; 181 182 /** 183 * @brief Get the icon file path of this input method engine. 184 * 185 * @return A String containing the icon file path on the local filesystem. 186 */ 187 virtual String get_icon_file () const = 0; 188 189 /** 190 * @brief Get the authors information of this input method engine. 191 * 192 * This string should be a localized string. 193 * 194 * @return A WideString containing a list of the authors' name. 195 */ 196 virtual WideString get_authors () const = 0; 197 198 /** 199 * @brief Get the credits information of this input method engine. 200 * 201 * This string should be a localized string. 202 * 203 * @return A WideString containing the credits information. 204 */ 205 virtual WideString get_credits () const = 0; 206 207 /** 208 * @brief Get the help information of this input method engine. 209 * 210 * This string should be a localized string. 211 * 212 * @return A WideString containing the help information. 213 */ 214 virtual WideString get_help () const = 0; 215 216 /** 217 * @brief Create a new IMEngineInstance object. 218 * 219 * This method creates a new scim::IMEngineInstanceBase object with the given encoding and id. 220 * 221 * @param encoding - the encoding supported by the client. 222 * @param id - the instance id, should be unique. 223 * @return A smart pointer points to this new IMEngineInstance object. 224 */ 225 virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1) = 0; 226 /** 227 * @} 228 */ 229 230 /** 231 * @brief Check if an encoding is supported by this IMEngineFactory. 232 * 233 * The default implementation of this virtual function validates the 234 * encoding against the locale list set by method set_locales. 235 * 236 * It should be enough in most case. 237 * 238 * @param encoding - the encoding name to be checked. 239 * @return true if the encoding is supported, otherwise false. 240 */ 241 virtual bool validate_encoding (const String& encoding) const; 242 243 /** 244 * @brief Check if a locale is supported by this IMEngineFactory. 245 * 246 * The default implementation of this virtual function validates the 247 * locale against the locale list set by method set_locales. 248 * 249 * It should be enough in most case. 250 * 251 * @param locale - the locale name to be checked. 252 * @return true if the locale is supported, otherwise false. 253 */ 254 virtual bool validate_locale (const String& locale) const; 255 256 /** 257 * @brief Get the supported language of this input method engine. 258 * 259 * The language name conforms to glibc locale naming standard, like: 260 * zh_CN Simplified Chinese 261 * zh_TW Traditional Chinese 262 * ja_JP Japanese 263 * ru_RU for Russian 264 * 265 * The second part of the name (territory id) can be omitted. 266 * 267 * The default implementation of this method will get the language name 268 * according to the return value of get_default_locale () method. 269 * 270 * This method maybe overwrited to return another language name, 271 * for example returning "~other" means other uncategorized languages. 272 */ 273 virtual String get_language () const; 274 275 /** 276 * @brief Get the original key string of a composed string. 277 * 278 * For example, in the pinyin input method of Simplified Chinese: 279 * the key string of composed string "中国" can be "zhongguo". 280 * 281 * The default implementation just returns a empty string. 282 * 283 * @param str The composed string to be queried. 284 * 285 * @return the original key string of the given composed string. 286 */ 287 virtual WideString inverse_query (const WideString &str); 288 289 /** 290 * @brief Get the default locale of this input method engine. 291 * 292 * The default locale is the first locale in the locale list, 293 * which is set by method set_locales. 294 * 295 * @return The default locale name. 296 */ 297 String get_default_locale () const; 298 299 /** 300 * @brief Get the default encoding of this input method engine. 301 * 302 * The default encoding is the first locale's encoding in the locale list, 303 * which is set by method set_locales. 304 * 305 * @return The default encoding name. 306 */ 307 String get_default_encoding () const; 308 309 /** 310 * @brief Get a list of all supported locales, separated by comma. 311 * 312 * @return A comma separated locale list. 313 */ 314 String get_locales () const; 315 316 /** 317 * @brief Get a list of all supported encodings, separated by comma. 318 * 319 * @return A comma separated encoding list. 320 */ 321 String get_encodings () const; 322 323 protected: 324 /** 325 * @brief Set the locales supported by this input method engine. 326 * 327 * This method should be called within the constructors of the derived classes. 328 * 329 * set_locales () and set_languages () are exclusive with each other. Only one 330 * method should be used for one Factory object. 331 * 332 * @param locales - a comma separated list containing all valid locales 333 * should be supported by this input method engine. 334 * The first locale is the default one. 335 */ 336 void set_locales (const String &locales); 337 338 /** 339 * @brief Set the languages supported by this input method engine. 340 * 341 * This method should be called within the constructors of the derived classes. 342 * 343 * set_locales () and set_languages () are exclusive with each other. Only one 344 * method should be used for one Factory object. 345 * 346 * @param languages - a comma separated list containing all valid languages 347 * should be supported by this input method engine. 348 * The first language is the default one. 349 */ 350 void set_languages (const String &languages); 351 }; 352 353 /** 354 * @brief The base class of the real input methods' IMEngineInstance classes. 355 * 356 * Each input method should implement a class derived from scim::IMEngineInstanceBase, 357 * which takes charge of recording Input Context status and processing user input events. 358 */ 359 class IMEngineInstanceBase : public ReferencedObject 360 { 361 class IMEngineInstanceBaseImpl; 362 363 IMEngineInstanceBaseImpl *m_impl; 364 365 public: 366 /** 367 * @brief Constructor. 368 * 369 * @param factory - the factory which creates this instance. 370 * @param encoding - the working encoding. 371 * @param id - the unique id of this instance. 372 */ 373 IMEngineInstanceBase (IMEngineFactoryBase *factory, 374 const String &encoding, 375 int id = -1); 376 377 /** 378 * @brief Virtual destructor. 379 */ 380 virtual ~IMEngineInstanceBase (); 381 382 /** 383 * @brief Set the working encoding for this instance. 384 * 385 * One engine instance can only support one client encoding at the same time. 386 * This encoding must be supported by the IMEngineFactory as well. 387 * 388 * This method could be overrided in derived class to do some extra job. But 389 * the method of this base class must be invoked within the new method. 390 * 391 * After invoking this method, reset() should be invoked to 392 * let the new encoding take effect. 393 * 394 * @return true if the encoding is supported, otherwise false. 395 */ 396 virtual bool set_encoding (const String &encoding); 397 398 /** 399 * @brief Get the working encoding of this instance. 400 * 401 * This method returns the encoding passed to the 402 * constructor when constructing this object. 403 * 404 * @return The working encoding. 405 */ 406 String get_encoding () const; 407 408 /** 409 * @brief Get the unique id of this instance. 410 * 411 * @return The id of this instance. 412 */ 413 int get_id () const; 414 415 /** 416 * @brief Get the UUID of the engine factory. 417 * 418 * @return The UUID string of the engine factory. 419 */ 420 String get_factory_uuid () const; 421 422 /** 423 * @brief Attach a pointer to this IMEngineInstance, which is pointed to corresponding FrontEnd data. 424 * 425 * @param data The pointer to corresponding FrontEnd data, eg. input context object. 426 */ 427 void set_frontend_data (void *data); 428 429 /** 430 * @brief Retrieve the pointer previously attached by set_frontend_data(); 431 * 432 * @return The pointer previously attached by set_frontend_data(); 433 */ 434 void * get_frontend_data (void); 435 436 public: 437 /** 438 * @name Signal connection functions. 439 * 440 * These functions are used by FrontEnds to connect their corresponding slots to 441 * this IMEngineInstance's signals. 442 * 443 * @{ 444 */ 445 Connection signal_connect_show_preedit_string (IMEngineSlotVoid *slot); 446 Connection signal_connect_show_aux_string (IMEngineSlotVoid *slot); 447 Connection signal_connect_show_lookup_table (IMEngineSlotVoid *slot); 448 Connection signal_connect_hide_preedit_string (IMEngineSlotVoid *slot); 449 Connection signal_connect_hide_aux_string (IMEngineSlotVoid *slot); 450 Connection signal_connect_hide_lookup_table (IMEngineSlotVoid *slot); 451 Connection signal_connect_update_preedit_caret (IMEngineSlotInt *slot); 452 Connection signal_connect_update_preedit_string (IMEngineSlotWideStringAttributeList *slot); 453 Connection signal_connect_update_aux_string (IMEngineSlotWideStringAttributeList *slot); 454 Connection signal_connect_update_lookup_table (IMEngineSlotLookupTable *slot); 455 Connection signal_connect_commit_string (IMEngineSlotWideString *slot); 456 Connection signal_connect_forward_key_event (IMEngineSlotKeyEvent *slot); 457 Connection signal_connect_register_properties (IMEngineSlotPropertyList *slot); 458 Connection signal_connect_update_property (IMEngineSlotProperty *slot); 459 Connection signal_connect_beep (IMEngineSlotVoid *slot); 460 Connection signal_connect_start_helper (IMEngineSlotString *slot); 461 Connection signal_connect_stop_helper (IMEngineSlotString *slot); 462 Connection signal_connect_send_helper_event (IMEngineSlotStringTransaction *slot); 463 464 Connection signal_connect_get_surrounding_text (IMEngineSlotGetSurroundingText *slot); 465 Connection signal_connect_delete_surrounding_text (IMEngineSlotDeleteSurroundingText *slot); 466 /** @} */ 467 468 public: 469 /** 470 * @name Action functions. 471 * 472 * These functions will be called by FrontEnds to send events to 473 * this IMEngineInstance. 474 * 475 * @{ 476 */ 477 478 /** 479 * @brief Process a key event. 480 * 481 * @param key - the key event to be processed. 482 * @return true if the event is processed, otherwise the event 483 * is not processed and should be forward to client application. 484 */ 485 virtual bool process_key_event (const KeyEvent &key) = 0; 486 487 /** 488 * @brief Move the preedit caret in the preedit string. 489 * 490 * @param pos - the new position that user requested. 491 */ 492 virtual void move_preedit_caret (unsigned int pos); 493 494 /** 495 * @brief Select a candidate in current lookup table. 496 * 497 * When user click a candidate directly, 498 * this method will be invoked by FrontEnd. 499 * 500 * @param index - the index in current page of the selected candidate. 501 */ 502 virtual void select_candidate (unsigned int index); 503 504 /** 505 * @brief Update the page size of current lookup table. 506 * 507 * In the next time, the lookup table should page down by 508 * this size. 509 * 510 * @param page_size - the new size of current page. 511 */ 512 virtual void update_lookup_table_page_size (unsigned int page_size); 513 514 /** 515 * @brief Flip the lookup table to the previous page. 516 * 517 * The method will be invoked by FrontEnd when user click 518 * the lookup table page up button. 519 */ 520 virtual void lookup_table_page_up (); 521 522 /** 523 * @brief Flip the lookup table to the next page. 524 * 525 * The method will be invoked by FrontEnd when user click 526 * the lookup table page down button. 527 */ 528 virtual void lookup_table_page_down (); 529 530 /** 531 * @brief Reset this engine instance. 532 * 533 * All status of this engine instance should be reset, 534 * including the working encoding. 535 * 536 * The client encoding may have been changed before calling 537 * this method, so if the IMEngine makes use of the client's encoding 538 * information, it should check whether the encoding has been changed. 539 * IMEngineInstance could call the get_encoding () method of base class 540 * to get the client encoding. 541 */ 542 virtual void reset (); 543 544 /** 545 * @brief Focus in this engine instance. 546 * 547 * This function should update/show/hide the status area, 548 * preedit area and lookup table, and update the 549 * full width punctuation/letter state. 550 */ 551 virtual void focus_in (); 552 553 /** 554 * @brief Focus out this engine instance. 555 */ 556 virtual void focus_out (); 557 558 /** 559 * @brief Trigger a property. 560 * 561 * This function should do some action according 562 * to the triggered property. 563 * For example toggle the input mode, etc. 564 * 565 * @param property the key of the triggered property. 566 */ 567 virtual void trigger_property (const String &property); 568 569 /** 570 * @brief Process the events sent from a Client Helper process. 571 * 572 * @param helper_uuid The UUID of the Helper process which sent the events. 573 * @param trans The transaction which contains the events. 574 */ 575 virtual void process_helper_event (const String &helper_uuid, const Transaction &trans); 576 577 /** 578 * @brief Update the capabilities of current client application which is attached to this IMEngineInstance. 579 * 580 * Some client may not support all capabilities provided by the IMEngine API. For example: 581 * 582 * - OnTheSpot preedit string display (Embedded into client window). 583 * - Property display 584 * - Helper module 585 * - etc. 586 * 587 * This method will be called to inform this IMEngineInstance object which capabilities are supported by the 588 * client application. It may be called multiple times, if the capabilities was changed. 589 * 590 * @param cap A bitmask to indicate which client capabilities are supported by the client application. 591 * 592 * @sa scim::ClientCapability 593 */ 594 virtual void update_client_capabilities (unsigned int cap); 595 /** @} */ 596 597 protected: 598 /** 599 * @name Signal activation functions 600 * 601 * These functions should be called by derived classes 602 * to fire the corresponding signals. The FrontEnd 603 * connected to those signals will receive and process them. 604 * 605 * @{ 606 */ 607 608 /** 609 * @brief Show the preedit string area. 610 * 611 * The preedit string should be updated by calling 612 * update_preedit_string before or right after this call. 613 */ 614 void show_preedit_string (); 615 616 /** 617 * @brief Show the aux string area. 618 * 619 * The aux string should be updated by calling 620 * update_aux_string before or right after this call. 621 * 622 * The aux string can contain any additional information whatever 623 * the input method engine want. 624 */ 625 void show_aux_string (); 626 627 /** 628 * @brief Show the lookup table area. 629 * 630 * The lookup table should be updated by calling 631 * update_lookup_table before or right after this call. 632 */ 633 void show_lookup_table (); 634 635 /** 636 * @brief Hide the preedit string area. 637 */ 638 void hide_preedit_string (); 639 640 /** 641 * @brief Hide the aux string area. 642 */ 643 void hide_aux_string (); 644 645 /** 646 * @brief Hide the lookup table area. 647 */ 648 void hide_lookup_table (); 649 650 /** 651 * @brief Update the preedit caret position in the preedit string. 652 * 653 * @param caret - the new position of the preedit caret. 654 */ 655 void update_preedit_caret (int caret); 656 657 /** 658 * @brief Update the content of the preedit string, 659 * 660 * @param str - the string content 661 * @param attrs - the string attributes 662 */ 663 void update_preedit_string (const WideString &str, 664 const AttributeList &attrs = AttributeList ()); 665 666 /** 667 * @brief Update the content of the aux string, 668 * 669 * @param str - the string content 670 * @param attrs - the string attribute 671 */ 672 void update_aux_string (const WideString &str, 673 const AttributeList &attrs = AttributeList ()); 674 675 /** 676 * @brief Update the content of the lookup table, 677 * 678 * FrontEnd may reduce the page size of the table 679 * according to screen resolution. If the page size 680 * is changed, FrontEnd will inform this engine instance 681 * by calling update_lookup_table_page_size method. 682 * 683 * @param table - the new LookupTable 684 */ 685 void update_lookup_table (const LookupTable &table); 686 687 /** 688 * @brief Commit a string to the client application. 689 * 690 * The preedit string should be hid before calling 691 * this method. Otherwise the clients which use 692 * OnTheSpot input mode will flicker annoyingly. 693 * 694 * @param str - the string to be committed. 695 */ 696 void commit_string (const WideString &str); 697 698 /** 699 * @brief Forward a key event to the client application. 700 * 701 * @param key - the key event to be forwarded. 702 */ 703 void forward_key_event (const KeyEvent &key); 704 705 /** 706 * @brief Register all properties of this IMEngineInstance into the FrontEnd. 707 * 708 * The old properties previously registered by other IMEngineInstance will be discarded, 709 * so for each time focus_in() is called, all properties should be registered 710 * no matter whether they had been registered before. 711 * 712 * @param properties the PropertyList contains all of the properties. 713 */ 714 void register_properties (const PropertyList &properties); 715 716 /** 717 * @brief Update a registered property. 718 * 719 * Update a property which already registered by register_properties () method. 720 * 721 * @param property the property to be updated. 722 */ 723 void update_property (const Property &property); 724 725 /** 726 * @brief Generate a short beep. 727 */ 728 void beep (); 729 730 /** 731 * @brief Start a Client Helper process. 732 * 733 * @param helper_uuid The UUID of the Helper object. 734 */ 735 void start_helper (const String &helper_uuid); 736 737 /** 738 * @brief Stop a Client Helper process which was started by start_helper. 739 * 740 * @param helper_uuid The UUID of the Helper object. 741 */ 742 void stop_helper (const String &helper_uuid); 743 744 /** 745 * @brief Send an events transaction to a client helper process. 746 * 747 * @param helper_uuid The UUID of the Helper object. 748 * @param trans The transaction which contains events. 749 */ 750 void send_helper_event (const String &helper_uuid, const Transaction &trans); 751 752 /** 753 * @brief Retrieves context around the insertion point. 754 * 755 * Input methods typically want context in order to constrain 756 * input text based on existing text; 757 * this is important for languages such as Thai where 758 * only some sequences of characters are allowed. 759 * 760 * Unlike other signal activation actions, this action will return the result 761 * immediately. 762 * 763 * @param text location to store the context string around the insertion point. 764 * @param cursor location to store index of the insertion cursor within @text. 765 * @param maxlen_before the maxmium length of context string to be retrieved 766 * before the cursor; -1 means unlimited. 767 * @param maxlen_after the maxmium length of context string to be retrieved 768 * after the cursor; -1 means unlimited. 769 * 770 * @return true if surrounding text was provided. 771 */ 772 bool get_surrounding_text (WideString &text, int &cursor, int maxlen_before = -1, int maxlen_after = -1); 773 774 /** 775 * @brief Ask the client to delete characters around the cursor position. 776 * 777 * In order to use this function, you should first call 778 * get_surrounding_text () to get the current context, and 779 * call this function immediately afterwards to make sure that you 780 * know what you are deleting. You should also account for the fact 781 * that even if the signal was handled, the input context might not 782 * have deleted all the characters that were requested to be deleted. 783 * 784 * @param offset offset from cursor position in chars; 785 * a negative value means start before the cursor. 786 * @param len number of characters to delete. 787 * 788 * @return true if the signal was handled. 789 */ 790 bool delete_surrounding_text (int offset, int len); 791 /** @} */ 792 }; 793 794 /** 795 * @brief A trivial IMEngine that do nothing. 796 */ 797 class DummyIMEngineFactory : public IMEngineFactoryBase 798 { 799 public: 800 DummyIMEngineFactory (); 801 virtual ~DummyIMEngineFactory (); 802 803 virtual WideString get_name () const; 804 virtual String get_uuid () const; 805 virtual String get_icon_file () const; 806 virtual WideString get_authors () const; 807 virtual WideString get_credits () const; 808 virtual WideString get_help () const; 809 810 virtual bool validate_encoding (const String& encoding) const; 811 virtual bool validate_locale (const String& locale) const; 812 813 virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1); 814 }; 815 816 class DummyIMEngineInstance : public IMEngineInstanceBase 817 { 818 public: 819 DummyIMEngineInstance (DummyIMEngineFactory *factory, 820 const String &encoding, 821 int id = -1); 822 823 virtual ~DummyIMEngineInstance (); 824 825 virtual bool process_key_event (const KeyEvent& key); 826 virtual void focus_in (); 827 }; 828 829 /** @} */ 830 831 } // namespace scim 832 833 #endif //__SCIM_IMENGINE_H 834 835 /* 836 vi:ts=4:nowrap:ai:expandtab 837 */ 838 839