Sha256: b91c7f78d8d497b1598979337d5f616eff40cd8b5b5c871d178ed0e636d6207e

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

# encoding: ascii-8bit

# Copyright 2014 Ball Aerospace & Technologies Corp.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt

require 'cosmos/tools/tlm_viewer/widgets/widget'

module Cosmos
  # Create a combobox. Typically used as a NAMED_WIDGET which is then
  # referenced by a BUTTON to perform an action. For example:
  #   NAMED_WIDGET COLLECT_TYPE COMBOBOX NORMAL SPECIAL
  #   BUTTON 'Start Collect' 'cmd("INST COLLECT with TYPE #{get_named_widget("COLLECT_TYPE").text}")'
  class ComboboxWidget < Qt::ComboBox
    include Widget

    def initialize(parent_layout, *combobox_items)
      super()
      addItems(combobox_items)
      self.maxVisibleItems = combobox_items.length > 6 ? 6 : combobox_items.length
      parent_layout.addWidget(self) if parent_layout
    end

    def text
      self.currentText
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cosmos-4.5.2-java lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.5.2 lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.5.1-java lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.5.1 lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.5.0-java lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.5.0 lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.4.2-java lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.4.2 lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.4.1-java lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.4.1 lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.4.0-java lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb
cosmos-4.4.0 lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb