-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #736 from KCErb/oval_style
Update Arc and Oval to use Style module First step in a larger conversion of all styled DSL objects
- Loading branch information
Showing
12 changed files
with
96 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
class Shoes | ||
class Oval | ||
include CommonMethods | ||
include Common::Fill | ||
include Common::Stroke | ||
include Common::Style | ||
include Common::Clickable | ||
include DimensionsDelegations | ||
|
||
attr_reader :app, :dimensions, :angle, :gui, :parent | ||
attr_reader :app, :dimensions, :parent, :gui | ||
style_with :art_styles, :center, :radius | ||
|
||
def initialize(app, parent, left, top, width, height, opts = {}, &blk) | ||
def initialize(app, parent, left, top, width, height, styles = {}, &blk) | ||
@app = app | ||
@dimensions = AbsoluteDimensions.new left, top, width, height, opts | ||
@style = Shoes::Common::Fill::DEFAULTS.merge( | ||
Shoes::Common::Stroke::DEFAULTS).merge(opts) | ||
@style[:strokewidth] ||= 1 | ||
@angle = opts[:angle] | ||
@dimensions = AbsoluteDimensions.new left, top, width, height, styles | ||
@parent = parent | ||
|
||
|
||
style_init(styles) | ||
@parent.add_child self | ||
|
||
@gui = Shoes.backend_for(self, &blk) | ||
|
||
clickable_options(opts) | ||
clickable_options(styles) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
require 'spec_helper' | ||
|
||
def it_styles_with(*styles) | ||
supported_styles = unpack_styles(styles) | ||
spec_styles(supported_styles) | ||
end | ||
|
||
def unpack_styles(styles) | ||
supported_styles = [] | ||
styles.each do |style| | ||
if Shoes::Common::Style::STYLE_GROUPS[style] | ||
Shoes::Common::Style::STYLE_GROUPS[style].each{|style| supported_styles << style} | ||
else | ||
supported_styles << style | ||
end | ||
end | ||
supported_styles | ||
end | ||
|
||
def spec_styles(supported_styles) | ||
supported_styles.each do |style| | ||
it_behaves_like "object that styles with #{style}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters