Class: Watobo::Gui::StatusBar

Inherits:
FXHorizontalFrame
  • Object
show all
Defined in:
lib/watobo/gui/status_bar.rb

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ StatusBar

Returns a new instance of StatusBar.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/watobo/gui/status_bar.rb', line 79

def initialize(owner, opts)
  super(owner, opts)

  frame = FXHorizontalFrame.new(self, :opts => FRAME_SUNKEN, :padding => 0)
  FXLabel.new(frame, "Status: ")
  @statusInfo = FXLabel.new(frame, "- no project started -")

  frame = FXHorizontalFrame.new(self, :opts => FRAME_SUNKEN, :padding => 0)
  FXLabel.new(frame, "Project: ")
  @projectName = FXLabel.new(frame, " - ")

  frame = FXHorizontalFrame.new(self, :opts => FRAME_SUNKEN, :padding => 0)
  FXLabel.new(frame, "Session: ")
  @sessionName = FXLabel.new(frame, " - ")
  
  frame = FXHorizontalFrame.new(self, :opts => FRAME_SUNKEN, :padding => 0)

  #@bind_label = FXLabel.new(frame, "BindAddr: ")
  @bind_addr_label = FXLabel.new(frame, "Bind-Addr: - ")

  frame = FXHorizontalFrame.new(self, :opts => FRAME_SUNKEN, :padding => 0)

  @port_label = FXLabel.new(frame, "Port: ")
  # @port_label.connect(SEL_RIGHTBUTTONPRESS) { switch_proxy_mode }
  @portNumber = FXLabel.new(frame, " - ")
  # @portNumber.connect(SEL_RIGHTBUTTONPRESS) { switch_proxy_mode }

  frame = FXHorizontalFrame.new(self, :opts => FRAME_SUNKEN, :padding => 0)
  FXLabel.new(frame, "Forwarding Proxy: ")
  @forwardingProxy = FXLabel.new(frame, " - ")
end

Instance Method Details

#bindAddress=(bind_addr) ⇒ Object



75
76
77
# File 'lib/watobo/gui/status_bar.rb', line 75

def bindAddress=(bind_addr)
  @bind_addr_label.text = "Bind-Addr: #{bind_addr} "
end

#forwardingProxy=(forward_proxy) ⇒ Object



71
72
73
# File 'lib/watobo/gui/status_bar.rb', line 71

def forwardingProxy=(forward_proxy)
  @forwardingProxy.text = forward_proxy
end

#portNumber=(port_number) ⇒ Object



67
68
69
# File 'lib/watobo/gui/status_bar.rb', line 67

def portNumber=(port_number)
  @portNumber.text = port_number
end

#projectName=(project_name) ⇒ Object



59
60
61
# File 'lib/watobo/gui/status_bar.rb', line 59

def projectName=(project_name)
  @projectName.text = project_name
end

#sessionName=(session_name) ⇒ Object



63
64
65
# File 'lib/watobo/gui/status_bar.rb', line 63

def sessionName=(session_name)
  @sessionName.text = session_name
end

#setStatusInfo(prefs = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/watobo/gui/status_bar.rb', line 25

def setStatusInfo( prefs={} )
  cprefs = {
    :color => self.parent.backColor,
    :text => ''
  }

  cprefs.update prefs unless prefs.nil?

  @statusInfo.text = cprefs[:text]
  unless cprefs[:color].nil?
    @statusInfo.backColor = cprefs[:color]
  end
  

end

#statusInfoText=(new_text) ⇒ Object



54
55
56
57
# File 'lib/watobo/gui/status_bar.rb', line 54

def statusInfoText=( new_text )
  @statusInfo.text = new_text
  @statusInfo.backColor = self.parent.backColor
end

#update_proxy_modeObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/watobo/gui/status_bar.rb', line 41

def update_proxy_mode
 # puts "Update Proxy Mode ..."
  if Watobo::Conf::Interceptor.proxy_mode == Watobo::Interceptor::MODE_REGULAR
 #   puts "REGULAR MODE"
    @portNumber.backColor = @portNumber.parent.backColor
    @port_label.backColor = @port_label.parent.backColor
  else
 #   puts "TRANSPARENT MODE"
    @portNumber.backColor = FXColor::Red
    @port_label.backColor = FXColor::Red
  end
end