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.


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
110
# File 'lib/watobo/gui/status_bar.rb', line 80

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


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

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

#forwardingProxy=(forward_proxy) ⇒ Object


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

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

#portNumber=(port_number) ⇒ Object


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

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

#projectName=(project_name) ⇒ Object


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

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

#sessionName=(session_name) ⇒ Object


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

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

#setStatusInfo(prefs = {}) ⇒ Object


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

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


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

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

#update_proxy_modeObject


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

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