Class: GGLib::TracePanel

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

Constant Summary collapse

@@allow =
false

Instance Attribute Summary

Attributes inherited from Widget

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

Attributes inherited from Tile

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Widget

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

Methods inherited from Tile

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

Constructor Details

#initialize(name) ⇒ TracePanel

Returns a new instance of TracePanel.



176
177
178
179
# File 'lib/ext/widgets.rb', line 176

def initialize(name)
  super(name, 0,0,640,60, Themes::tracePanel)
  clear
end

Class Method Details

.enabledObject



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

def TracePanel.enabled
  return @@allow
end

.enabled=(bool) ⇒ Object



214
215
216
217
218
219
220
# File 'lib/ext/widgets.rb', line 214

def TracePanel.enabled=(bool)
  if bool==true
    @@allow=true
  else
    @@allow=false
  end
end

Instance Method Details

#*(nullarg = nil) ⇒ Object



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

def *(nullarg=nil)
  wakeUp
end

#<<(text) ⇒ Object



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

def <<(text)
  sput(text)
end

#clearObject



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

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

#drawObject



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

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

#onKeyPress(key) ⇒ Object



180
181
182
183
184
185
186
# File 'lib/ext/widgets.rb', line 180

def onKeyPress(key)
  if key==WidgetEvent::KeyDelete
    sleep
  elsif key==WidgetEvent::KeyEnter
    clear
  end
end

#pauseObject



205
206
207
# File 'lib/ext/widgets.rb', line 205

def pause
  gets
end

#put(text) ⇒ Object



191
192
193
194
195
# File 'lib/ext/widgets.rb', line 191

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

#sput(text) ⇒ Object



187
188
189
190
# File 'lib/ext/widgets.rb', line 187

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

#~Object



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

def ~()
  sleep
end