Class: GGLib::ImageThemeInstance

Inherits:
ThemeInstance show all
Defined in:
lib/theme.rb

Instance Method Summary collapse

Methods inherited from ThemeInstance

#draw, #font, #height, #name, #width

Constructor Details

#initialize(klass, wid) ⇒ ImageThemeInstance

Returns a new instance of ImageThemeInstance.



103
104
105
106
# File 'lib/theme.rb', line 103

def initialize(klass, wid)
  super(klass, wid)
  @image = $window.newTexture(@x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
end

Instance Method Details

#imageObject



139
140
141
# File 'lib/theme.rb', line 139

def image
  return @klass.image
end

#setCoords(x1, y1, x2, y2) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/theme.rb', line 107

def setCoords(x1,y1,x2,y2)
  super(x1,y1,x2,y2)
  return if @image == -1
  if @state == 1
    $window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
  elsif @state == 2
    $window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.over)
  elsif @state == 3
    $window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.down)
  end
end

#setDefaultStateObject



118
119
120
121
# File 'lib/theme.rb', line 118

def setDefaultState
  super
  $window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
end

#setDownStateObject



126
127
128
129
# File 'lib/theme.rb', line 126

def setDownState
  super
  $window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.down)
end

#setOverStateObject



122
123
124
125
# File 'lib/theme.rb', line 122

def setOverState
  super
  $window.setTexture(@image, @x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.over)
end

#setSleepStateObject



130
131
132
133
134
# File 'lib/theme.rb', line 130

def setSleepState
  super
  @image = -1
  $window.deleteImage(@image)
end

#setWakeStateObject



135
136
137
138
# File 'lib/theme.rb', line 135

def setWakeState
  super
  @image = $window.newTexture(@x1, @y1, @x2, @y2, ZOrder::Widget, @klass.image.default)
end