Class: Watobo::Gui::HistorySlider
- Inherits:
-
FXScrollWindow
- Object
- FXScrollWindow
- Watobo::Gui::HistorySlider
- Defined in:
- lib/watobo/gui/manual_request_editor.rb
Instance Method Summary collapse
- #getItem(id) ⇒ Object
-
#initialize(owner, target, history_size, opts) ⇒ HistorySlider
constructor
A new instance of HistorySlider.
- #reset ⇒ Object
- #update(history) ⇒ Object
Constructor Details
#initialize(owner, target, history_size, opts) ⇒ HistorySlider
Returns a new instance of HistorySlider.
230 231 232 233 234 235 236 237 238 239 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 230 def initialize(owner, target, history_size, opts) @size = history_size @buttons = [] @history = [] super(owner, opts) frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_X, :padding => 0) @size.times do |i| @buttons.push HistoryButton.new(frame, 'empty', target, :opts => FRAME_NONE|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => 50, :height => 50) end end |
Instance Method Details
#getItem(id) ⇒ Object
214 215 216 217 218 219 220 221 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 214 def getItem(id) item = nil @history.each do |h| item = h if h.id == id break if item end return item end |
#reset ⇒ Object
223 224 225 226 227 228 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 223 def reset() @buttons.each do |b| b.reset() end end |
#update(history) ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 201 def update(history) @history = history reset() history.length.times do |i| begin @buttons[i].update(history[i]) rescue => bang puts bang end end end |