Skip to content

Commit

Permalink
Added BUTTON_DEFAULT hash. This is a test snippet:
Browse files Browse the repository at this point in the history
Shoes.app do
  style Shoes::Button, width: 100, height: 20
  10.times{|i| button i.to_s}
end
  • Loading branch information
ashbb committed May 18, 2012
1 parent 17edb0c commit 42a2971
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.7.166
0.7.167
5 changes: 3 additions & 2 deletions lib/purple_shoes.rb
Expand Up @@ -11,8 +11,9 @@ module Shoes
DIR = Pathname.new(__FILE__).realpath.dirname.to_s
FONTS = []
LINK_DEFAULT = {underline: true}
BANNER_DEFAULT, TITLE_DEFAULT, SUBTITLE_DEFAULT, TAGLINE_DEFAULT, CAPTION_DEFAULT, PARA_DEFAULT, INSCRIPTION_DEFAULT =
{}, {}, {}, {}, {}, {}, {}
%w[BANNER TITLE SUBTITLE TAGLINE CAPTION PARA INSCRIPTION BUTTON].each do |e|
eval "#{e}_DEFAULT = {}"
end
SHOES_VERSION = IO.read(File.join(DIR, '../VERSION')).chomp
BASIC_ATTRIBUTES_DEFAULT = {left: 0, top: 0, width: 0, height: 0, angle: 0, curve: 0}
SLOT_ATTRIBUTES_DEFAULT = {left: nil, top: nil, width: 1.0, height: 0}
Expand Down
1 change: 1 addition & 0 deletions lib/shoes/app.rb
Expand Up @@ -195,6 +195,7 @@ def imagesize name
end

def buttonbase klass, name, args, &blk
args = eval("#{klass.to_s[7..-1].upcase}_DEFAULT").merge args
args = basic_attributes args
args[:block] = blk
opt = if klass == Button then Swt::SWT::NULL
Expand Down
2 changes: 1 addition & 1 deletion lib/shoes/style.rb
@@ -1,7 +1,7 @@
class Shoes
class App
def style klass, args={}
if klass.superclass == Shoes::TextBlock or klass == Shoes::Link
if klass.superclass == Shoes::TextBlock or klass == Shoes::Link or klass == Shoes::Button
eval("#{klass.to_s[7..-1].upcase}_DEFAULT").clear.merge! args
end
end
Expand Down
4 changes: 2 additions & 2 deletions purple_shoes.gemspec
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = "purple_shoes"
s.version = "0.7.166"
s.version = "0.7.167"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["ashbb"]
s.date = "2012-05-16"
s.date = "2012-05-18"
s.description = "Purple Shoes is one of colorful Shoes, written in JRuby and SWT."
s.email = "ashbbb@gmail.com"
s.executables = ["pshoes"]
Expand Down

0 comments on commit 42a2971

Please sign in to comment.