Class: Yast::TreePanelClass
- Inherits:
-
Module
- Object
- Module
- Yast::TreePanelClass
- Defined in:
- ../../src/modules/TreePanel.rb
Instance Method Summary (collapse)
- - (Object) CallCreate
- - (Object) CallDestroy
- - (Object) CallHandle(event)
- - (Object) CallRefresh
- - (Object) Create
-
- (Object) Destroy
Delegating destroying to the selected panel.
-
- (Object) Handle(event)
Handle user input by either switching the panel or delegating the input to the selected panel.
-
- (Object) Init(d)
Initialises internal data and calls the create function of the selected panel.
- - (Object) main
- - (Object) Refresh
-
- (Object) SwitchToNew(new_current_item)
Set new active item of the tree ( + replace main dlg content accordingly).
-
- (Object) Update(d, tree, new_item)
Update the contents of the Tree widget.
Instance Method Details
- (Object) CallCreate
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File '../../src/modules/TreePanel.rb', line 48 def CallCreate tmp = Ops.get(@data, @current_item) create_func = Convert.convert( Ops.get(tmp, :create), :from => "any", :to => "void (any)" ) if create_func != nil user_data = Ops.get(tmp, :user_data) create_func.call(user_data) end nil end |
- (Object) CallDestroy
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File '../../src/modules/TreePanel.rb', line 94 def CallDestroy tmp = Ops.get(@data, @current_item) destroy_func = Convert.convert( Ops.get(tmp, :destroy), :from => "any", :to => "void (any)" ) if destroy_func != nil user_data = Ops.get(tmp, :user_data) destroy_func.call(user_data) end nil end |
- (Object) CallHandle(event)
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File '../../src/modules/TreePanel.rb', line 78 def CallHandle(event) event = deep_copy(event) tmp = Ops.get(@data, @current_item) handle_func = Convert.convert( Ops.get(tmp, :handle), :from => "any", :to => "void (any, map)" ) if handle_func != nil user_data = Ops.get(tmp, :user_data) handle_func.call(user_data, event) end nil end |
- (Object) CallRefresh
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File '../../src/modules/TreePanel.rb', line 63 def CallRefresh tmp = Ops.get(@data, @current_item) refresh_func = Convert.convert( Ops.get(tmp, :refresh), :from => "any", :to => "void (any)" ) if refresh_func != nil user_data = Ops.get(tmp, :user_data) refresh_func.call(user_data) end nil end |
- (Object) Create
153 154 155 156 157 |
# File '../../src/modules/TreePanel.rb', line 153 def Create CallCreate() nil end |
- (Object) Destroy
Delegating destroying to the selected panel.
199 200 201 202 203 |
# File '../../src/modules/TreePanel.rb', line 199 def Destroy CallDestroy() nil end |
- (Object) Handle(event)
Handle user input by either switching the panel or delegating the input to the selected panel.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File '../../src/modules/TreePanel.rb', line 167 def Handle(event) event = deep_copy(event) = Event.IsWidgetActivatedOrSelectionChanged(event) if == :tree new_current_item = UI.QueryWidget(:tree, :CurrentItem) if new_current_item != @current_item CallDestroy() @current_item = deep_copy(new_current_item) CallCreate() end else CallHandle(event) end nil end |
- (Object) Init(d)
Initialises internal data and calls the create function of the selected panel.
When calling this function the Tree widget must already exist.
114 115 116 117 118 119 120 121 122 |
# File '../../src/modules/TreePanel.rb', line 114 def Init(d) d = deep_copy(d) @data = deep_copy(d) @current_item = UI.QueryWidget(:tree, :CurrentItem) CallCreate() nil end |
- (Object) main
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File '../../src/modules/TreePanel.rb', line 33 def main Yast.import "UI" Yast.import "Event" @data = nil @current_item = nil @empty_panel = VBox(VStretch(), HStretch()) end |
- (Object) Refresh
159 160 161 162 163 |
# File '../../src/modules/TreePanel.rb', line 159 def Refresh CallRefresh() nil end |
- (Object) SwitchToNew(new_current_item)
Set new active item of the tree ( + replace main dlg content accordingly)
186 187 188 189 190 191 192 193 194 195 196 |
# File '../../src/modules/TreePanel.rb', line 186 def SwitchToNew(new_current_item) new_current_item = deep_copy(new_current_item) if @current_item != new_current_item UI.ChangeWidget(:tree, :CurrentItem, new_current_item) CallDestroy() @current_item = deep_copy(new_current_item) CallCreate() end nil end |
- (Object) Update(d, tree, new_item)
Update the contents of the Tree widget.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File '../../src/modules/TreePanel.rb', line 125 def Update(d, tree, new_item) d = deep_copy(d) tree = deep_copy(tree) new_item = deep_copy(new_item) old_item = deep_copy(@current_item) UI.ChangeWidget(:tree, :Items, tree) if new_item == nil UI.ChangeWidget(:tree, :CurrentItem, @current_item) else UI.ChangeWidget(:tree, :CurrentItem, new_item) end new_item = UI.QueryWidget(:tree, :CurrentItem) if old_item != new_item CallDestroy() @data = deep_copy(d) @current_item = deep_copy(new_item) CallCreate() else @data = deep_copy(d) end nil end |