当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript PanelLayout.addChild方法代码示例

本文整理汇总了TypeScript中phosphor-panel.PanelLayout.addChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript PanelLayout.addChild方法的具体用法?TypeScript PanelLayout.addChild怎么用?TypeScript PanelLayout.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phosphor-panel.PanelLayout的用法示例。


在下文中一共展示了PanelLayout.addChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 model.contentChanged.connect(() => {
   let widget = renderer.render('text/markdown', model.toString());
   if (layout.childCount()) {
     layout.childAt(0).dispose();
   }
   layout.addChild(widget);
 });
开发者ID:ChinaQuants,项目名称:jupyterlab,代码行数:7,代码来源:widget.ts

示例2: updateTextEditor

 /**
  * Update the text editor model, creating a new text editor
  * widget and detaching the old one.
  */
 updateTextEditor(editor: IEditorModel) {
   let layout = this.layout as PanelLayout;
   if (layout.childCount() > 0) {
     layout.childAt(0).dispose();
   }
   layout.addChild(new CodeMirrorWidget(editor));
 }
开发者ID:sccolbert,项目名称:jupyter-js-notebook,代码行数:11,代码来源:widget.ts

示例3: add

 /**
  * Add an item to the toolbar.
  *
  * @param name - The name of the widget to add to the toolbar.
  *
  * @param widget - The widget to add to the toolbar.
  *
  * @param after - The optional name of the item to insert after.
  *
  * #### Notes
  * An error is thrown if a widget of the same name is already given.
  * If `after` is not given, or the named widget is not in the toolbar,
  * the widget will be added to the end of the toolbar.
  */
 add(name: string, widget: Widget, after?: string): void {
   let names = this.list();
   if (names.indexOf(name) !== -1) {
     throw new Error(`A button named "${name}" was already added`);
   }
   widget.addClass(TOOLBAR_ITEM);
   let layout = this.layout as PanelLayout;
   let index = names.indexOf(after);
   if (index === -1) {
     layout.addChild(widget);
   } else {
     layout.insertChild(index + 1, widget);
   }
   Private.nameProperty.set(widget, name);
 }
开发者ID:munshkr,项目名称:gakuon-editor,代码行数:29,代码来源:index.ts

示例4: constructor

 /**
  * Construct a new editor widget.
  */
 constructor(context: IDocumentContext<IDocumentModel>) {
   super();
   this.layout = new PanelLayout();
   this.addClass(EDITOR_CLASS);
   var codeMirror = new CodeMirrorWidget();
   var layout = this.layout as PanelLayout;
   let editor = codeMirror.editor;
   let model = context.model;
   this.createMenu(layout);
   layout.addChild(codeMirror);
   editor.setOption('lineNumbers', true);
   editor.setOption('theme', "material");
   let doc = editor.getDoc();
   doc.setValue(model.toString());
   this.title.text = context.path.split('/').pop();
   loadModeByFileName(editor, context.path);
   model.stateChanged.connect((m, args) => {
     if (args.name === 'dirty') {
       if (args.newValue) {
         this.title.className += ` ${DIRTY_CLASS}`;
       } else {
         this.title.className = this.title.className.replace(DIRTY_CLASS, '');
       }
     }
   });
   context.pathChanged.connect((c, path) => {
     loadModeByFileName(editor, path);
     this.title.text = path.split('/').pop();
   });
   model.contentChanged.connect(() => {
     let old = doc.getValue();
     let text = model.toString();
     if (old !== text) {
       doc.setValue(text);
     }
   });
   CodeMirror.on(doc, 'change', (instance, change) => {
     if (change.origin !== 'setValue') {
       model.fromString(instance.getValue());
     }
   });
 }
开发者ID:rnetro,项目名称:editor_changes,代码行数:45,代码来源:widget.ts

示例5: createMenu

  createMenu(layout : PanelLayout) {
    let menuOne = new Menu([
      new MenuItem({
        text: 'Match Brackets'
      }),
      new MenuItem({
        text: 'Line Numbers'
      }),
      new MenuItem({
        text: 'Line Wrapping'
      }),
      new MenuItem({
        text: 'Syntax Highlighting'
      })
      ]);

    let menuTwo = new Menu([
      new MenuItem({
        text: 'abcdef'
      }),
      new MenuItem({
        text: 'base16-dark'
      }),
      new MenuItem({
        text: 'base16-light'
      }),
      new MenuItem({
        text: 'hopscotch'
      }),
      new MenuItem({
        text: 'material'
      }),
      new MenuItem({
        text: 'mbo'
      }),
      new MenuItem({
        text: 'mdn-like'
      }),
      new MenuItem({
        text: 'seti'
      }),      
      new MenuItem({
        text: 'the-matrix'
      }),
      new MenuItem({
        text: 'xq-light'
      }),
      new MenuItem({
        text: 'zenburn'
      })
      ]);

    let menuThree = new Menu([
      new MenuItem({
        text: 'Vim Mode'
      }),
      new MenuItem({
        text: 'EMacs Mode'
      })
      ]);

    let menuBar = new MenuBar([
      new MenuItem({
        text: 'Settings',
        submenu: menuOne,
        shortcut: 'Ctrl-S'
      }),
      new MenuItem({
        text: 'Themes',
        submenu: menuTwo,
        shortcut: 'Ctrl+T'
      }),
      new MenuItem({
        text: 'Modes',
        submenu: menuThree,
        shortcut: 'Ctrl+M'
      })
      ])

    layout.addChild(menuBar);
  }
开发者ID:rnetro,项目名称:editor_changes,代码行数:81,代码来源:widget.ts


注:本文中的phosphor-panel.PanelLayout.addChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。