Class: GGLib::Themes::ShadeTheme

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

Overview

SHADE THEME                              #

++

Constant Summary collapse

@@label =
nil

Instance Attribute Summary

Attributes inherited from DrawnTheme

#font

Attributes inherited from GGLib::Theme

#name

Instance Method Summary collapse

Methods inherited from DrawnTheme

#height, #newInstance, #width

Methods inherited from GGLib::Theme

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

Constructor Details

#initializeShadeTheme

Returns a new instance of ShadeTheme.



193
194
195
196
197
198
199
200
201
202
# File 'lib/ext/themes.rb', line 193

def initialize
  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), 
              0xffe6e6e6, 
              0xffb22222
            )
  super("Shade.Generic", font)
end

Instance Method Details

#draw(x1, y1, x2, y2, state) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
# File 'lib/ext/themes.rb', line 218

def draw(x1,y1, x2, y2, state)
  if state == 1
    $window.draw_quad(x1, y1, 0xff2e2e2e, x2, y1, 0xff2e2e2e, x1, y2, 0xff2e2e2e, x2, y2, 0xff2e2e2e, ZOrder::Widget) 
    $window.draw_quad(x1+2, y1+2, 0xffbdbdbd, x2-2, y1+2, 0xffbdbdbd, x1+2, y2-2, 0xffbdbdbd, x2-2, y2-2, 0xffbdbdbd, ZOrder::Widget) 
    $window.draw_quad(x1+3, y1+3, 0xff2e2e2e, x2-3, y1+3, 0xff2e2e2e, x1+3, y2-3, 0xff2e2e2e, x2-3, y2-3, 0xff2e2e2e, ZOrder::Widget) 
  else
    $window.draw_quad(x1, y1, 0xff2e2e2e, x2, y1, 0xff2e2e2e, x1, y2, 0xff2e2e2e, x2, y2, 0xff2e2e2e, ZOrder::Widget) 
    $window.draw_quad(x1+2, y1+2, 0xffffffff, x2-2, y1+2, 0xffffffff, x1+2, y2-2, 0xffffffff, x2-2, y2-2, 0xffffffff, ZOrder::Widget) 
    $window.draw_quad(x1+3, y1+3, 0xff2e2e2e, x2-3, y1+3, 0xff2e2e2e, x1+3, y2-3, 0xff2e2e2e, x2-3, y2-3, 0xff2e2e2e, ZOrder::Widget) 
  end
end

#request(obj) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/ext/themes.rb', line 203

def request(obj)
  if @@label == nil #Can't initialize at global scope because $window may not have been set
    @@label = ShadeLabelTheme.new
    @@checkgen = ShadeCheckGenTheme.new
    @@checkgenc = ShadeCheckGenCTheme.new
  end
  if obj.kind_of?(Label)
    return @@label
  elsif obj.kind_of?(CheckBox) or obj.kind_of?(RadioButton)
    return @@checkgen
  elsif obj.kind_of?(CheckBox::CheckedHk) or obj.kind_of?(RadioButton::CheckedHk)
    return @@checkgenc
  end
  return self
end