Sha256: 795653fc957f66b454c2fd5569b46147bbd44cfbfd6174c87987cc0cd4ce17da

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require File.dirname(__FILE__) + "/../../command_handler"
require File.dirname(__FILE__) + "/../g_shell"
require File.dirname(__FILE__) + "/../g_tab_item_composite"

module Glimmer
  module SWT
    module CommandHandlers
      class TabItemCommandHandler
        include CommandHandler
        include Glimmer

        include_package 'org.eclipse.swt.widgets'

        def can_handle?(parent, command_symbol, *args, &block)
          initial_condition = (parent.is_a?(GWidget) || parent.is_a?(CustomWidget)) &&
            command_symbol.to_s == "tab_item"
          if initial_condition
            if parent.widget.is_a?(TabFolder)
              return true
            else
              Glimmer.logger.error "tab_item widget may only be used directly under a tab_folder widget!"
            end
          end
          false
        end

        def do_handle(parent, command_symbol, *args, &block)
          tab_item = GWidget.new(command_symbol.to_s, parent.widget, args)
          GTabItemComposite.new(tab_item, parent.widget, args)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glimmer-0.4.9 lib/glimmer/swt/command_handlers/tab_item_command_handler.rb
glimmer-0.4.8 lib/glimmer/swt/command_handlers/tab_item_command_handler.rb
glimmer-0.4.7 lib/glimmer/swt/command_handlers/tab_item_command_handler.rb