Class: TkMenuButtonObjBoard

Inherits:
ObjBoard show all
Defined in:
ext/ae-rad/ae-rad-inspector.rb

Instance Attribute Summary

Attributes inherited from ObjBoard

#objectsList

Instance Method Summary collapse

Methods inherited from ObjBoard

#get_string

Constructor Details

#initialize(_host, _obji) ⇒ TkMenuButtonObjBoard

Returns a new instance of TkMenuButtonObjBoard.


992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'ext/ae-rad/ae-rad-inspector.rb', line 992

def initialize(_host, _obji)
  super
  @sb = TkMenubutton.new(Arcadia.style('menu').update({
  :parent=>_host,
  :underline=>0,
  :direction=>:flush,
  #:font=>$arcadia['conf']['inspectors.inspector.tree.font'],
  :relief=>:groove,
  :borderwidth=> '1',      

  #:background=> :white,
  :justify=> :left})){|mb|
    menu TkMenu.new(Arcadia.style('menu').update({
    :parent=>mb,
    :tearoff=>0
    #:font=>$arcadia['conf']['inspectors.inspector.tree.font'],
    #:background=> :white,:relief=>'flat'
    }))
    pack('fill'=>'x', 'padx'=>0, 'pady'=>0, 'anchor'=>'n')
  }
  @menu = @sb.cget('menu')
end

Instance Method Details

#change_name(_agobj, _newname) ⇒ Object


1038
1039
1040
1041
1042
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1038

def change_name(_agobj, _newname)
  @menu.delete(getobjstring(_agobj))
  super
  insert_menu_item(_agobj)
end

#delete(_agobj) ⇒ Object


1015
1016
1017
1018
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1015

def delete(_agobj)
  super
  @menu.delete(getobjstring(_agobj))
end

#getobjstring(_agobj) ⇒ Object


1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1020

def getobjstring(_agobj)
  _num = 0
  _result = _agobj.i_name
  _parent = _agobj.ag_parent
  while _parent != nil
    _result = ' - '+_result
    _parent = _parent.ag_parent
    _num = _num+1
  end
  _space = ''; _num.times do 
    _space = _space + '  ' 
  end
  if _agobj.ag_parent != nil 
    _result = _space + '|'+_result 
  end
  return _result
end

#insert(_agobj) ⇒ Object


1064
1065
1066
1067
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1064

def insert(_agobj)
  super
  insert_menu_item(_agobj)
end

#insert_menu_item(_agobj) ⇒ Object


1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1044

def insert_menu_item(_agobj)
  _do_select = proc {
    @obji.select(_agobj)
    @sb.configure('text'=>get_string(_agobj))
  }
  if (!defined? _agobj.ag_parent)|| (_agobj.ag_parent == nil)
    _index = 0
  else
    _index = @menu.index(getobjstring(_agobj.ag_parent))
  end
  @menu.insert(_index + 1,
  :command,
  :label=>getobjstring(_agobj),
  :hidemargin => true,
  :accelerator => _agobj.obj_class.to_s,
  :command=>_do_select
  )
  @sb.configure('text'=>get_string(_agobj))
end

#select(_agobj) ⇒ Object


1069
1070
1071
1072
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1069

def select(_agobj)
  super
  @sb.configure('text'=>get_string(_agobj))
end