Modified:
trunk/imbus/src/im_event_types.h
trunk/imbus/src/im_key_mappings.h
trunk/imbus/src/im_lookup_table.c
trunk/imbus/src/im_lookup_table.h
Log:
Add two orientation definitions to IMLookupTable.
Modified: trunk/imbus/src/im_event_types.h
==============================================================================
--- trunk/imbus/src/im_event_types.h (original)
+++ trunk/imbus/src/im_event_types.h Mon Nov 12 08:59:52 2007
@@ -1189,40 +1189,6 @@
*/
IM_EVENT_UPDATE_LOOKUP_TABLE,
-
- /**
- * Asks an UI component to show a list of components, so that user
- * can activate one of the components.
- *
- * An event with this type shall be sent to IMBUS, if a component
- * wants to let an UI component to show a list of components
according to
- * a specified IMEventRoles object or
- *
- * Only the focused input context can show or hide lookup table,
and only
- * one lookup table can be shown for an input context. Additional lookup
- * tables can be attached to candidates of the main lookup table as
- * annotations, and shown by UI component automatically.
- *
- * Possible producer: input method components
- * Possible consumer: UI or application components
- * Possible observer: any components
- *
- * Can broadcast: No.
- *
- * Source ID: ID of the input method component, which sends this event
- * Dest ID: IM_EVENT_DEST_DEFAULT shall be used.
- * ICID: ID of the input context, which wants to update
lookup table.
- *
- * Data:
- * - IMLookupTable
- * New lookup table to be shown. If it's omitted, an empty lookup
- * table will be shown.
- *
- * Has reply event: No
- */
- IM_EVENT_SHOW_COMPONENTS_LIST,
-
-
/**
* Asks an application component to commit a text to a specified input
* context.
@@ -1360,6 +1326,39 @@
/**
+ * Asks an UI component to show a list of components, so that user
+ * can activate one of the components.
+ *
+ * An event with this type shall be sent to IMBUS, if a component
+ * wants to let an UI component to show a list of components
according to
+ * a specified IMEventRoles object or a list of component IDs.
+ *
+ * Upon receving this event, the UI component shall query the information
+ * of the components to be listed from IMBUS and then show the
list on
+ * screen.
+ * When user select a component from the list, the UI component
shall send
+ * a IM_EVENT_SET_ACTIVE_COMPONENT event to IMBUS with the event roles
+ * supported by the component.
+ *
+ * Possible producer: any components
+ * Possible consumer: UI or application components
+ * Possible observer: any components
+ *
+ * Can broadcast: No.
+ *
+ * Source ID: ID of the component, which sends this event
+ * Dest ID: IM_EVENT_DEST_DEFAULT, or id of a specified UI component.
+ * ICID: IM_EVENT_INPUT_CONTEXT_NONE shall be used.
+ *
+ * Data:
+ *
+ * Has reply event: No
+ */
+ IM_EVENT_SHOW_COMPONENTS_LIST,
+
+
+
+ /**
* Stores one or more arbitrary data into a storage component.
*
* An event with this type shall be sent to IMBUS, if a component
wants to
@@ -1384,6 +1383,7 @@
* old data associated to this key will be erased.
* Only alphabets, digitals, underscore, minus and slash can be
used in a
* key. The key is case sensitive.
+ * - Arbitrary data to be stored.
*
* Has reply event: No
*/
Modified: trunk/imbus/src/im_key_mappings.h
==============================================================================
--- trunk/imbus/src/im_key_mappings.h (original)
+++ trunk/imbus/src/im_key_mappings.h Mon Nov 12 08:59:52 2007
@@ -1634,7 +1634,6 @@
{ 0x11ffed, 0xffed }, /** Hyper_L **/
{ 0x11ffee, 0xffee }, /** Hyper_R **/
{ 0x11ffff, 0xffff }, /** Delete **/
-
};
static IMKeyCodeX11keysymPair im_x11keysym_to_key_code_map [] =
@@ -3254,7 +3253,6 @@
{ 0x2245, 0x1002248 }, /** approxeq **/
{ 0x2262, 0x1002262 }, /** notidentical **/
{ 0x2263, 0x1002263 }, /** stricteq **/
-
};
static IMKeyNameCodePair im_key_name_to_code_map [] =
@@ -4874,7 +4872,6 @@
{ "zerosubscript" , 0x2080 }, /** X11 keysym =
0x1002080 **/
{ "zerosuperior" , 0x2070 }, /** X11 keysym =
0x1002070 **/
{ "zstroke" , 0x01b6 }, /** X11 keysym =
0x10001b6 **/
-
};
static IMKeyNameCodePair im_key_code_to_name_map [] =
Modified: trunk/imbus/src/im_lookup_table.c
==============================================================================
--- trunk/imbus/src/im_lookup_table.c (original)
+++ trunk/imbus/src/im_lookup_table.c Mon Nov 12 08:59:52 2007
@@ -9,9 +9,6 @@
#include "im_string.h"
#include "im_lookup_table.h"
-#define LOOKUP_TABLE_VERTICAL_FLAG 0x8000
-#define LOOKUP_TABLE_PUBLIC_FLAGS_MASK 0x7FFF
-
/************************** Declaration of internal functions ***************/
static void __im_candidate_initialize (IMPointer candidate);
static void __im_candidate_finalize (IMPointer candidate);
@@ -55,12 +52,13 @@
/* private */
IMUInt32 uid;
- IMUInt32 flags;
IMUInt32 cols;
IMUInt32 rows;
IMUInt32 cursor;
IMUInt32 num_pages;
IMUInt32 cur_page;
+ IMUInt16 flags;
+ IMUInt16 orientation;
IMText *title;
@@ -256,14 +254,15 @@
__im_lookup_table_initialize (IMPointer table)
{
((IMLookupTable*)table)->uid = 0;
- ((IMLookupTable*)table)->flags =
IM_LOOKUP_TABLE_SHOW_CURSOR |
- IM_LOOKUP_TABLE_SHOW_PAGE_FLIP_BUTTONS;
((IMLookupTable*)table)->cols = 10;
((IMLookupTable*)table)->rows = 1;
((IMLookupTable*)table)->cursor = 0;
((IMLookupTable*)table)->num_pages = 1;
((IMLookupTable*)table)->cur_page = 0;
((IMLookupTable*)table)->title = 0;
+ ((IMLookupTable*)table)->flags =
IM_LOOKUP_TABLE_SHOW_CURSOR |
+ IM_LOOKUP_TABLE_SHOW_PAGE_FLIP_BUTTONS;
+ ((IMLookupTable*)table)->orientation = IM_LOOKUP_TABLE_LTRTTB;
((IMLookupTable*)table)->candidates = im_ptr_array_new ();
}
@@ -301,12 +300,13 @@
im_lookup_table_clear (dest);
dtp->uid = stp->uid;
- dtp->flags = stp->flags;
dtp->cols = stp->cols;
dtp->rows = stp->rows;
dtp->cursor = stp->cursor;
dtp->num_pages = stp->num_pages;
dtp->cur_page = stp->cur_page;
+ dtp->flags = stp->flags;
+ dtp->orientation = stp->orientation;
/* copy title */
if (stp->title)
@@ -345,14 +345,14 @@
size = tp->cols * tp->rows;
- buf [0] = tp->uid;
- buf [1] = tp->flags;
- buf [2] = tp->cols;
- buf [3] = tp->rows;
- buf [4] = tp->cursor;
- buf [5] = tp->num_pages;
- buf [6] = tp->cur_page;
- buf [7] = IM_MIN (im_ptr_array_size (tp->candidates), size);
+ buf[0] = tp->uid;
+ buf[1] = tp->cols;
+ buf[2] = tp->rows;
+ buf[3] = tp->cursor;
+ buf[4] = tp->num_pages;
+ buf[5] = tp->cur_page;
+ buf[6] = ((IMUInt32)tp->flags) | (((IMUInt32)tp->orientation) << 16);
+ buf[7] = IM_MIN (im_ptr_array_size (tp->candidates), size);
if (!im_stream_put_uint32_array (sp, buf, 8))
return FALSE;
@@ -409,13 +409,14 @@
im_lookup_table_clear (tp);
- tp->uid = buf [0];
- tp->flags = buf [1];
- tp->cols = buf [2];
- tp->rows = buf [3];
- tp->cursor = buf [4];
- tp->num_pages = buf [5];
- tp->cur_page = buf [6];
+ tp->uid = buf[0];
+ tp->cols = buf[1];
+ tp->rows = buf[2];
+ tp->cursor = buf[3];
+ tp->num_pages = buf[4];
+ tp->cur_page = buf[5];
+ tp->flags = buf[6] & 0xffff;
+ tp->orientation = (buf[6] >> 16);
/* load title */
if (type == IM_TYPE_TEXT) {
@@ -466,7 +467,7 @@
void
__im_type_register_lookup_table ()
{
- static IMTypeInfo im_candidate_type_info =
+ static IMTypeInfo im_candidate_type_info =
{
sizeof (IMCandidateClass), /**< class_size >**/
__im_candidate_class_init, /**< class_init >**/
@@ -477,7 +478,7 @@
__im_candidate_finalize, /**< instance_finalize >**/
};
- static IMTypeInfo im_lookup_table_type_info =
+ static IMTypeInfo im_lookup_table_type_info =
{
sizeof (IMLookupTableClass), /**< class_size >**/
__im_lookup_table_class_init, /**< class_init >**/
@@ -652,11 +653,7 @@
t->uid = uid;
t->flags = flags;
-
- if (orientation == IM_LOOKUP_TABLE_VERTICAL)
- t->flags |= LOOKUP_TABLE_VERTICAL_FLAG;
- else
- t->flags &= ~LOOKUP_TABLE_VERTICAL_FLAG;
+ t->orientation = orientation;
if (cols == 0)
cols = 1;
@@ -714,21 +711,13 @@
im_lookup_table_set_orientation (IMLookupTable *table, IMUInt orientation)
{
_im_return_if_fail (IM_IS_LOOKUP_TABLE(table));
-
- if (orientation == IM_LOOKUP_TABLE_VERTICAL)
- table->flags |= LOOKUP_TABLE_VERTICAL_FLAG;
- else
- table->flags &= ~LOOKUP_TABLE_VERTICAL_FLAG;
+ table->flags = orientation;
}
IMUInt
im_lookup_table_get_orientation (const IMLookupTable *table)
{
- _im_return_val_if_fail (IM_IS_LOOKUP_TABLE(table), IM_LOOKUP_TABLE_HORIZONTAL);
-
- if (table->flags & LOOKUP_TABLE_VERTICAL_FLAG)
- return IM_LOOKUP_TABLE_VERTICAL;
-
- return IM_LOOKUP_TABLE_HORIZONTAL;
+ _im_return_val_if_fail (IM_IS_LOOKUP_TABLE(table), IM_LOOKUP_TABLE_LTRTTB);
+ return table->orientation;
}
void
im_lookup_table_set_page_size (IMLookupTable *table, IMUInt cols,
IMUInt rows)
@@ -801,14 +790,14 @@
{
_im_return_if_fail (IM_IS_LOOKUP_TABLE(table));
- table->flags |= (flags & LOOKUP_TABLE_PUBLIC_FLAGS_MASK);
+ table->flags |= flags;
}
void
im_lookup_table_disable_flags (IMLookupTable *table, IMUInt flags)
{
_im_return_if_fail (IM_IS_LOOKUP_TABLE(table));
- table->flags &= ~(flags & LOOKUP_TABLE_PUBLIC_FLAGS_MASK);
+ table->flags &= ~flags;
}
IMBool
im_lookup_table_check_flags (const IMLookupTable *table, IMUInt flags)
Modified: trunk/imbus/src/im_lookup_table.h
==============================================================================
--- trunk/imbus/src/im_lookup_table.h (original)
+++ trunk/imbus/src/im_lookup_table.h Mon Nov 12 08:59:52 2007
@@ -24,11 +24,11 @@
* A text label to indicate the candidate on lookup table.
* - Content \n
* type: IMText \n
- * Content of the candidate on lookup table. If the content is
empty, UIC may
+ * Content of the candidate on lookup table. If the content is
empty, UIC may
* refuse to render the this item, it depends on the UIC implementation.
* - Icon \n
* type: IMString \n
- * The identifier (usually a path name) of an icon that UIC may display
+ * The identifier (usually a path name) of an icon that UIC may display
* along with the candidate content.
* - Annotation \n
* type: IMObject \n
@@ -39,7 +39,7 @@
* Default GUI component may only recognize and handle IMText or IMLookupTable
* annotations.
*
- * These data members can only be accessed by setter and getter
interfaces of
+ * These data members can only be accessed by setter and getter
interfaces of
* IMCandidate object. The default values of these data members are null.
*/
@@ -141,14 +141,20 @@
/**
* @enum IMLookupTableOrientation
* @brief Layout orientation of a lookup table.
- * - IM_LOOKUP_TABLE_HORIZONTAL \n
- * the layout orientation is horizontal
- * - IM_LOOKUP_TABLE_VERTICAL \n
- * the layout orientation is vertical
+ * - IM_LOOKUP_TABLE_LTRTTB \n
+ * the layout orientation is from left to right, top to bottom.
+ * - IM_LOOKUP_TABLE_RTLTTB \n
+ * the layout orientation is from right to left, top to bottom.
+ * - IM_LOOKUP_TABLE_TTBLTR \n
+ * the layout orientation is from top to bottom, left to right.
+ * - IM_LOOKUP_TABLE_TTBRTL \n
+ * the layout orientation is from top to bottom, right to left.
*/
typedef enum {
- IM_LOOKUP_TABLE_HORIZONTAL = 0,
- IM_LOOKUP_TABLE_VERTICAL = 1
+ IM_LOOKUP_TABLE_LTRTTB = 0,
+ IM_LOOKUP_TABLE_RTLTTB = 1,
+ IM_LOOKUP_TABLE_TTBLTR = 2,
+ IM_LOOKUP_TABLE_TTBRTL = 3
} IMLookupTableOrientation;
/**
@@ -197,7 +203,7 @@
/**
* @brief Creates a new IMCandidate with specified content, label,
icon and
- * annotation.
+ * annotation.
*
* @param content an IMText of the candidate's content.
* @param label an IMText of the candidate's label.
@@ -394,7 +400,7 @@
IMUInt
rows);
/**
* @brief Get lookup table's page size
- *
+ *
* @param table an IMLookupTable.
* @param cols number of columns (X size).
* @param rows number of rows (Y size).
@@ -405,9 +411,9 @@
/**
* @brief Set cursor position (the currently focused candidate)
* in current page.
- *
+ *
* @param table an IMLookupTable.
- * @param cur the cursor index in that table, if beyonds the
last element,
+ * @param cur the cursor index in that table, if beyonds the
last element,
* it will be set to the end (i.e. columns*rows - 1).
*/
void im_lookup_table_set_cursor (IMLookupTable
*table,