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.



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/watobo/gui/chatviewer_frame.rb', line 313

def initialize(owner, opts)
  super(owner, opts)
  @tabbook = nil
  @viewers = []
  @text = ''
  @max_len = -1 #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)

  FXTabItem.new(@tabBook, "JSON", 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)
  @viewers << JsonViewer.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
end

Instance Attribute Details

#max_lenObject

Returns the value of attribute max_len.



287
288
289
# File 'lib/watobo/gui/chatviewer_frame.rb', line 287

def max_len
  @max_len
end

Instance Method Details

#getTextObject



300
301
302
303
# File 'lib/watobo/gui/chatviewer_frame.rb', line 300

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

#highlight(pattern) ⇒ Object



305
306
307
308
309
310
311
# File 'lib/watobo/gui/chatviewer_frame.rb', line 305

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

#setFontSize(size) ⇒ Object



296
297
298
# File 'lib/watobo/gui/chatviewer_frame.rb', line 296

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

#setText(text) ⇒ Object



289
290
291
292
293
294
# File 'lib/watobo/gui/chatviewer_frame.rb', line 289

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