瀏覽代碼

Add current changed signal to application shell.

Afshin Darian 8 年之前
父節點
當前提交
1da9014252
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      src/application/shell.ts

+ 18 - 0
src/application/shell.ts

@@ -8,6 +8,10 @@ import {
   Vector
 } from 'phosphor/lib/collections/vector';
 
+import {
+  defineSignal, ISignal
+} from 'phosphor/lib/core/signaling';
+
 import {
   BoxLayout, BoxPanel
 } from 'phosphor/lib/ui/boxpanel';
@@ -20,6 +24,10 @@ import {
   each
 } from 'phosphor/lib/algorithm/iteration';
 
+import {
+  FocusTracker
+} from 'phosphor/lib/ui/focustracker';
+
 import {
   Panel
 } from 'phosphor/lib/ui/panel';
@@ -142,6 +150,7 @@ class ApplicationShell extends Widget {
     this.layout = rootLayout;
 
     this._dockPanel.currentChanged.connect((sender, args) => {
+      this.currentChanged.emit(args);
       if (args.newValue) {
         args.newValue.title.className += ` ${CURRENT_CLASS}`;
       }
@@ -153,6 +162,11 @@ class ApplicationShell extends Widget {
     });
   }
 
+  /**
+   * A signal emitted when main area's current focus changes.
+   */
+  currentChanged: ISignal<this, FocusTracker.ICurrentChangedArgs<Widget>>;
+
   /**
    * Add a widget to the top content area.
    *
@@ -268,6 +282,10 @@ class ApplicationShell extends Widget {
 }
 
 
+// Define the signals for the `ApplicationShell` class.
+defineSignal(ApplicationShell.prototype, 'currentChanged');
+
+
 /**
  * A class which manages a side bar and related stacked panel.
  */