source: Dev/branches/rest-dojo-ui/client/dijit/_FocusMixin.js @ 274

Last change on this file since 274 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

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