Sha256: 0ab79ec88a61e58a8d45b90ea643195dd3000abf29c578a13440b9e7a8b3cb91

Contents?: true

Size: 1.32 KB

Versions: 37

Compression:

Stored size: 1.32 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'
require 'cosmos/gui/choosers/value_chooser'

module Cosmos
  # Widget which creates a horizontally laid out label and editable string value.
  # A callback can be specified which is called once the value is changed.
  class StringChooser < ValueChooser
    # @param parent (see ValueChooser#initialize)
    # @param label_text (see ValueChooser#initialize)
    # @param initial_value (see ValueChooser#initialize)
    # @param field_width (see ValueChooser#initialize)
    # @param fill (see ValueChooser#initialize)
    # @param read_only [Boolean] Whether the string is editable
    # @param alignment [Integer] The alignment of the string value field
    def initialize(
      parent, label_text, initial_value,
      field_width = 20, fill = false, read_only = false,
      alignment = Qt::AlignLeft | Qt::AlignVCenter
    )
      super(parent, label_text, initial_value, field_width, fill)
      @value.setReadOnly(true) if read_only
      @value.setAlignment(alignment)
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
cosmos-4.5.2-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.5.2 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.5.1-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.5.1 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.5.0-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.5.0 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.4.2-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.4.2 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.4.1-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.4.1 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.4.0-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.4.0 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.3.0-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.3.0 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.2.4-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.2.4 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.2.3-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.2.3 lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.2.2-java lib/cosmos/gui/choosers/string_chooser.rb
cosmos-4.2.2 lib/cosmos/gui/choosers/string_chooser.rb