Menubar.Help.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Menubar.Help = function ( signals ) {
  2. var container = new UI.Panel();
  3. container.setFloat( 'left' );
  4. container.setWidth( '50px' );
  5. container.setCursor( 'pointer' );
  6. container.onMouseOver( function () { options.setDisplay( '' ) } );
  7. container.onMouseOut( function () { options.setDisplay( 'none' ) } );
  8. container.onClick( function () { options.setDisplay( 'none' ) } );
  9. var title = new UI.Panel();
  10. title.setTextContent( 'Help' ).setColor( '#666' );
  11. title.setMargin( '0px' );
  12. title.setPadding( '8px' )
  13. container.add( title );
  14. //
  15. var options = new UI.Panel();
  16. options.setWidth( '140px' );
  17. options.setBackgroundColor( '#ddd' );
  18. options.setPadding( '0px' );
  19. options.setBorderTop( 'solid 1px #ccc' );
  20. options.setStyle( 'box-shadow', [ '0 3px 7px rgba(0,0,0,0.05), 3px 3px 7px rgba(0,0,0,0.1)' ] );
  21. options.setDisplay( 'none' );
  22. container.add( options );
  23. // about
  24. var option = new UI.Panel();
  25. option.setTextContent( 'About' ).setColor( '#666' ).setPadding( '6px 12px' );
  26. option.onClick( function () { alert( 'About' ) } );
  27. options.add( option );
  28. addHoverStyle( option );
  29. //
  30. function addHoverStyle( element ) {
  31. element.onMouseOver( function () { element.setBackgroundColor( '#356' ).setColor( '#eee' ); } );
  32. element.onMouseOut( function () { element.setBackgroundColor( 'transparent' ).setColor( '#666' ) } );
  33. }
  34. return container;
  35. }