Class: GGLib::Themes::WindowsTheme

Inherits:
ImageTheme show all
Defined in:
lib/ext/themes.rb

Constant Summary collapse

@@button =
nil

Instance Attribute Summary

Attributes inherited from ImageTheme

#font, #height, #image, #width

Attributes inherited from GGLib::Theme

#name

Instance Method Summary collapse

Methods inherited from ImageTheme

#newInstance

Methods inherited from GGLib::Theme

#height, #setDefaultState, #setDownState, #setOverState, #width

Constructor Details

#initializeWindowsTheme

Returns a new instance of WindowsTheme.



125
126
127
128
129
# File 'lib/ext/themes.rb', line 125

def initialize
  image = ThemeImageGroup.new( $gglroot+"/media/windows/generic/menusmall.png", $gglroot+"/media/bluesteel/generic/menusmall.png", $gglroot+"/media/bluesteel/generic/menusmall.png" )
  font = ThemeFontGroup.new( Gosu::Font.new($window, Gosu::default_font_name, 17), Gosu::Font.new($window, Gosu::default_font_name, 25), Gosu::Font.new($window, Gosu::default_font_name, 20))
  super("Windows.Generic", font, image)
end

Instance Method Details

#request(obj) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/ext/themes.rb', line 130

def request(obj)
  if @@button == nil #Can't initialize atglobal scope because $window may not have been set
    @@button = ImageTheme.new("Windows.Button", ThemeFontGroup.new( Gosu::Font.new($window, Gosu::default_font_name, 17), Gosu::Font.new($window, Gosu::default_font_name, 25), Gosu::Font.new($window, Gosu::default_font_name, 20)), ThemeImageGroup.new( $gglroot+"/media/windows/button/button.png", $gglroot+"/media/windows/button/buttonup.png" , $gglroot+"/media/windows/button/buttondown.png" ))
    @@textbox = ImageTheme.new("Windows.TextBox", ThemeFontGroup.new( Gosu::Font.new($window, Gosu::default_font_name, 17), Gosu::Font.new($window, Gosu::default_font_name, 25), Gosu::Font.new($window, Gosu::default_font_name, 20)), ThemeImageGroup.new( $gglroot+"/media/windows/textbox/textbox.png", $gglroot+"/media/windows/textbox/textboxup.png" , $gglroot+"/media/windows/textbox/textboxup.png" ))
    @@label = ImageTheme.new("Windows.Label", ThemeFontGroup.new( Gosu::Font.new($window, Gosu::default_font_name, 17), Gosu::Font.new($window, Gosu::default_font_name, 25), Gosu::Font.new($window, Gosu::default_font_name, 20)), ThemeImageGroup.new( $gglroot+"/null.png", $gglroot+"/null.png" , $gglroot+"/null.png" ) )
  end
  if obj.kind_of?(Button)
    return @@button
  elsif obj.kind_of?(TextBox)
    return @@textbox
  elsif obj.kind_of?(Label)
    return @@label
  end
  return self
end