Class: GamesAndRpgParadise::GUI::Gtk::XmasGifts

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

Overview

GamesAndRpgParadise::GUI::Gtk::XmasGifts

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'Xmas Gifts'
HEIGHT =
#

HEIGHT

#
800
WIDTH =
#

WIDTH

#
800
ARRAY_BUTTONS =
#

ARRAY_BUTTONS

#
[]

Instance Method Summary collapse

Constructor Details

#initialize(run_already = true) ⇒ XmasGifts

#

initialize

#


52
53
54
55
56
57
58
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 52

def initialize(
    run_already = true
  )
  super()
  reset
  run if run_already
end

Instance Method Details

#connect_skeletonObject

#

connect_skeleton

#


136
137
138
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 136

def connect_skeleton
  add(@frame)
end

#create_buttonsObject

#

create_buttons

#


110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 110

def create_buttons
  @x_position = 1
  @y_position = 1
  # ======================================================================= #
  # 25 times because, well: 25 days before xmas. :)
  # ======================================================================= #
  counter_n_times = 0
  25.times { |button|
    counter_n_times += 1
    button = GiftButton.new(button.to_s)
    ARRAY_BUTTONS << button
    @x_position += (Gtk::GiftButton::DEFAULT_WIDTH+3)
    if ((counter_n_times % 5) == 0)
      @x_position = 0 # Reset the x-position again.
      @y_position += (Gtk::GiftButton::DEFAULT_WIDTH+3)
    end
    # ===================================================================== #
    # Next place it somewhere on the grid.
    # ===================================================================== #
    @fixed.put(button, @x_position, @y_position)
  }
end

#create_frameObject

#

create_frame

The gtk-frame in use here is the main “background” widget for this application.

#


95
96
97
98
99
100
101
102
103
104
105
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 95

def create_frame
  @frame = gtk_frame
  widget = gtk_label
  widget.set_markup(
    '<span weight="bold" size="xx-large" foreground="darkblue"> '+
    TITLE+
    ' </span>'
  )
  @frame.label_widget = widget
  @frame << @fixed
end

#create_skeletonObject

#

create_skeleton

#


83
84
85
86
87
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 83

def create_skeleton
  @fixed = gtk_fixed
  create_buttons
  create_frame
end

#favicon?Boolean

#

favicon?

#

Returns:

  • (Boolean)


157
158
159
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 157

def favicon?
  '/home/x/data/images/games/XMAS/XMAS_FAVICON.png'
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


143
144
145
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 143

def padding?
  8
end

#resetObject

#

reset

#


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 63

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  # ======================================================================= #
  # === @height
  # ======================================================================= #
  set_height(HEIGHT)
  # ======================================================================= #
  # === @width
  # ======================================================================= #
  set_width(WIDTH)
  increase_font_size
end

#runObject

#

run

#


164
165
166
167
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 164

def run
  create_skeleton
  connect_skeleton
end

#title?Boolean

#

title?

#

Returns:

  • (Boolean)


150
151
152
# File 'lib/games_and_rpg_paradise/gui/gtk2/xmas_gifts/xmas_gifts.rb', line 150

def title?
  TITLE
end