Sha256: 02012e250ec6a50a009e111e07d5c3f72aadee7c345c0e3e8db33a235c436c77

Contents?: true

Size: 1.88 KB

Versions: 5

Compression:

Stored size: 1.88 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            Portions ©2008-2009 Apple Inc. All rights reserved.
// License:   Licened under MIT license (see license.js)
// ==========================================================================

sc_require('render_delegates/panel');

// because render delegates are instances and therefore not, currently,
// subclassable, this is line-for-line the same render delegate as pickerRenderDelegate.
// this is obviously not optimal.
SC.BaseTheme.menuRenderDelegate = SC.RenderDelegate.create({
  name: 'menu',
  
  render: function(dataSource, context) {
    var panelRenderDelegate = dataSource.get('theme').panelRenderDelegate;

    panelRenderDelegate.render(dataSource, context);

    var preferType = dataSource.get('preferType');
    var pointerPosition = dataSource.get('pointerPos');
    var pointerPositionY = dataSource.get('pointerPosY');

    if (preferType == SC.PICKER_POINTER || preferType == SC.PICKER_MENU_POINTER) {
      context.push('<div class="sc-pointer ' + pointerPosition + '" style="margin-top: ' + pointerPositionY + 'px"></div>');
      context.addClass(pointerPosition);
    }
  },
  
  update: function(dataSource, $) {
    var panelRenderDelegate = dataSource.get('theme').panelRenderDelegate;
    panelRenderDelegate.update(dataSource, $);
    
    var preferType = dataSource.get('preferType');
    var pointerPosition = dataSource.get('pointerPos');
    var pointerPositionY = dataSource.get('pointerPosY');

    if (preferType == SC.PICKER_POINTER || preferType == SC.PICKER_MENU_POINTER) {
      var el = $.find('.sc-pointer');
      el.attr('class', "sc-pointer "+pointerPosition);
      el.attr('style', "margin-top: "+pointerPositionY+"px");
      $.addClass(pointerPosition);
    }

  }
});

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/desktop/render_delegates/menu.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js