Skip to content

Commit

Permalink
Switch to a menubar app design
Browse files Browse the repository at this point in the history
  • Loading branch information
wfarr committed Jul 9, 2010
1 parent da46c70 commit d2be798
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 42 deletions.
38 changes: 22 additions & 16 deletions lib/application.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,17 +3,34 @@
# Replace the following code with your own hotcocoa code # Replace the following code with your own hotcocoa code


class Xtt class Xtt

include HotCocoa include HotCocoa


def start def start
application :name => "Xtt" do |app| @app = application :name => "Xtt", :delegate => self
app.delegate = self @status = status_item
set_status_menu
@app.run
end

def set_status_menu
@menu = status_menu
@status.view = nil
@status.menu = @menu
@status.title = "Xtt Item"
@status.setHighlightMode true
end

def status_menu
menu :delegate => self do |status|
status.item "New Status", :on_action => proc { new_window }
status.separator
status.item "Preferences", :on_action => proc { preferences }
status.separator
status.item "Quit", :on_action => proc { @app.terminate self }
end end
end end


# file/new def new_window
def on_new(menu)
window :size => [400,150], :center => true, :title => "New Status", :view => :layout, window :size => [400,150], :center => true, :title => "New Status", :view => :layout,
:style => [:titled, :closable, :textured] do |win| :style => [:titled, :closable, :textured] do |win|
win.contentView.margin = 0 win.contentView.margin = 0
Expand Down Expand Up @@ -43,17 +60,6 @@ def on_new(menu)
end end
end end
end end

# xtt/preferences
def on_preferences(menu)
window :frame => [100, 100, 100, 100], :title => "Preferences" do |win|
win << label(:text => "Prefs window!")
end
end

# This is commented out, so the minimize menu item is disabled
def on_minimize(menu)
end
end end


Xtt.new.start Xtt.new.start
26 changes: 0 additions & 26 deletions lib/menu.rb

This file was deleted.

0 comments on commit d2be798

Please sign in to comment.