Sha256: aea292e868812927a815c7fbaf66d61fe0c20b2d10536859edc0cf69b80f29ce

Contents?: true

Size: 1.92 KB

Versions: 13

Compression:

Stored size: 1.92 KB

Contents

# Copyright (c) 2020-2021 Andy Maleh
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

require 'glimmer/swt/widget_proxy'
require 'glimmer/swt/combo_proxy'

module Glimmer
  module SWT
    class CComboProxy < ComboProxy
      def post_add_content
        `$(#{path}).selectmenu()`
        c_combo_dom_element.css('width', 'initial')
      end
      
      def font=(value)
        @font = value.is_a?(FontProxy) ? value : FontProxy.new(self, value)
        c_combo_dom_element.css('font-family', @font.name) unless @font.nil?
        c_combo_dom_element.css('font-style', 'italic') if @font&.style == :italic
        c_combo_dom_element.css('font-weight', 'bold') if @font&.style == :bold
        c_combo_dom_element.css('font-size', "#{@font.height}px") unless @font.nil?
      end
      
      def c_combo_path
        "##{id}-button"
      end
      
      def c_combo_dom_element
        Document.find(c_combo_path)
      end
    end
  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
glimmer-dsl-opal-0.25.2 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.25.1 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.25.0 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.24.0 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.23.0 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.22.1 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.22.0 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.21.0 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.20.1 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.20.0 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.19.1 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.19.0 lib/glimmer/swt/c_combo_proxy.rb
glimmer-dsl-opal-0.18.0 lib/glimmer/swt/c_combo_proxy.rb