Class: FindFrame

Inherits:
TkFloatTitledFrame show all
Defined in:
ext/ae-search-in-files/ae-search-in-files.rb

Constant Summary

Constants included from TkResizable

TkResizable::MIN_HEIGHT, TkResizable::MIN_WIDTH

Instance Attribute Summary collapse

Attributes inherited from TkBaseTitledFrame

#frame, #top

Instance Method Summary collapse

Methods inherited from TkFloatTitledFrame

#head_buttons, #hide, #on_close=, #show_grabbed, #title

Methods included from TkResizable

#resizing_do_move_obj, #resizing_do_press, #start_resizing, #stop_resizing

Methods included from TkMovable

#moving_do_move_obj, #moving_do_press, #start_moving, #stop_moving

Methods inherited from TkBaseTitledFrame

#add_button, #add_menu_button, #create_frame, #head_buttons, #menu_button

Constructor Details

#initialize(_parent) ⇒ FindFrame

Returns a new instance of FindFrame.



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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 199

def initialize(_parent)
  super(_parent)
  y0 = 10
  d = 23    
  TkLabel.new(self.frame, Arcadia.style('label')){
    text 'Find what:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
  @e_what = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
    editable true
    justify  'left'
    autocomplete 'true'
    expand 'tab'
    takefocus 'true'
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_what_entry = TkWinfo.children(@e_what)[0]
  @e_what_entry.bind_append("1",proc{Arcadia.process_event(InputEnterEvent.new(self,'receiver'=>@e_what_entry))})
  
  y0 = y0 + d
  TkLabel.new(self.frame, Arcadia.style('label')){
 	  text 'Files filter:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
 
  @e_filter = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
    editable true
    justify  'left'
    autocomplete 'true'
    expand 'tab'
    takefocus 'true'
    #pack('padx'=>10, 'fill'=>'x')
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_filter_entry = TkWinfo.children(@e_filter)[0]
  @e_filter_entry.bind_append("1",proc{Arcadia.process_event(InputEnterEvent.new(self,'receiver'=>@e_filter_entry))})

  @e_filter.text('*.rb')
  y0 = y0 + d

  TkLabel.new(self.frame, Arcadia.style('label')){
 	  text 'Directory:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d

  _h_frame = TkFrame.new(self.frame, Arcadia.style('panel')).place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  @e_dir = Tk::BWidget::ComboBox.new(_h_frame, Arcadia.style('combobox')){
    editable true
    justify  'left'
    autocomplete 'true'
    expand 'tab'
    takefocus 'true'
    pack('fill'=>'x')
    #pack('fill'=>'x')
    #place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_dir.text(Dir.pwd)
  @b_dir = TkButton.new(@e_dir, Arcadia.style('button') ){
    compound  'none'
    default  'disabled'
    text  '...'
    pack('side'=>'right')
    #pack('side'=>'right','ipadx'=>5, 'padx'=>5)
  }.bind('1', proc{
       change_dir
       Tk.callback_break
  })
  
  y0 = y0 + d
  y0 = y0 + d
  @buttons_frame = TkFrame.new(self.frame, Arcadia.style('panel')).pack('fill'=>'x', 'side'=>'bottom')	

  @b_go = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
    compound  'none'
    default  'disabled'
    text  'Find'
    #overrelief  'raised'
    #justify  'center'
    pack('side'=>'right','ipadx'=>5, 'padx'=>5)
  }
  place('x'=>100,'y'=>100,'height'=> 220,'width'=> 300)
end

Instance Attribute Details

#b_goObject (readonly)

Returns the value of attribute b_go.



198
199
200
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 198

def b_go
  @b_go
end

#e_dirObject (readonly)

Returns the value of attribute e_dir.



197
198
199
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 197

def e_dir
  @e_dir
end

#e_filterObject (readonly)

Returns the value of attribute e_filter.



196
197
198
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 196

def e_filter
  @e_filter
end

#e_whatObject (readonly)

Returns the value of attribute e_what.



194
195
196
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 194

def e_what
  @e_what
end

#e_what_entryObject (readonly)

Returns the value of attribute e_what_entry.



195
196
197
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 195

def e_what_entry
  @e_what_entry
end

Instance Method Details

#change_dirObject



285
286
287
288
289
290
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 285

def change_dir
  _d = Tk.chooseDirectory('initialdir'=>@e_dir.text,'mustexist'=>true)
  if _d && _d.strip.length > 0
    @e_dir.text(_d)
  end
end

#showObject



292
293
294
295
296
297
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 292

def show
  super
  self.focus
  @e_what.focus
  @e_what_entry.selection_range(0,'end')
end