Module: Cheri::JRuby::Explorer::NavViewer

Includes:
NavViewerConstants
Defined in:
lib/cheri/jruby/explorer/viewer.rb

Defined Under Namespace

Classes: ColDef

Constant Summary

Constants included from NavViewerConstants

Cheri::JRuby::Explorer::NavViewerConstants::BUTTON1, Cheri::JRuby::Explorer::NavViewerConstants::BUTTON2, Cheri::JRuby::Explorer::NavViewerConstants::BUTTON3, Cheri::JRuby::Explorer::NavViewerConstants::CFont, Cheri::JRuby::Explorer::NavViewerConstants::Color, Cheri::JRuby::Explorer::NavViewerConstants::Font, Cheri::JRuby::Explorer::NavViewerConstants::HColor, Cheri::JRuby::Explorer::NavViewerConstants::HdrId, Cheri::JRuby::Explorer::NavViewerConstants::HdrName, Cheri::JRuby::Explorer::NavViewerConstants::HdrType, Cheri::JRuby::Explorer::NavViewerConstants::HdrValue, Cheri::JRuby::Explorer::NavViewerConstants::HdrVarName, Cheri::JRuby::Explorer::NavViewerConstants::IFont, Cheri::JRuby::Explorer::NavViewerConstants::MouseEvent, Cheri::JRuby::Explorer::NavViewerConstants::NColor, Cheri::JRuby::Explorer::NavViewerConstants::NFont, Cheri::JRuby::Explorer::NavViewerConstants::ResFont, Cheri::JRuby::Explorer::NavViewerConstants::SHIFT, Cheri::JRuby::Explorer::NavViewerConstants::TColor, Cheri::JRuby::Explorer::NavViewerConstants::TFont, Cheri::JRuby::Explorer::NavViewerConstants::VColor, Cheri::JRuby::Explorer::NavViewerConstants::VFont

Instance Method Summary collapse

Instance Method Details

#empty_row(glue = nil) ⇒ Object



599
600
601
602
603
604
605
# File 'lib/cheri/jruby/explorer/viewer.rb', line 599

def empty_row(glue=nil)
  x_box do
    align :LEFT,:TOP
    spacer 1,12
  end
  y_glue if glue
end

#header_row(cols, *labels) ⇒ Object



511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/cheri/jruby/explorer/viewer.rb', line 511

def header_row(cols,*labels)
  last = labels.length - 1
  labels.length.times do |i|
    col = cols[i] || cols.last
    cheri_yield col.col do
      x_panel do
        align :LEFT,:TOP
        background col.hbg || NColor
        maximum_size 1000, 24
        x_spacer 2
        label labels[i] do
          align :LEFT,:TOP
          set_font col.hfont || NFont
          foreground col.hfg if col.hfg
        end
        x_spacer 2
        x_glue if i == last
      end
      x_spacer 1
      y_spacer 2
    end
  end
  cheri_yield cols.last.col do
    x_glue    
  end
  y_spacer 2
end

#init_cols(*coldefs) ⇒ Object



494
495
496
497
498
499
500
501
# File 'lib/cheri/jruby/explorer/viewer.rb', line 494

def init_cols(*coldefs)
  coldefs.each do |cd|
    cd.col = y_panel do
      align :LEFT,:TOP
      opaque false
    end
  end
end

#initialize(*r) ⇒ Object



477
478
479
480
# File 'lib/cheri/jruby/explorer/viewer.rb', line 477

def initialize(*r)
  super
  swing[:auto]
end

#last_row(cols) ⇒ Object



503
504
505
506
507
508
509
# File 'lib/cheri/jruby/explorer/viewer.rb', line 503

def last_row(cols)
  cols.each do |col|
    cheri_yield col.col do
      y_glue
    end    
  end  
end

#mouse_action(e, val = nil) ⇒ Object



610
611
# File 'lib/cheri/jruby/explorer/viewer.rb', line 610

def mouse_action(e,val=nil)
end

#mouse_clicked(e, val = nil) ⇒ Object



607
608
# File 'lib/cheri/jruby/explorer/viewer.rb', line 607

def mouse_clicked(e,val=nil)
end

#title_section(title) ⇒ Object



482
483
484
485
486
487
488
489
490
491
492
# File 'lib/cheri/jruby/explorer/viewer.rb', line 482

def title_section(title)
  x_box do
    align :LEFT
    label title do
      align :LEFT
      set_font TFont
      foreground TColor
    end
    x_spacer 2
  end
end

#value_row(cols, *values) ⇒ Object



539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# File 'lib/cheri/jruby/explorer/viewer.rb', line 539

def value_row(cols,*values) 
  last = values.length - 1
  values.length.times do |i|
    col = cols[i] || cols.last
    cheri_yield col.col do
      #y_glue

      x_panel do
        align :LEFT,:TOP
        background col.dbg || VColor
        maximum_size 1000,col.maxh || 24
        x_spacer 2
        if col.clk
          on_mouse_entered do |e|
            e.source.background = HColor
          end
          on_mouse_exited do |e|
            e.source.background = VColor
          end
        end
        if col.dtext
          text_area do
            align :LEFT,:TOP
            editable false
            line_wrap true
            set_font col.dfont || VFont
            background col.dbg || VColor
            foreground col.dfg if col.dfg
            text values[i]
          end
        else
          label values[i] do
            align :LEFT,:TOP
            set_font col.dfont || VFont
            foreground col.dfg if col.dfg
            if (click_val = col.clk)
              on_mouse_entered do |e|
                e.source.parent.background = HColor
              end
              on_mouse_exited do |e|
                e.source.parent.background = VColor
              end
              on_mouse_clicked   {|e| mouse_clicked(e,click_val) }
              on_mouse_pressed   {|e| mouse_action(e,click_val) }
              on_mouse_released  {|e| mouse_action(e,click_val) }
            end
          end
        end
        x_spacer 2
        x_glue if i == last
      end
      x_spacer 1
      y_spacer 2
    end
  end
  cheri_yield cols.last.col do
    x_glue    
  end
  y_spacer 2
end