Class: GGLib::TracePanel

Inherits:
Widget show all
Defined in:
lib/ext/widgets.rb

Instance Attribute Summary

Attributes inherited from Widget

#buttonId, #defimage, #id, #name, #sleeping, #theme, #window, #zfocus

Attributes inherited from Containable

#align, #container, #maxSize, #minSize, #offset, #padding, #valign

Attributes inherited from Tile

#id, #inclusive, #x1, #x2, #y1, #y2

Instance Method Summary collapse

Methods inherited from Widget

#acceptText?, #blur, #button, #clicked?, #del, #downevent, #event, #feedText, #focus, #hasFocus?, #hasStickyFocus?, #intDraw, #onClick, #onDelete, #onDrag, #onInitialize, #onKeyDown, #onMouseDown, #onMouseOut, #onMouseOver, #onRightClick, #onRightDrag, #onRightMouseDown, #onStickyBlur, #onStickyFocus, #over?, #sleep, #sleeping?, #stickFocus, #unstickFocus

Methods inherited from Tile

#centerOn, #del, deleteAllInstances, deleteById, #each, #eachBorder, getAllInstances, getById, #height, #iTile, intersect?, #intersect?, #isInTile?, #move, #resize, setAllInstances, #setCoordinates, #setTile, #width, #xTile

Constructor Details

#initialize(name = :unnamed) ⇒ TracePanel

Returns a new instance of TracePanel.



175
176
177
178
179
180
181
182
# File 'lib/ext/widgets.rb', line 175

def initialize(name=:unnamed)
  super(name, 0,0,640,60, Themes::tracePanel)
  clear
  begin
    @theme.font.default = Gosu::Font.new($window, "Courier New", @theme.font.default.height)
  rescue
  end
end

Instance Method Details

#*(nullarg = nil) ⇒ Object



210
211
212
# File 'lib/ext/widgets.rb', line 210

def *(nullarg=nil)
  wakeUp
end

#<<(text) ⇒ Object



207
208
209
# File 'lib/ext/widgets.rb', line 207

def <<(text)
  sput(text)
end

#acceptStickyFocus?Boolean

Returns:

  • (Boolean)


183
184
185
# File 'lib/ext/widgets.rb', line 183

def acceptStickyFocus?
  return true
end

#clearObject



219
220
221
222
223
224
# File 'lib/ext/widgets.rb', line 219

def clear
  @text=[]
  @text[0]="TRACE OUTPUT"
  @text[1]="Press DELETE to close, ENTER to clear. (Click to activate.)"
  @line=2
end

#drawObject



225
226
227
228
229
230
231
# File 'lib/ext/widgets.rb', line 225

def draw
  i=0
  @text.each {|line|
    @theme.font.default.draw(line, 10, 10+i*@theme.font.default.height, ZOrder::Text, 1.0, 1.0, 0xffffffff)
    i+=1
  }
end

#onKeyUp(key) ⇒ Object



186
187
188
189
190
191
192
193
# File 'lib/ext/widgets.rb', line 186

def onKeyUp(key)
  if key==Gosu::Button::KbDelete
    theme = Themes::blank
    sleep
  elsif key==Gosu::Button::KbReturn or key==Gosu::Button::KbEnter
    clear
  end
end

#pauseObject



216
217
218
# File 'lib/ext/widgets.rb', line 216

def pause
  gets
end

#put(text) ⇒ Object



202
203
204
205
206
# File 'lib/ext/widgets.rb', line 202

def put(text)
  @line+=1
  @text[@line]=text.to_s
  wakeUp
end

#sput(text) ⇒ Object



198
199
200
201
# File 'lib/ext/widgets.rb', line 198

def sput(text)
  @line+=1
  @text[@line]=text.to_s    
end

#wakeUpObject



194
195
196
197
# File 'lib/ext/widgets.rb', line 194

def wakeUp
  super
  theme = Themes::tracePanel
end

#~Object



213
214
215
# File 'lib/ext/widgets.rb', line 213

def ~()
  sleep
end