Sha256: b5ba80401d03e9db92b4713509a85d8bb7beb2176a11489689032d76725adcc0

Contents?: true

Size: 953 Bytes

Versions: 2

Compression:

Stored size: 953 Bytes

Contents

module Redcar
  class Tab
    include Redcar::Model
    include Redcar::Observable
    
    attr_reader :notebook
    
    def initialize(notebook)
      @notebook = notebook
      @title    = "unknown"
    end
    
    # Close the tab (remove it from the Notebook).
    #
    # Events: close
    def close
      notify_listeners(:close)
      @notebook.remove_tab!(self)
    end
    
    # Focus the tab within the notebook, and gives the keyboard focus to the 
    # contents of the tab, if appropriate.
    #
    # Events: focus
    def focus
      notify_listeners(:focus)
    end
    
    def title
      @title
    end
    
    def title=(title)
      @title = title
      notify_listeners(:changed_title, title)
    end
    
    def inspect
      "#<#{self.class.name} \"#{title}\">"
    end
    
    # Sets the notebook of the tab. Should not be called from user code.
    def set_notebook(notebook)
      @notebook = notebook
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redcar-0.3.0dev plugins/application/lib/application/tab.rb
redcar-0.2.9dev plugins/application/lib/application/tab.rb