GEOS SDK TechDocs
|
|
2 ComplexMonikerClass
|
2.2 ComplexMoniker Usage
ComplexMonikerClass
contains the following instance data:
Code Display 2-3 ComplexMonikerClass Instance Data
ComplexMoniker ClassName
@instance TextStyle CMI_textStyle = (TS_BOLD);
@instance word CMI_topText;
@instance word CMI_iconBitmap;
@instance byte CMI_fontSize;
Because
ComplexMonikerClass
is a variant class, it needs to have its superclass assigned when it is built. The
ComplexMoniker
keyword represents the parent class of the complex moniker. By setting this keyword to a class name the parent class is changed from the default superclass GenClass to the specified class. Any child of GenClass may be a complex moniker superclass. The following are commonly used superclasses:
GenTriggerClass
GenInteractionClass
GenItemGroupClass
GenItemClass
GenBooleanGroupClass
GenDynamicListClass
ContactListClass
Each of these classes will behave quite differently, but all will exhibit the same characteristics in displaying their text and icon monikers that are gained through using
ComplexMonikerClass.
Note that using a ComplexMoniker object will cause the specific UI to ignore any moniker stored in the GI_
visMoniker
instance data field in the above classes.
CMI
_topText
stores the "text" to display. This may be either a Chunkhandle to a text string, or a
ComplexMonikerText
identifier. If the value is a
ComplexMonikerText
identifier, the specific UI will determine what exact text is displayed.
As noted, the text may contain two lines. The top text is limited to COMPLEX_MONIKER_MAX_TOP_TEXT_LENGTH while the bottom is limited to COMPLEX_MONIKER_MAX_BOTTOM_TEXT_LENGTH.
Below is a complete list of types; in most cases the (English) text on the Nokia 9000i device is similar, if not identical, to the text alluded to by the identifier's name. Those cases where the actual text is noticeably different are noted. Using such an identifier is beneficial for localization purposes.
Code Display 2-4 Setting a Complex Moniker's Text
/* * The text in a complex moniker is stored within the CMI_topText instance field. * This text may either be referenced by a ChunkHandle ... */
@object ComplexMonikerClass MyMoniker = {
ComplexMoniker = GenTriggerClass;
CMI_topText = @MyText;
}
/* Use the TCHAR type to ensure the text is DBCS-compliant. */
@chunk TCHAR MyText[] = "Sample Text";
/* * ... or CMI_topText can store a ComplexMonikerText type which indicates the text * generically. */
@object ComplexMonikerClass MyClearTrigger = {
ComplexMoniker = GenTriggerClass;
CMI_topText = CMT_CLEAR;
}
CMI_
iconBitmap
stores the bitmap to display within this moniker. This may either be a ChunkHandle to a Bitmap structure or a member of the
ComplexMonikerBitmap
types. These types are enumerated below:
Again, using a generic identifier eases localization.
You can create your own bitmaps by using the GEOS Icon Editor. To do so, perform the following steps:
BMFormat
of BMF_4BIT). You may also create simple monochrome bitmaps (
BMFormat
of BMF_MONO).|
Icon Editor Color |
Nokia 9000i |
|---|---|
|
WHITE |
WHITE |
|
BLACK |
BLACK |
|
LIGHT_VIOLET |
LIGHT GRAY |
|
DARK_GREEN |
DARK GRAY |
filename
.goh using the following options:@visMoniker Moniker ={
@chunk byte YourIconName[] = {
size = <...>;
style = <...>;
color = <...>;
aspectRatio = <...>;
cachedSize = <...,...>;
gstring { GSFillBitmapAtCP(<...>),
GSEndString() }
Your resulting bitmap, ready for inclusion in your app, should look like this:
@chunk byte MyIconName[] = {
Bitmap (32,20,BMC_PACKBITS,
(BMT_MASK|BMF_4BIT)),
0xfd, 0xff, 0x03, 0xbf, ...
};
CMI_
textStyle
stores a GEOS
TextStyle
, defined in
graphics.h
. By default, text is shown as TS_BOLD. The full list of styles appears below:
CMI
_fontSize
stores a font size (in points). There are four pre-established font sizes that you should choose from:
#define FOAM_LARGE_FONT_SIZE 20 #define FOAM_NORMAL_FONT_SIZE 18 #define FOAM_LIGHT_FONT_SIZE 17 #define FOAM_SMALL_FONT_SIZE 16
The large font size is best reserved for commands and title bar monikers. In most other cases, use the normal font size.
The default font can be obtained by those routines or objects that demand a font name by using the
VisTextDefaultFont
value VTDF_RESPONDER.
There are several vardata attributes that you may attach to the Complex Moniker. These are noted below:
Code Display 2-5 ComplexMoniker Vardata
@vardata void ATTR_COMPLEX_MONIKER_PLACE_BITMAP_AT_LEFT;
@vardata void HINT_COMPLEX_MONIKER_DRAW_SEPARATOR; @vardata void HINT_COMPELX_MONIKER_DONT_DRAW_SEPARATOR;
ATTR_COMPLEX_MONIKER_PLACE_BITMAP_AT_LEFT will position the icon bitmap (if any) to the left of the text.
HINT_COMPLEX_MONIKER_DRAW_SEPARATOR
draws a single-line separator below the complex moniker.
HINT_COMPLEX_MONIKER_DONT_DRAW_SEPARATOR
prevents the drawing of a single-line separator below the complex moniker.
GEOS SDK TechDocs
|
|
2 ComplexMonikerClass
|
2.2 ComplexMoniker Usage