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.



332
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
# File 'lib/watobo/gui/chatviewer_frame.rb', line 332

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
end

Instance Attribute Details

#max_lenObject

Returns the value of attribute max_len.



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

def max_len
  @max_len
end

Instance Method Details

#getTextObject



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

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

#highlight(pattern) ⇒ Object



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

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

#setFontSize(size) ⇒ Object



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

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

#setText(text) ⇒ Object



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

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