Module: GamesAndRpgParadise::GUI::Gtk::Minesweeper::SmileyFaceModule
- Includes:
- Gtk::BaseModule
- Included in:
- SmileyFace
- Defined in:
- lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb
Constant Summary collapse
- NAMESPACE =
#
NAMESPACE
#
inspect
- TITLE =
#
TITLE
#
'Minesweeper - Smiley Face Module'
- WIDTH =
#
WIDTH
#
120
- HEIGHT =
#
HEIGHT
#
100
Class Method Summary collapse
-
.run ⇒ Object
# === GamesAndRpgParadise::GUI::Gtk::Minesweeper::SmileyFaceModule.run ========================================================================= #.
Instance Method Summary collapse
-
#border_size? ⇒ Boolean
# === border_size? ========================================================================= #.
-
#initialize(master_widget) ⇒ Object
# === initialize ========================================================================= #.
-
#padding? ⇒ Boolean
# === padding? ========================================================================= #.
-
#register_signals ⇒ Object
# === register_signals.
-
#reset ⇒ Object
# === reset ========================================================================= #.
-
#return_tooltip_string ⇒ Object
# === return_tooltip_string ========================================================================= #.
-
#set_happy_image ⇒ Object
# === set_happy_image ========================================================================= #.
-
#set_unhappy_image(i = ::GamesAndRpgParadise::Minesweeper::SAD_SMILEY_FACE) ⇒ Object
# === set_unhappy_image ========================================================================= #.
Class Method Details
.run ⇒ Object
#
GamesAndRpgParadise::GUI::Gtk::Minesweeper::SmileyFaceModule.run
#
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 138 def self.run require 'gtk_paradise/run' _ = ::GamesAndRpgParadise::GUI::Gtk::Minesweeper::SmileyFaceModule.new r = ::Gtk.run r << _ r.set_size_request( _.width?, _.height? ) r.automatic_title r.top_left_then_run end |
Instance Method Details
#border_size? ⇒ Boolean
#
border_size?
#
86 87 88 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 86 def border_size? 2 end |
#initialize(master_widget) ⇒ Object
#
initialize
#
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 48 def initialize() super() @master_widget = self.can_focus = false self.fancy_tooltips = return_tooltip_string set_size_request( ::GamesAndRpgParadise::Minesweeper::BUTTON_BASE_DIMENSION, ::GamesAndRpgParadise::Minesweeper::BUTTON_BASE_DIMENSION ) reset end |
#padding? ⇒ Boolean
#
padding?
#
79 80 81 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 79 def padding? 2 end |
#register_signals ⇒ Object
#
register_signals
Register signals
#
122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 122 def register_signals on_clicked { @master_widget.restart_game } { |, event| case event.event_type when Gdk::EventType::BUTTON_PRESS # normal mouse button case event. when 2 # middle mouse button @master_widget.reveal_all end end } end |
#reset ⇒ Object
#
reset
#
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 63 def reset reset_the_internal_variables register_signals set_happy_image set_use_this_font(:dejavu_condensed_25) # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, NAMESPACE] title_width_height(TITLE, WIDTH, HEIGHT) use_project_css_file end |
#return_tooltip_string ⇒ Object
#
return_tooltip_string
#
93 94 95 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 93 def return_tooltip_string 'To <b>restart</b> the game you can also click <b>ALT+R</b>.' end |
#set_happy_image ⇒ Object
#
set_happy_image
#
100 101 102 103 104 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 100 def set_happy_image set_image( gtk_image(::GamesAndRpgParadise::Minesweeper::HAPPY_SMILEY_FACE) ) end |
#set_unhappy_image(i = ::GamesAndRpgParadise::Minesweeper::SAD_SMILEY_FACE) ⇒ Object
#
set_unhappy_image
#
109 110 111 112 113 114 115 |
# File 'lib/games_and_rpg_paradise/gui/shared_code/minesweeper/smiley_face_module.rb', line 109 def set_unhappy_image( i = ::GamesAndRpgParadise::Minesweeper::SAD_SMILEY_FACE ) set_image( gtk_image(i) ) end |