Sha256: 82092bbb8c6230cc82f0c608a705964a289a484daccc80f38a324bdb8360fe7c

Contents?: true

Size: 1.92 KB

Versions: 56

Compression:

Stored size: 1.92 KB

Contents

# Copyright (C) 2014  Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

module Gtk
  class Label
    alias_method :initialize_raw, :initialize
    def initialize(text=nil, options={})
      if options == true or options == false or options.nil?
        mnemonic = options
        warn "Gtk::Label.new(text, mnemonic) style has been deprecated. " +
             "Use Gtk::Label.new(text, {:use_underline => #{mnemonic}}) style instead."
        options = {
          :use_underline => mnemonic,
        }
      end
      if options[:use_underline]
        initialize_new_with_mnemonic(text)
      else
        initialize_raw(text || "")
      end
    end

    private :set_markup_with_mnemonic
    alias_method :set_markup_raw, :set_markup
    def set_markup(text, options={})
      if options == true or options == false or options.nil?
        mnemonic = options
        warn "Gtk::Label#set_markup(text, mnemonic) style has been deprecated. " +
             "Use Gtk::Label#set_markup(text, {:use_underline => #{mnemonic}}) style instead."
        options = {
          :use_underline => mnemonic,
        }
      end
      if options[:use_underline]
        set_markup_with_mnemonic(text)
      else
        set_markup_raw(text)
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 2 rubygems

Version Path
gtk4-4.2.5 lib/gtk4/label.rb
gtk3-4.2.5 lib/gtk3/label.rb
gtk4-4.2.4 lib/gtk4/label.rb
gtk3-4.2.4 lib/gtk3/label.rb
gtk4-4.2.3 lib/gtk4/label.rb
gtk3-4.2.3 lib/gtk3/label.rb
gtk4-4.2.2 lib/gtk4/label.rb
gtk3-4.2.2 lib/gtk3/label.rb
gtk4-4.2.1 lib/gtk4/label.rb
gtk3-4.2.1 lib/gtk3/label.rb
gtk4-4.2.0 lib/gtk4/label.rb
gtk3-4.2.0 lib/gtk3/label.rb
gtk4-4.1.9 lib/gtk4/label.rb
gtk3-4.1.9 lib/gtk3/label.rb
gtk4-4.1.8 lib/gtk4/label.rb
gtk3-4.1.8 lib/gtk3/label.rb
gtk4-4.1.7 lib/gtk4/label.rb
gtk3-4.1.7 lib/gtk3/label.rb
gtk4-4.1.6 lib/gtk4/label.rb
gtk3-4.1.6 lib/gtk3/label.rb