lib/shoes/swt/redrawing_aspect.rb in shoes-swt-4.0.0.pre12 vs lib/shoes/swt/redrawing_aspect.rb in shoes-swt-4.0.0.rc1

- old
+ new

@@ -1,6 +1,7 @@ # frozen_string_literal: true + # This file uses the after_do gem, which you probably haven't heard of (yet) # It basically works like Class.after :method do ... end # So for every instance of Class, after method is executed the block you # gave it is executed. # Here it is used to redraw the application, after specific methods are called. @@ -20,22 +21,25 @@ Keypress => [:eval_block], Keyrelease => [:eval_block], MouseMoveListener => [:eval_move_block], TextBlock::CursorPainter => [:move_textcursor], Timer => [:eval_block], - ::Shoes::Common::Changeable => [:call_change_listeners] + Slot => [:update_scroll], + ::Shoes::Common::Changeable => [:call_change_listeners], }.freeze # These need to trigger a redraw - SAME_POSITION = { Common::Visibility => [:update_visibility], - Image => [:create_image], - ::Shoes::Common::Hover => [:eval_hover_block], - ::Shoes::Common::Style => [:update_style], - ::Shoes::Common::Remove => [:remove], - ::Shoes::Slot => [:mouse_hovered, - :mouse_left], - ::Shoes::TextBlock => [:replace] }.freeze + SAME_POSITION = + { + Common::Visibility => [:update_visibility], + Image => [:create_image], + ::Shoes::Common::Hover => [:eval_hover_block], + ::Shoes::Common::Style => [:update_style], + ::Shoes::Common::Remove => [:remove], + ::Shoes::Slot => [:mouse_hovered, :mouse_left], + ::Shoes::TextBlock => [:replace], + }.freeze CHANGED_POSITION = { ::Shoes::DimensionsDelegations => [:adjust_current_position], ::Shoes::Common::Positioning => [:_position, :displace], ::Shoes::Common::Hover => [:eval_hover_block] }.freeze @@ -83,12 +87,12 @@ app.flush unless app.disposed? end def redraw_element(element, include_children = true) target = redraw_target(element) - redraw_area target.element_left, target.element_top, - target.element_width, target.element_height, + redraw_area target.redraw_left, target.redraw_top, + target.redraw_width, target.redraw_height, include_children end def redraw_area(left, top, width, height, include_children = true) unless app.disposed? @@ -96,10 +100,10 @@ end end def redraw_target(element) # During DSL initialization element.gui is nil, so if a SWT backend - # object causes a redraw in its initailize (like Shoes::Swt::Image), + # object causes a redraw in its initialize (like Shoes::Swt::Image), # we won't have gui set yet. Annoying, but fine. if element.gui element.gui.redraw_target else element