_FocusMixin.js.uncompressed.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. define("dijit/_FocusMixin", [
  2. "./focus",
  3. "./_WidgetBase",
  4. "dojo/_base/declare", // declare
  5. "dojo/_base/lang" // lang.extend
  6. ], function(focus, _WidgetBase, declare, lang){
  7. // module:
  8. // dijit/_FocusMixin
  9. // We don't know where _FocusMixin will occur in the inheritance chain, but we need the _onFocus()/_onBlur() below
  10. // to be last in the inheritance chain, so mixin to _WidgetBase.
  11. lang.extend(_WidgetBase, {
  12. // focused: [readonly] Boolean
  13. // This widget or a widget it contains has focus, or is "active" because
  14. // it was recently clicked.
  15. focused: false,
  16. onFocus: function(){
  17. // summary:
  18. // Called when the widget becomes "active" because
  19. // it or a widget inside of it either has focus, or has recently
  20. // been clicked.
  21. // tags:
  22. // callback
  23. },
  24. onBlur: function(){
  25. // summary:
  26. // Called when the widget stops being "active" because
  27. // focus moved to something outside of it, or the user
  28. // clicked somewhere outside of it, or the widget was
  29. // hidden.
  30. // tags:
  31. // callback
  32. },
  33. _onFocus: function(){
  34. // summary:
  35. // This is where widgets do processing for when they are active,
  36. // such as changing CSS classes. See onFocus() for more details.
  37. // tags:
  38. // protected
  39. this.onFocus();
  40. },
  41. _onBlur: function(){
  42. // summary:
  43. // This is where widgets do processing for when they stop being active,
  44. // such as changing CSS classes. See onBlur() for more details.
  45. // tags:
  46. // protected
  47. this.onBlur();
  48. }
  49. });
  50. return declare("dijit._FocusMixin", null, {
  51. // summary:
  52. // Mixin to widget to provide _onFocus() and _onBlur() methods that
  53. // fire when a widget or its descendants get/lose focus
  54. // flag that I want _onFocus()/_onBlur() notifications from focus manager
  55. _focusManager: focus
  56. });
  57. });