Sha256: 812caa03e0b98637a02e4e1f87c2b286de6ca4932bd724ffc30ba006b2ee2a23

Contents?: true

Size: 1.59 KB

Versions: 41

Compression:

Stored size: 1.59 KB

Contents

require File.expand_path("../vtab_label", __FILE__)

module Swt
  module Widgets
    class VTabItem
      attr_accessor :text, :control
      attr_reader :parent

      def initialize(parent, style)
        @parent = parent
        @parent.add_item(self)
      end

      def text= title
        @text = title
        @label.title = title
      end

      def control= control
        @control = control
        @control.visible = active?
        @control.layout_data = Swt::Layout::GridData.new.tap do |l|
          l.horizontalAlignment = Swt::Layout::GridData::FILL
          l.verticalAlignment = Swt::Layout::GridData::FILL
          l.grabExcessHorizontalSpace = true
          l.grabExcessVerticalSpace = true
          l.exclude = active?
        end
      end

      def draw_label(tab_area)
        @label = VTabLabel.new(self, tab_area, Swt::SWT::NONE)
      end

      # This way up to the parent
      def activate
        @parent.selection = self
      end

      def active= boolean
        @label.active = boolean
        if @control
          @control.visible = boolean
          @control.layout_data.exclude = !boolean
        end
      end

      def active?
        @label.active
      end

      def selection_color_options
        @parent.selection_color_options
      end

      def font= swt_font
        @label.font = swt_font
      end

      def font
        @label.font
      end

      def show_close= bool
        @label.show_close = bool
      end

      def show_close
        @label.show_close
      end

      def dispose
        @control.dispose
        @label.dispose
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
redcar-0.13 plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.13.5dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.13.4dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.13.3dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.13.2dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.13.1dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-0.12.1 plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.13.0dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-0.12 plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.27dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.26dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.25dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.24dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.23dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.22dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.21dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.20dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.19dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.18dev plugins/application_swt/lib/swt/vtab_item.rb
redcar-dev-0.12.17dev plugins/application_swt/lib/swt/vtab_item.rb