Skip to content

Instantly share code, notes, and snippets.

@davorb
Created August 9, 2012 01:01
Show Gist options
  • Save davorb/3300115 to your computer and use it in GitHub Desktop.
Save davorb/3300115 to your computer and use it in GitHub Desktop.
def paintControl(paint_event)
gc = paint_event.gc
gcs_reset gc
@dsl.width = @dsl.opts[:width] ? @dsl.opts[:width] : @parent.width
@dsl.height = @dsl.opts[:height] ? @dsl.opts[:height] : @parent.height
sw = @dsl.strokewidth
gc.setForeground (@dsl.color.to_native)
gc.setLineWidth sw
gc.drawRoundRectangle(@parent.left+sw/2, @parent.top+sw/2,
@dsl.width-sw, @dsl.height-sw, @dsl.curve*2, @dsl.curve*2)
puts "dsl-opts:\t #{@dsl.opts[:width].class}, #{@dsl.opts[:height].class}"
puts "parent (w,h):\t #{@parent.width}, #{@parent.height}"
puts "dsl (w,h):\t #{@dsl.width}, #{@dsl.height}"
puts "dsl (top,left):\t #{@parent.top}, #{@parent.left}"
puts "dsl-sw:\t\t #{@dsl.strokewidth}"
puts "values:\t\t #{@parent.left+sw/2}, #{@parent.top+sw}, #{@dsl.width-sw}, #{@dsl.height-sw}, #{@dsl.curve*2}, #{@dsl.curve*2}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment