Class: Watobo::Gui::GotoUrlDialog

Inherits:
FXDialogBox
  • Object
show all
Includes:
Responder
Defined in:
lib/watobo/gui/goto_url_dialog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, pattern = nil) ⇒ GotoUrlDialog

Returns a new instance of GotoUrlDialog.



30
31
32
33
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
69
70
71
72
# File 'lib/watobo/gui/goto_url_dialog.rb', line 30

def initialize(owner, pattern=nil )
  #super(owner, "Edit Target Scope", DECOR_TITLE|DECOR_BORDER, :width => 300, :height => 425)
  super(owner, "Enter URL filter (regex):", DECOR_ALL, :width => 300, :height => 150)
  
  FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)

  base_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  @url_pattern = ""


 @pattern_field = FXTextField.new(base_frame, 40, :target => @pattern, :selector => FXDataTarget::ID_VALUE, :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT)
  @pattern_field.setText(pattern) unless pattern.nil?
  @pattern_field.setFocus()
  @pattern_field.setDefault()

  @pattern_field.connect(SEL_KEYPRESS) { |sender, sel, event|
    if event.code == KEY_Tab
    @finishButton.setFocus()
    @finishButton.setDefault()
    true
    else
    false
    end

  }
  buttons_frame = FXHorizontalFrame.new(base_frame,
  :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)

  @finishButton = FXButton.new(buttons_frame, "Accept" ,  nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
  @finishButton.enable
  
  
  @finishButton.connect(SEL_COMMAND) do |sender, sel, item|
  #self.handle(self, FXSEL(SEL_COMMAND, ID_CANCEL), nil)
    self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
    true
  end

  @cancelButton = FXButton.new(buttons_frame, "Cancel" ,
  :target => self, :selector => FXDialogBox::ID_CANCEL,
  :opts => BUTTON_NORMAL|LAYOUT_RIGHT)

end

Instance Attribute Details

#url_patternObject (readonly)

Returns the value of attribute url_pattern.



29
30
31
# File 'lib/watobo/gui/goto_url_dialog.rb', line 29

def url_pattern
  @url_pattern
end