Anvil just announced its conception onto rubyforge yesterday as plans are being set to organize how the new gem is going to be created. The gem is going to be a framework that wraps around the Wx::Ruby project in a way that is more concise and ruby-esk. The concepts are inspired by ruby on rails and Shoes (a project for allowing you to create little applications that act like web browsers). Here is a sample of the some of the code from the sample application called Hammer, a ruby/anvil-based text editor included in the applications folder of the repository:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
anvil "Hammer" do |app|
app.frame "Hammer", "Hammer", :maximize => true do |frame|
# Create Menu Bar
frame.menu_bar do |menu_bar|
# File Menu
menu_bar.menu "&File" do |item|
item.add(:new)
item.add(:open)
item.separator
item.add(:save)
item.separator
item.add(:preview)
item.add(:print)
item.separator
item.add(:close)
item.add(:quit)
end
# Edit Menu
menu_bar.menu "&Edit" do |item|
item.add(:undo)
item.add(:redo)
item.separator
item.add(:cut)
item.add(:copy)
item.add(:paste)
item.add(:delete)
item.separator
item.add(:selectall)
item.separator
item.add(:preferences)
end
# Search Menu
menu_bar.menu "&Search" do |item|
item.add(:find)
item.add(:replace)
end
# Help Menu
menu_bar.menu "&Help" do |item|
item.add(:about)
end
end
frame.text_control :size => { :width => 100, :height => 200 }
frame.create_status_bar(2)
frame.set_status_text("Hammer World!", 0)
end
end
|
The project is in need of talented and eager individuals to help it get off of its feet. If you are interested in contributing,
check it out!