Class: Watobo::Gui::RequestViewer

Inherits:
FXVerticalFrame
  • Object
show all
Defined in:
lib/watobo/gui/chatviewer_frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ RequestViewer

Returns a new instance of RequestViewer.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/watobo/gui/chatviewer_frame.rb', line 333

def initialize(owner, opts)
  super(owner, opts)
  @tabbook = nil
  @viewers = []
  @text = ''
  @max_len = 5000

  @tabBook = FXTabBook.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
  @tabBook.connect(SEL_COMMAND) {
    begin
      getApp().beginWaitCursor()
      setText(@text)
    ensure
      getApp().endWaitCursor()
    end
  }
  textviewer_tab = FXTabItem.new(@tabBook, "Text", nil)
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
  @textviewer = TextViewer.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y,:padding => 0)
  @textviewer.style = 1
  @textviewer.editable = false

  @viewers.push @textviewer

  FXTabItem.new(@tabBook, "Hex", nil)
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
  @hexViewer = HexViewer.new(tab_frame)
  @viewers.push @hexViewer
  
  FXTabItem.new(@tabBook, "Table", nil)
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
  @viewers << Watobo::Gui::TableEditorFrame.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
end

Instance Attribute Details

#max_lenObject

Returns the value of attribute max_len.



308
309
310
# File 'lib/watobo/gui/chatviewer_frame.rb', line 308

def max_len
  @max_len
end

Instance Method Details

#getTextObject



320
321
322
323
# File 'lib/watobo/gui/chatviewer_frame.rb', line 320

def getText
  index = @tabBook.current
  @viewers[index].getText()
end

#highlight(pattern) ⇒ Object



325
326
327
328
329
330
331
# File 'lib/watobo/gui/chatviewer_frame.rb', line 325

def highlight(pattern)
  begin
    index = @tabBook.current
    @viewers[index].highlight(pattern)
  rescue
  end
end

#setFontSize(size) ⇒ Object



316
317
318
# File 'lib/watobo/gui/chatviewer_frame.rb', line 316

def setFontSize(size)
  @textviewer.setFont(nil, size)
end

#setText(text) ⇒ Object



309
310
311
312
313
314
# File 'lib/watobo/gui/chatviewer_frame.rb', line 309

def setText(text)
  @text = text
  @textviewer.max_len = @max_len
  index = @tabBook.current
  @viewers[index].setText(text)
end