Class: GamesAndRpgParadise::GUI::Gtk::GiftButton

Inherits:
Gtk::ToggleButton
  • Object
show all
Includes:
Gtk::BaseModule
Defined in:
lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/gift_button.rb

Overview

GamesAndRpgParadise::GUI::Gtk::GiftButton

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
DEFAULT_IMAGE_FILE =
#

DEFAULT_IMAGE_FILE

#
'/home/x/data/images/STD/TURM.png'
DEFAULT_WIDTH =
#

DEFAULT_WIDTH

#
55
DEFAULT_HEIGHT =
#

DEFAULT_HEIGHT

#
55

Instance Method Summary collapse

Constructor Details

#initialize(optional_text = '') ⇒ GiftButton

#

initialize

#


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/gift_button.rb', line 47

def initialize(optional_text = '')
  super(optional_text)
  reset
  @active = false
  set_size_request(DEFAULT_WIDTH, DEFAULT_HEIGHT)
  image = gtk_image(@image_location)
  set_image(image)

  # ======================================================================= #
  # once clicked, we can not "unclick" it again.
  # ======================================================================= #
  on_toggled { |w|
    if active?
      set_image(
        gtk_image(DEFAULT_IMAGE_FILE)
      )
      # We also must re-set the label to ''.
      set_text('')
    else
      set_active(true)
    end 
  }
end

Instance Method Details

#resetObject

#

reset

#


74
75
76
77
78
79
80
81
82
83
84
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/gift_button.rb', line 74

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  # ======================================================================= #
  # === @image_location
  # ======================================================================= #
  @image_location = '/home/x/data/images/STD/UHR.png'
end