Class: Watobo::Gui::FilterTable
- Inherits:
-
FXTable
- Object
- FXTable
- Watobo::Gui::FilterTable
- Defined in:
- lib/watobo/gui/rewrite_filters_dialog.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
Instance Method Summary collapse
- #add_filter(filter) ⇒ Object
- #delete_current_row ⇒ Object
- #delete_row_by_index(index) ⇒ Object
- #get_current_filter ⇒ Object
-
#initialize(owner, filters = [], opts = {}) ⇒ FilterTable
constructor
A new instance of FilterTable.
Constructor Details
#initialize(owner, filters = [], opts = {}) ⇒ FilterTable
Returns a new instance of FilterTable.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 198 def initialize( owner, filters=[], opts={} ) @event_dispatcher_listeners = Hash.new parms = { :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2 } parms.update opts super(owner, parms) self.extend Watobo::Subscriber self.setBackColor(FXRGB(255, 255, 255)) self.setCellColor(0, 0, FXRGB(255, 255, 255)) self.setCellColor(0, 1, FXRGB(255, 240, 240)) self.setCellColor(1, 0, FXRGB(240, 255, 240)) self.setCellColor(1, 1, FXRGB(240, 240, 255)) @columns=Hash.new @filters = [] @filters.concat filters add_column "Location", 80 add_column "Match", 80 add_column "Pattern", 80 add_column "Flags", 80 init_columns @filters.each do |r| add_filter_row r end adjust_cell_width self.connect(SEL_SELECTED){|sender,sel,pos| self.selectRow pos.row # notify(:filter_selected, @filters[pos.row]) } end |
Instance Attribute Details
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
167 168 169 |
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 167 def filters @filters end |
Instance Method Details
#add_filter(filter) ⇒ Object
168 169 170 171 |
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 168 def add_filter(filter) @filters << filter add_filter_row(filter) end |
#delete_current_row ⇒ Object
192 193 194 195 196 |
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 192 def delete_current_row i = self.currentRow return false if i < 0 delete_row_by_index i end |
#delete_row_by_index(index) ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 177 def delete_row_by_index(index) return false if index < 0 return false if index > self.numRows-1 @filters.delete_at index self.clearItems init_columns @filters.each do |r| add_filter_row r end adjust_cell_width self.selectRow self.currentRow if self.currentRow >= 0 true end |
#get_current_filter ⇒ Object
173 174 175 |
# File 'lib/watobo/gui/rewrite_filters_dialog.rb', line 173 def get_current_filter puts self.currentRow end |