           callback  : cancel.callback or noop
     modal.addSubView options.subView  if options.subView
     modal
+
+

      @$().height value
      @modalHeight = value

  setModalWidth:(value)->
    # if isNaN value
    @modalWidth = value
    @$().width value

  setPositions:->
    @utils.defer =>
      {top, right, bottom, left} = @getOptions().position
      newRules = {}

    @overlay.once 'click', @bound 'destroy'  if overlayClick


  createButton: (title, buttonOptions) ->
    buttonOptions.title    = title
    buttonOptions.delegate = this
    itemClass = buttonOptions.itemClass
    delete buttonOptions.itemClass
    @buttonHolder.addSubView button = new (itemClass or KDButtonView) buttonOptions
    button.on 'KDModalShouldClose', => @emit 'KDModalShouldClose'
    button


  setContent: (content) ->
    @modalContent = content
    @getDomElement().find(".kdmodal-content").html content


  display: ->
    if @getOptions().fx
      @utils.defer =>
        @setClass "active"


  cancel: ->
    return unless @getOptions().cancelable
    @emit 'ModalCancelled'
    @destroy()


  destroy: ->
    $(window).off "keydown.modal"
    uber = KDView::destroy.bind this

    if @options.fx
      @unsetClass "active"
