MoSync 3.3
Widget functions

Functions

MAWidgetHandle maWidgetCreate (const char *widgetType)
int maWidgetDestroy (MAWidgetHandle widget)
int maWidgetAddChild (MAWidgetHandle parent, MAWidgetHandle child)
int maWidgetInsertChild (MAWidgetHandle parent, MAWidgetHandle child, int index)
int maWidgetRemoveChild (MAWidgetHandle child)
int maWidgetModalDialogShow (MAWidgetHandle dialogHandle)
int maWidgetModalDialogHide (MAWidgetHandle dialogHandle)
int maWidgetScreenShow (MAWidgetHandle screenHandle)
int maWidgetScreenShowWithTransition (MAWidgetHandle screenHandle, MAWScreenTransitionType screenTransitionType, int screenTransitionDuration)
int maWidgetStackScreenPush (MAWidgetHandle stackScreen, MAWidgetHandle newScreen)
int maWidgetStackScreenPop (MAWidgetHandle stackScreen)
int maWidgetSetProperty (MAWidgetHandle widget, const char *property, const char *value)
int maWidgetGetProperty (MAWidgetHandle widget, const char *property, char *value, int bufSize)
int maWidgetScreenAddOptionsMenuItem (MAWidgetHandle widget, const char *title, const char *iconPath, int iconPredefined)

Detailed Description

The set of functions available for the Widget API.


Function Documentation

MAWidgetHandle maWidgetCreate ( const char *  widgetType)

Creates a new widget of the specified type.

Note:
See Widget types for the available widget types.
Parameters:
widgetTypeA String representing the type of the widget to create.
Returns:
A handle to the widget, or any of the following result codes:

References maIOCtl().

Frees the memory and resources held by the given widget. Destryoing a widget with children will also cause its children to be destroyed. Once a handle has been destroyed it cannot be referenced by the maWidget* functions.

Note:
If the given widget has a parent, the widget will be removed from its parent.
Parameters:
widgetA handle to the widget to be destroyed.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetAddChild ( MAWidgetHandle  parent,
MAWidgetHandle  child 
)

Adds a widget to the given parent as a child. Letting the parent widget layout the child.

Parameters:
parentThe widget layout to which the child will be added.
childThe widget that will be added to the parent.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetInsertChild ( MAWidgetHandle  parent,
MAWidgetHandle  child,
int  index 
)

Inserts a widget to the given parent as a child at an index. Letting the parent widget layout the child.

Parameters:
parentThe widget layout in which the child will be inserted.
childThe widget that will be added to the parent.
indexThe index where the widget should be inserted (-1 means last)
Returns:
Any of the following result codes:

References maIOCtl().

Removes a child widget from its parent (but does not destroy it). Removing a currently visible top-level widget causes the MoSync view to become visible.

Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetModalDialogShow ( MAWidgetHandle  dialogHandle)

Shows a dialog widget.

Parameters:
dialogHandleThe handle of the dialog that will be shown.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetModalDialogHide ( MAWidgetHandle  dialogHandle)

Hides/Dismisses a currently displayed dialog.

Parameters:
dialogHandleThe handle of the dialog that will be hidden.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetScreenShow ( MAWidgetHandle  screenHandle)

Shows a screen. If native UI hasn't been initialized, it is also initialized and disables regular MoSync drawing.

Parameters:
screenHandleThe handle to the screen.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetScreenShowWithTransition ( MAWidgetHandle  screenHandle,
MAWScreenTransitionType  screenTransitionType,
int  screenTransitionDuration 
)

Shows a screen with a transition. If native UI hasn't been initialized, it is also initialized and disables regular MoSync drawing.

Parameters:
screenHandleThe handle to the screen.
screenTransitionTypeThe transition of the screen. See available screen transitions types here .
screenTransitionDurationThe duration of the transition in milliseconds. This argument is not used on the Windows Phone platform due to the constant duration of the WP screen transitions.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetStackScreenPush ( MAWidgetHandle  stackScreen,
MAWidgetHandle  newScreen 
)

Pushes a screen to the given screen stack, hides the current screen and shows the pushed screen it. Pushing it to the stack will make it automatically go back to the previous screen when popped.

Parameters:
stackScreenA handle to a MAW_STACK_SCREEN.
newScreenA handle to either a MAW_SCREEN or a MAW_TAB_SCREEN. The handle cannot exist in the stack already.
Returns:
Any of the following result codes:
  • MAW_RES_OK if the given screen could be pushed.
  • MAW_RES_INVALID_HANDLE if either the screenStack or newScreen handle was invalid.
  • MAW_RES_ERROR if something else than a screen stack was passed, or if the handle already exists in the stack.

References maIOCtl().

int maWidgetStackScreenPop ( MAWidgetHandle  stackScreen)

Pops a screen from a screen stack, hides the current screen and shows the popped screen before the If there is no previous screen in the screen stack, an empty screen will be shown.

Parameters:
stackScreenA handle to a MAW_STACK_SCREEN to pop from.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetSetProperty ( MAWidgetHandle  widget,
const char *  property,
const char *  value 
)

Sets a specified property on the given widget.

Parameters:
widgetHandle to the widget.
propertyA string representing which property to set.
valueThe value which will be assigned to the property.
Note:
May be synchronous or asynchronous depending on the property.
See Widget properties for the available properties.
Returns:
Any of the following result codes:

References maIOCtl().

int maWidgetGetProperty ( MAWidgetHandle  widget,
const char *  property,
char *  value,
int  bufSize 
)

Retrieves a specified property from the given widget.

Parameters:
widgetHandle to the widget.
propertyA string representing which property to set.
valueA buffer that will hold the value of the property, represented as a string.
bufSizeSize of the buffer.
Returns:
The number of bytes copied on success, or any of the following result codes:

References maIOCtl().

int maWidgetScreenAddOptionsMenuItem ( MAWidgetHandle  widget,
const char *  title,
const char *  iconPath,
int  iconPredefined 
)

Add an item to the Options Menu associated to a screen. Available on Android and WP7. The options menu is where you should include actions and other options that are relevant to the current activity context, such as "Search," "Compose email," or "Settings". When opened, the first visible portion is the icon menu, which holds up to six menu items. If your menu includes more than six items, Android places the sixth item and the rest into the overflow menu, which the user can open by selecting More. Those items do not display icons.

Parameters:
widgetHandle to the screen widget.
titleThe title associated for the new item. Can be left null.
iconPathThe path to an image or a predefined icon, one of the MAW_OPTIONS_MENU_ICON_CONSTANT_ADD constants. Note that for Windows phone 7 the option menu icons must be added under the following folder structure "/ApplicationBarIcons/". The function is called with the name of the icon file. e.g. maWidgetScreenAddOptionsMenuItem(ScreenHandle, "test", "optionsMenuItemIcon.png", 0); where the file optionsMenuItemIcon.png is found in the folder "/ApplicationBarIcons". Can be left null. On windows phone 7 a null icon means that the item will be a part of the extendable menu item list from the native Application Bar. Specifies if the icon is a project resource, or one of the predefined Android icons. By default it's value is 0.
Returns:
The the item index on success, or any of the following result codes:
  • MAW_RES_ERROR
  • MAW_RES_INVALID_HANDLE NOTE: Android no longer requires a dedicated Menu button, some devices donít have one, and you should migrate away from using it. Use #maActionBarAddMenuItem() syscall instead.

References maIOCtl().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines