/api/blackberry_ui_menu_item.js

https://github.com/jasondscott/WebWorks-API-Docs · JavaScript · 80 lines · 5 code · 7 blank · 68 comment · 0 complexity · 8470ee8b12526c2d830f52d5fe274a2a MD5 · raw file

  1. /*
  2. * Copyright 2010-2011 Research In Motion Limited.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * @description The MenuItem object is an instance object, where if a new instance is desired, it must be created using the new keyword.
  18. * @featureID blackberry.ui.menu
  19. * @toc {User Interface} MenuItem
  20. * @BB50+
  21. * @RIPPLE
  22. * @class The MenuItem object represents a menu item for the screen.
  23. * @constructs
  24. * @param {Boolean} isSeparator If set to true the MenuItem will be created as a separator.
  25. * @param {Number} ordinal The ordinal of this MenuItem. Ordinal has to be greater than or equal to zero. Exception will be thrown if it is less than zero.
  26. * @param {String} [caption] The text to display on the menu item. This must be supplied if isSeparator is false.
  27. * @callback {function} [onClick] A parameter to specify the function to call when the user clicks the menu item.
  28. * @throws {Exception} If the onClick callback is supplied when isSeparator is true, an exception will be thrown.
  29. * @learns {Sample - Menu Items} http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Adding-Menu-Items-using-the-BlackBerry-WebWorks-SDK/ta-p/516885 Example that demonstrates how to use the Menu API to
  30. * create a custom application menu in a BlackBerry WebWorks application [BlackBerry Developer Resource Center].
  31. * @example
  32. * <script type="text/javascript">
  33. *
  34. * function clickMe() {
  35. * alert("user just clicked me");
  36. * }
  37. *
  38. * var item = new blackberry.ui.menu.MenuItem(false, 1, "Hello World", clickMe);
  39. * blackberry.ui.menu.addMenuItem(item);
  40. *
  41. * </script>
  42. */
  43. blackberry.ui.menu.MenuItem = function(isSeparator,ordinal,caption,onClick) { };
  44. /**
  45. * Contains the caption for the menu item.
  46. * @type String
  47. * @BB50+
  48. * @RIPPLE
  49. */
  50. blackberry.ui.menu.MenuItem.prototype.caption = { };
  51. /**
  52. * Each MenuItem has an ordinal specifying the sort order within the menu. MenuItems with a lower ordinal will have higher positions on the menu than the MenuItems with higher ordinal. A separator will be automatically inserted between adjacent items whose ordinals differ by at least 0x00010000.
  53. * @type Number
  54. * @BB50+
  55. * @RIPPLE
  56. */
  57. blackberry.ui.menu.MenuItem.prototype.ordinal = { };
  58. /**
  59. * Value is true if the menu item is a separator.
  60. * @type Boolean
  61. * @readOnly
  62. * @BB50+
  63. * @RIPPLE
  64. */
  65. blackberry.ui.menu.MenuItem.prototype.isSeparator = { };
  66. /**
  67. * Value is true if the menu item is marked as the default item to be selected in the menu.
  68. * @type Boolean
  69. * @readOnly
  70. * @BB50+
  71. * @RIPPLE
  72. */
  73. blackberry.ui.menu.MenuItem.prototype.isDefault = { };