Module: Gtk::InternalHashModule
- Included in:
- BaseModule, GenerateGtkPrototype
- Defined in:
- lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb
Overview
Gtk::InternalHashModule
Instance Method Summary collapse
-
#clear_the_internal_hash ⇒ Object
# === clear_the_internal_hash ========================================================================= #.
-
#commandline_arguments? ⇒ Boolean
# === commandline_arguments? ========================================================================= #.
-
#first_argument? ⇒ Boolean
(also: #first_commandline_argument?, #first?)
# === first_argument?.
-
#height?(i = ) ⇒ Boolean
# === height? ========================================================================= #.
-
#infer_the_namespace ⇒ Object
# === infer_the_namespace.
-
#internal_hash? ⇒ Boolean
(also: #ihash?, #main_hash?, #hash?)
# === internal_hash?.
-
#my_title? ⇒ Boolean
(also: #title?, #title, #internal_title?)
# === my_title? ========================================================================= #.
-
#namespace? ⇒ Boolean
# === namespace? ========================================================================= #.
-
#parent_widget? ⇒ Boolean
# === parent_widget? ========================================================================= #.
-
#reset_the_internal_hash ⇒ Object
(also: #initialize_the_internal_hash)
# === reset_the_internal_hash ========================================================================= #.
-
#set_commandline_arguments(i) ⇒ Object
# === set_commandline_arguments ========================================================================= #.
-
#set_height(i) ⇒ Object
(also: #height=)
# === set_height.
-
#set_my_title(i = nil) ⇒ Object
(also: #set_internal_title, #name=, #fancy_title)
# === set_my_title.
-
#set_parent_widget(i) ⇒ Object
# === set_parent_widget ========================================================================= #.
-
#set_width(i = DEFAULT_WIDTH) ⇒ Object
(also: #width=)
# === set_width.
-
#width?(i = ) ⇒ Boolean
# === width? ========================================================================= #.
Instance Method Details
#clear_the_internal_hash ⇒ Object
#
clear_the_internal_hash
#
100 101 102 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 100 def clear_the_internal_hash @internal_hash.clear if @internal_hash end |
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
#
71 72 73 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 71 def commandline_arguments? @internal_hash[:commandline_arguments] end |
#first_argument? ⇒ Boolean Also known as: first_commandline_argument?, first?
#
first_argument?
This method can be used to return the first argument from the ARGV array passed in.
#
81 82 83 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 81 def first_argument? @internal_hash[:commandline_arguments].first end |
#height?(i = ) ⇒ Boolean
#
height?
#
189 190 191 192 193 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 189 def height?( i = @internal_hash[:height] ) i end |
#infer_the_namespace ⇒ Object
#
infer_the_namespace
This will assume the true namespace from the inspectable name.
#
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 21 def infer_the_namespace _ = inspect.to_s.delete('<') if _.include? ' ' _ = _.split(' ').first.delete('#') if _.include? ':' _ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::') end end @internal_hash[:namespace] = _ # And assign it here. return _ # And return it explicitely as well. end |
#internal_hash? ⇒ Boolean Also known as: ihash?, main_hash?, hash?
#
internal_hash?
Query-method to obtain @internal_hash.
#
91 92 93 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 91 def internal_hash? @internal_hash end |
#my_title? ⇒ Boolean Also known as: title?, title, internal_title?
#
my_title?
#
121 122 123 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 121 def my_title? @internal_hash[:title] end |
#namespace? ⇒ Boolean
#
namespace?
#
36 37 38 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 36 def namespace? @internal_hash[:namespace] end |
#parent_widget? ⇒ Boolean
#
parent_widget?
#
114 115 116 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 114 def @internal_hash[:parent_widget] end |
#reset_the_internal_hash ⇒ Object Also known as: initialize_the_internal_hash
#
reset_the_internal_hash
#
198 199 200 201 202 203 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 198 def reset_the_internal_hash # ======================================================================= # # === @internal_hash # ======================================================================= # @internal_hash = {} end |
#set_commandline_arguments(i) ⇒ Object
#
set_commandline_arguments
#
64 65 66 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 64 def set_commandline_arguments(i) @internal_hash[:commandline_arguments] = [i].flatten.compact end |
#set_height(i) ⇒ Object Also known as: height=
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 160 def set_height(i) if i if i.is_a? String and i.include? '%' require 'gtk_paradise/toplevel_methods/screen_resolution.rb' # For Gtk.max_width? # ===================================================================== # # Handle something like '80%' next. # ===================================================================== # i = i.to_f # This is percentage. i = (::Gtk.max_height? * i) / 100.0 end if i.respond_to? :to_i i = i.to_i @internal_hash[:height] = i end end end |
#set_my_title(i = nil) ⇒ Object Also known as: set_internal_title, name=, fancy_title
#
set_my_title
Use this method to set the title. This method is not allowed to make any additional calls - that is, no other methods may be called from within this method.
The title will only be set if it is not nil.
#
49 50 51 52 53 54 55 56 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 49 def set_my_title( i = nil ) if i i = __FILE__ if i == '__FILE__' @internal_hash[:title] = i.to_s end end |
#set_parent_widget(i) ⇒ Object
#
set_parent_widget
#
107 108 109 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 107 def (i) @internal_hash[:parent_widget] = i end |
#set_width(i = DEFAULT_WIDTH) ⇒ Object Also known as: width=
#
set_width
Use only this method when setting the @internal_hash variable.
If we pass in a string that also includes a ‘%’ character then we assume that the user wishes to use a percentage value derived from whatever Gdk::Screen.default returns.
#
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 136 def set_width(i = DEFAULT_WIDTH) if i # ===================================================================== # # === Handle percentage values given to this method next # # These must be a String, and must include a '%' - otherwise it will # not be handled in this method. # ===================================================================== # if i.is_a? String and i.include? '%' require 'gtk_paradise/toplevel_methods/screen_resolution.rb' # For Gtk.max_width? i = i.to_f # This is percentage. i = (::Gtk.max_width? * i) / 100 end i = i.first if i.is_a? Array i = i.to_i @internal_hash[:width] = i end end |
#width?(i = ) ⇒ Boolean
#
width?
#
180 181 182 183 184 |
# File 'lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb', line 180 def width?( i = @internal_hash[:width] ) i end |