Sha256: fba691f9bf74d581818674f9e0ffe3079d000964e138835e22a537ab5dd9dedc

Contents?: true

Size: 1.32 KB

Versions: 34

Compression:

Stored size: 1.32 KB

Contents

module Rabbit
  module Renderer
    module Display
      module HookHandler
        def initialize(*args, &block)
          super
          init_hook_handler
        end

        def call_hook_procs(procs, *args)
          procs.any? {|proc| proc.call(*args)}
        end

        def add_motion_notify_hook(hook=Proc.new)
          @motion_notify_hook_procs << hook
        end

        def clear_motion_notify_hook
          @motion_notify_hook_procs.clear
        end

        def add_scroll_hook(hook=Proc.new)
          @scroll_hook_procs << hook
        end

        def clear_scroll_hook
          @scroll_hook_procs.clear
        end

        def add_button_press_hook(hook=Proc.new)
          @button_press_hook_procs << hook
        end

        def clear_button_press_hook
          @button_press_hook_procs.clear
        end

        def add_button_release_hook(hook=Proc.new)
          @button_release_hook_procs << hook
        end

        def clear_button_release_hook
          @button_release_hook_procs.clear
        end

        def clear_hooks
          init_hook_handler
        end

        private
        def init_hook_handler
          @motion_notify_hook_procs = []
          @scroll_hook_procs = []
          @button_press_hook_procs = []
          @button_release_hook_procs = []
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
rabbit-2.2.1 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.2.0 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.9 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.8 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.7 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.6 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.5 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.4 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.3 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.2 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.1 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.1.0 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.9 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.8 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.7 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.6 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.5 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.4 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.3 lib/rabbit/renderer/display/hook-handler.rb
rabbit-2.0.2 lib/rabbit/renderer/display/hook-handler.rb