扩展QNX AlternatingCellRenderer

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了扩展QNX AlternatingCellRenderer相关的知识,希望对你有一定的参考价值。

  1. public class PictureCellRenderer extends AlternatingCellRenderer {
  2.  
  3. /**
  4.   * Skin parts used to render the data
  5.   */
  6. protected var img:Image;
  7. protected var lbl:Label;
  8. protected var bg:Sprite;
  9. protected var format:TextFormat;
  10.  
  11. public function PictureCellRenderer() {
  12. super();
  13. // hide the built in label
  14. label.visible = false;
  15. createUI();
  16. }
  17. /**
  18.   * setSize() is called everytime the tiles size are changed
  19.   * this is where we add our method layout() to reposition/redraw
  20.   * various parts of the cell renderer.
  21.   */
  22. override public function setSize(w:Number, h:Number):void {
  23. super.setSize(w, h);
  24. //we want to draw the skin parts only when the
  25. //actual width/height are set
  26. //this method is called first for the default sizes and then for
  27. //for the user prefered sizes
  28. if (stage) {
  29. layout();
  30. }
  31. }
  32. /**
  33.   * Updates the text and image everytime a new data is set
  34.   * for this renderer instance.
  35.   */
  36. override public function set data(value:Object):void {
  37. super.data = value;
  38. //Update the image source and text if there is valid data.
  39. if (value) {
  40. img.setImage(value.img);
  41. lbl.text = value.label;
  42. }
  43. }
  44. /**
  45.   * Create all the cell renderer components just once
  46.   */
  47. private function createUI():void {
  48. img = new Image();
  49. bg = new Sprite();
  50. lbl = new Label();
  51.  
  52. //...
  53. //code to position the img, Sprite, and label
  54. //...
  55.  
  56. addChild(img);
  57. addChild(bg);
  58. addChild(lbl);
  59. }
  60. /**
  61.   * Draws the rectangle used as background
  62.   * for the label
  63.   */
  64. private function drawBg():void {
  65. //code to redraw the gray rounded rectangular
  66. }
  67. /**
  68.   * Reposition/redraw the renderer parts
  69.   * everytime the tile size is changed
  70.   */
  71. private function layout():void {
  72. lbl.y = height - 20;
  73. lbl.width = width - 10;
  74. drawBg();
  75. onComplete(new Event(Event.COMPLETE));
  76. }
  77. /**
  78.   * Resize the image once the bits were loaded
  79.   */
  80. private function onComplete(e:Event):void {
  81. img.setSize(width - 20, height - 20);
  82. }
  83. }

以上是关于扩展QNX AlternatingCellRenderer的主要内容,如果未能解决你的问题,请参考以下文章

QNX Hypervisor 2.2 用户手册1.3 QNX hypervisor架构

QNX Hypervisor 2.2 用户手册4.1 构建QNX Hypervisor系统的方法

QNX Hypervisor 2.2 用户手册4.1 构建QNX Hypervisor系统的方法

[QNX 自适应分区用户指南]6 分区继承

QNX Hypervisor 2.2 用户手册2.1 保护策略

pthread-win32 扩展 sem_post_multiple