XmTextFieldGetLayoutModifier
XmTextFieldGetLayoutModifier() returns the layout modifier string that reflects the state of the layout object tied to its rendition.
The syntax for XmTextFieldGetLayoutModifier() is:
#include <Xm/TextF.h>String XmTextFieldGetLayoutModifier(Widget widget)
XmTextFieldGetLayoutModifier() accesses the value of the current layout object settings of the rendition associated with the widget. When the layout object modifier values are changed using a convenience function, the XmTextFieldGetLayoutModifier function returns the complete state of the layout object, not only the changed values.
XmTextFieldGetLayoutModifier() returns the layout object modifier values in the form of a string value.
XmTextGetLayoutModifier
XmTextGetLayoutModifier() returns the layout modifier string that reflects the state of the layout object tied to its rendition.
The syntax for XmTextGetLayoutModifier() is:
#include <Xm/Text.h>String XmTextGetLayoutModifier(Widget widget)
XmTextGetLayoutModifier accesses the value of the current layout object settings of the rendition associated with the widget. When the layout object modifier values are changed using a convenience function, the XmTextGetLayoutModifier function returns the complete state of the layout object, not just the changed values.
XmTextGetLayoutModifier returns the layout object modifier values in the form of a string value.
XmTextFieldSetLayoutModifier
XmTextFieldSetLayoutModifier() sets the layout modifier values, which changes the behavior of the layout object tied to its rendition.
The syntax for XmTextFieldSetLayoutModifier() is:
#include <Xm/TextF.h>void XmTextFieldSetLayoutModifier(Widget widget,string layout_modifier)
XmTextFieldSetLayoutModifier modifies the layout object settings of a rendition associated with the widget. When the layout object modifier values are set using this convenience function, only the attributes specified in the input parameter are changed; the rest of the attributes remain untouched.
XmTextSetLayoutModifier
XmTextSetLayoutModifier() sets the layout modifier values, which changes the behavior of the layout object tied to its rendition.
The syntax for XmTextSetLayoutModifier() is:
#include <Xm/Text.h>void XmTextSetLayoutModifier(Widget widget,string layout_modifier)
XmTextSetLayoutModifier modifies the layout object settings of a rendition associated with the widget. When the layout object modifier values are set using this convenience function, only the attributes specified in the input parameter are changed; the rest of the attributes are left untouched.
XmStringDirectionCreate
XmStringDirectionCreate creates a compound string.
The syntax for XmTextSetLayoutModifier() is:
#include <Xm/Xm.h>XmString XmStringDirectionCreate(direction)XmStringDirection direction
XmStringDirectionCreate creates a compound string with a single component, a direction with the given value. On the other hand, the XmNlayoutDirection resource sets a default rendering direction for any compound string (XmString) that does not have a component specifying the direction for that string. Therefore, to set the layout direction, all you need to do is set the appropriate value for the XmNlayoutDirection resource. You need not create compound strings with specific direction components. When the application renders an XmString, it should look to see if the string was created with an explicit direction (XmStringDirection). If there is no direction component, the application should check the value of the XmNlayoutDirection resource for the current widget and use that value as the default rendering direction for the XmString.
UIL Arguments
The following table shows the UIL arguments.
Table 6-3 UIL
UIL Argument Name | Argument Type |
---|---|
XmNlayoutAttrObject | String |
XmNlayoutModifier | String |
XmNrenditionTag | String |
XmNalignment | Integer |
XmNeditPolicy | Integer |
How to Develop CTL Applications
The following sections show how to develop CTL applications.
Layout Direction
The direction of a compound string is stored so that the data structure is equally useful for describing text in left-to-right languages such as English, Spanish, French, and German, or for text in right-to-left languages, such as Hebrew and Arabic. In Motif applications, you can set the layout direction using the XmNlayoutDirection resource from the VendorShell or MenuShell. Manager and Primitive widgets (as well as Gadgets) also have an XmNlayoutDirection resource. The default value is inherited from the closest ancestor with the same resource.
In the case of an XmText widget, you must specify the vertical direction as well. Setting the layoutDirection to XmRIGHT_TO_LEFT results in the string direction from right-to-left, but the cursor moves vertically down. If the vertical direction is important and you require top to bottom alignment, be sure to specify XmRIGHT_TO_LEFT_TOP_TO_BOTTOM, which specifies that the components are laid out from right-to-left first and then top-to-bottom, and results in the desired behavior.
Furthermore, the behavior of XmText and TextField widgets is influenced by the XmNalignment and XmNlayoutModifier resources of the XmRendition. These resources, in addition to XmNlayoutDirection, control the layout behavior of the Text widget. This behavior is illustrated in Figure 6-2.
The input string used in the figure is:
The XmNlayoutModifier string @ls orientation= setting values for the following figure are shown in the left column.
Figure 6-2 Layout Direction
As the illustration shows, XmNAlignment dictates whether the text is flush right or left in conjunction with the layout direction. XmNlayoutModifier breaks the text into segments and arranges them left-to-right or right-to-left, depending on the orientation value. In other words, if the XmNlayoutDirection is XmRIGHT_TO_LEFT, and the XmNAlignment value is XmALIGNMENT_BEGINNING, the string is flush right.
Creating a Rendition
The following code creates an XmLabel whose XmNlabelString is of the type XmCHARSET_TEXT, using the Rendition whose tag is "ArabicShaped." The Rendition is created with an XmNlayoutAttrObject of "ar" (corresponding to the locale name for the Arabic locale) and a layout modifier string that specifies for the output buffer a Numerals value of NUMERALS_CONTEXTUAL and a ShapeCharset value of "unicode-3.0."
The locale-specific layout module transforms its input text into an output buffer of physical characters encoded using the 16-bit Unicode 3.0 codeset. Because an explicit layout locale has been specified, this text is rendered properly independent of the runtime locale setting. In this example, the input is encoded in ISO 8859-6.
int n; Arg args[10]; Widget w; XmString labelString; XmRendition rendition; XmStringTag renditionTag; XmRenderTable renderTable; /* alef lam baa noon taa - iso8859-6 */ labelString = XmStringGenerate("\307\344\310\346\312\", NULL XmCHARSET_TEXT, "ArabicShaped"); w = XtVaCreateManagedWidget("a label", xmLabelWidgetClass, parent, XmNlabelString, labelString, XmNlabelType, XmSTRING, NULL); n = 0; XtSetArg(args[n], XmNfontName, "-*-*-medium-r-normal-*-24-*-*-*-*-*-*"); n++; XtSetArg(args[n], XmNfontType, XmFONT_IS_XOC); n++; XtSetArg(args[n], XmNlayoutAttrObject, "ar"); n++; XtSetArg(args[n], XmNlayoutModifier, "@ls numerals=:contextual, shapecharset=iso8859-6"); n++; renditionTag = (XmStringTag) "ArabicShaped"; rendition = XmRenditionCreate(w, renditionTag, argcs s, n); renderTable = XmRenderTableAddRenditions(NULL, &rendition, 1, XmREPLACE_MERGE); XtVaSetValues(w, XmNrenderTable, renderTable, NULL); |