Class: RubyMVC::Toolkit::WxRuby::GridView
- Inherits:
-
Wx::Grid
- Object
- Wx::Grid
- RubyMVC::Toolkit::WxRuby::GridView
show all
- Includes:
- SignalHandler, Common
- Defined in:
- lib/ruby_mvc/toolkit/peers/wxruby/grid_view.rb
Instance Method Summary
collapse
Methods included from Common
#title, #title=
#signal_connect, #signal_disconnect, #signal_emit
Constructor Details
#initialize(options = {}) ⇒ GridView
Returns a new instance of GridView.
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/ruby_mvc/toolkit/peers/wxruby/grid_view.rb', line 34
def initialize(options = {})
puts "options: #{options.inspect}"
super(WxRuby.parent(options), options[:id] || -1)
if false == options[:show_row_labels]
set_row_label_size(0)
end
@selected_rows = []
evt_grid_cmd_cell_left_dclick(self.get_id()) do |e|
if @gm
col = @gm.get_key(e.get_col)
else
col = e.get_col
end
signal_emit("row-activated", self, @model, e.get_row, col)
end
evt_grid_range_select do |e|
puts "Event alt: #{e.alt_down}; ctrl: #{e.control_down}; brc: #{e.get_bottom_right_coords}; bottom: #{e.get_bottom_row}; left: #{e.get_left_col}; right: #{e.get_right_col}; tlc: #{e.get_top_left_coords}; top: #{e.get_top_row}; meta: #{e.meta_down}; selecting: #{e.selecting}; shift: #{e.shift_down}" if !e.selecting
next if !e.selecting
top = e.get_top_row
bottom = e.get_bottom_row
sel = []
top.upto(bottom) do |i|
sel << i
end
@selected_rows = sel
signal_emit("row-selection-changed", self, @model, sel)
end
end
|
Instance Method Details
#editable=(val) ⇒ Object
106
107
108
|
# File 'lib/ruby_mvc/toolkit/peers/wxruby/grid_view.rb', line 106
def editable=(val)
enable_editing(val)
end
|
#model=(model) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/ruby_mvc/toolkit/peers/wxruby/grid_view.rb', line 70
def model=(model)
@model = model
@gm = GridModel.new(model)
set_table(@gm, Wx::Grid::GridSelectRows)
@model.signal_connect("rows-inserted") do |s, i, r|
puts "refresh rows-inserted"
@gm = GridModel.new(model)
set_table(@gm, Wx::Grid::GridSelectRows, false)
end
@model.signal_connect("rows-removed") do |s, i, r|
puts "refresh rows-removed"
@gm = GridModel.new(model)
set_table(@gm, Wx::Grid::GridSelectRows, false)
end
@model.signal_connect("row-changed") do |s, i, r|
puts "refresh row-changed"
@gm = GridModel.new(model)
set_table(@gm, Wx::Grid::GridSelectRows, false)
end
end
|
#selected_rows ⇒ Object
110
111
112
113
|
# File 'lib/ruby_mvc/toolkit/peers/wxruby/grid_view.rb', line 110
def selected_rows
@selected_rows
end
|
#set_table(table, flags, clear_selection = true) ⇒ Object
99
100
101
102
103
104
|
# File 'lib/ruby_mvc/toolkit/peers/wxruby/grid_view.rb', line 99
def set_table(table, flags, clear_selection = true)
super(table, flags)
@selected_rows.clear if clear_selection
auto_size_columns(false)
signal_emit("row-selection-changed", self, @model, @selected_rows)
end
|