     #   for handle in visibleHandles
     #     handle.$().css width : ((containerSize-50)/visibleHandles.length) - 15
 
-  _windowDidResize:(event)=>
-    @resizeTabHandles @,event
-    
-    +  _windowDidResize:(event)=> @resizeTabHandles event
+

    for pane,index in @panes
      result = index if pane is aPane
    result
  
  #NAVIGATING
  showPaneByIndex:(index)->
    @showPane @getPaneByIndex index
  
  showPaneByName:(name)->
    @showPane @getPaneByName name
    
  showNextPane:->
    activePane  = @getActivePane()
    activeIndex = @getPaneIndex activePane
    @showPane @getPaneByIndex activeIndex + 1
    
  showPreviousPane:->
    activePane  = @getActivePane()
    activeIndex = @getPaneIndex activePane
    @showPane @getPaneByIndex activeIndex - 1
    

  #MODIFY PANES/HANDLES
  setPaneTitle:(pane,title)->
    handle = @getHandleByPane pane
    handle.getDomElement().find("b").html title
    
  getHandleByPane: (pane) ->
    index   = @getPaneIndex pane
    handle  = @getHandleByIndex index
  
  hideCloseIcon:(pane)->
    index = @getPaneIndex pane
    handle = @getHandleByIndex index
    handle.getDomElement().addClass("hide-close-icon")
    
  resizeTabHandles:->
    return if @handlesHidden
    # 
    # visibleHandles = []
    # visibleTotalSize = 0
    # 
    # #FIX hardcoded values
    # containerSize = @tabHandleContainer.getWidth()
    # for handle in @handles
    #   unless handle.$().hasClass("hidden")
    #     visibleHandles.push handle
    #     visibleTotalSize += handle.getWidth()
    # 
    # if containerSize-50 < visibleTotalSize
    #   for handle in visibleHandles
    #     handle.$().css width : ((containerSize-50)/visibleHandles.length) - 15,200

        title   : paneInstance.options.name
        hidden  : paneInstance.options.hiddenHandle
        view    : paneInstance.options.tabHandleView
      paneInstance.tabHandle = newTabHandle
      @listenTo
        KDEventTypes : "click"
        listenedToInstance : newTabHandle
        callback : @handleMouseDownDefaultAction
      @appendPane paneInstance
      @showPane paneInstance
      @emit "PaneAdded", paneInstance
      return paneInstance
    else
      warn "You can't add #{paneInstance.constructor.name if paneInstance?.constructor?.name?} as a pane, use KDTabPaneView instead."
      false

  removePane:(pane)->
