Sha256: b5515bdbfd0f533762f0de0f0462ec55a7c69ef572721ae67ecb08bb6d98f3ca

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

require 'fox12'

module Fox
  class FXApp

    alias addChoreOrig addChore # :nodoc:

    #
    # Add a idle processing message to be sent to a target object when
    # the system becomes idle, i.e. when there are no more events to be processed.
    # There are several forms for #addChore; the original form (from FOX)
    # takes two arguments, a target object and a message identifier:
    #
    #   anApp.addChore(anObject, aMessageId)
    #
    # A second form takes a Method instance as its single argument:
    #
    #   anApp.addChore(aMethod)
    #
    # For this form, the method should have the standard argument list
    # for a FOX message handler. That is, the method should take three
    # arguments, for the message _sender_ (an FXObject), the message _selector_,
    # and the message _data_ (if any).
    #
    # The last form takes a block:
    #
    #   anApp.addChore() { |sender, sel, data|
    #     ... handle the chore ...
    #   }
    #
    # All of these return a reference to an opaque FXChore instance that
    # can be passed to #removeChore if it is necessary to remove the chore
    # before it fires.
    #
    def addChore(*args, &block)
      tgt, sel = nil, 0
      if args.length > 0
        if args[0].respond_to? :call
          tgt = FXPseudoTarget.new
	  tgt.pconnect(SEL_CHORE, args[0], block)
        else
	  tgt, sel = args[0], args[1]
        end
      else
        tgt = FXPseudoTarget.new
	tgt.pconnect(SEL_CHORE, nil, block)
      end
      addChoreOrig(tgt, sel)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fxruby-1.2.3 lib/fox12/chore.rb
fxruby-1.2.2 lib/fox12/chore.rb
fxruby-1.2.4 lib/fox12/chore.rb
fxruby-1.2.5 lib/fox12/chore.rb
fxruby-1.2.6 lib/fox12/chore.rb