浏览代码

Minor update.

Brian E. Granger 8 年之前
父节点
当前提交
e1d939bc2b
共有 1 个文件被更改,包括 21 次插入1 次删除
  1. 21 1
      packages/application/src/shell.ts

+ 21 - 1
packages/application/src/shell.ts

@@ -10,7 +10,7 @@ import {
 } from '@phosphor/coreutils';
 
 import {
-  Message, MessageLoop
+  Message, MessageLoop, IMessageHook, IMessageHandler, MessageHook
 } from '@phosphor/messaging';
 
 import {
@@ -53,6 +53,8 @@ const DEFAULT_RANK = 500;
  */
 const MODE_ATTRIBUTE = 'data-shell-mode';
 
+const ACTIVITY_CLASS = 'jp-Activity';
+
 
 /**
  * The application shell for JupyterLab.
@@ -70,6 +72,8 @@ class ApplicationShell extends Widget {
     let topPanel = this._topPanel = new Panel();
     let hboxPanel = this._hboxPanel = new BoxPanel();
     let dockPanel = this._dockPanel = new DockPanel();
+    MessageLoop.installMessageHook(dockPanel, Private.ActivityClassHook as MessageHook);
+
     let hsplitPanel = this._hsplitPanel = new SplitPanel();
     let leftHandler = this._leftHandler = new Private.SideBarHandler('left');
     let rightHandler = this._rightHandler = new Private.SideBarHandler('right');
@@ -959,4 +963,20 @@ namespace Private {
     private _sideBar: TabBar<Widget>;
     private _stackedPanel: StackedPanel;
   }
+
+  export
+  class ActivityClassHook implements IMessageHook {
+
+    messageHook(handler: IMessageHandler, msg: Message): boolean {
+      
+      if (msg.type === 'child-added') {
+        (handler as Widget).addClass(ACTIVITY_CLASS)
+      } else if (msg.type === 'child-removed') {
+        (handler as Widget).removeClass(ACTIVITY_CLASS)
+      }
+      return true;
+    }
+  }
+
 }
+