Class: ActiveWindow::ActiveFloatColumn

Inherits:
ActiveColumn show all
Defined in:
lib/active_window/active_column.rb

Overview

TODO: configure the number of digits printed

Constant Summary

Constants inherited from ActiveColumn

ActiveWindow::ActiveColumn::ClassesToSymbols

Instance Attribute Summary

Attributes inherited from ActiveColumn

#id, #name

Instance Method Summary collapse

Methods inherited from ActiveColumn

create, #hide!, #initialize, #virtual?, #visible?

Constructor Details

This class inherits a constructor from ActiveWindow::ActiveColumn

Instance Method Details

#attributeObject



149
150
151
# File 'lib/active_window/active_column.rb', line 149

def attribute
  :text
end

#data_classObject



143
144
145
# File 'lib/active_window/active_column.rb', line 143

def data_class
  Float
end

#data_value(ar_object) ⇒ Object



157
158
159
# File 'lib/active_window/active_column.rb', line 157

def data_value(ar_object)
  super(ar_object) || 0
end

#rendererObject



146
147
148
# File 'lib/active_window/active_column.rb', line 146

def renderer
  Gtk::CellRendererText.new
end

#viewObject



152
153
154
155
156
# File 'lib/active_window/active_column.rb', line 152

def view
  super.set_cell_data_func(renderer) do |col, renderer, model, iter|
    renderer.text = sprintf("%.2f", iter[self.id])
  end
end