wxruby 1.9.3-x86-linux → 1.9.4-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
@@ -417,6 +417,15 @@ class Wx::EvtHandler
417
417
  EventType['evt_help_range', 2,
418
418
  Wx::EVT_HELP,
419
419
  Wx::Event],
420
+ EventType['evt_html_cell_clicked', 1,
421
+ Wx::EVT_COMMAND_HTML_CELL_CLICKED,
422
+ Wx::HtmlCellEvent],
423
+ EventType['evt_html_cell_hover', 1,
424
+ Wx::EVT_COMMAND_HTML_CELL_HOVER,
425
+ Wx::HtmlCellEvent],
426
+ EventType['evt_html_link_clicked', 1,
427
+ Wx::EVT_COMMAND_HTML_LINK_CLICKED,
428
+ Wx::HtmlLinkEvent],
420
429
  EventType['evt_hyperlink', 1,
421
430
  Wx::EVT_COMMAND_HYPERLINK,
422
431
  Wx::HyperlinkEvent],
@@ -1,5 +1,30 @@
1
1
  # Class allowing periodic or timed events to be fired
2
2
  class Wx::Timer
3
+ # Convenience method to trigger a one-off action after +interval+
4
+ # milliseconds have passed. The action is specified by the passed
5
+ # block. The Timer is owned by the global App object, and is returned
6
+ # by the method.
7
+ def self.after(interval, &block)
8
+ timer = new(Wx::THE_APP, Wx::ID_ANY)
9
+ Wx::THE_APP.evt_timer(timer.get_id, block)
10
+ timer.start(interval, true)
11
+ timer
12
+ end
13
+
14
+ # Convenience method to trigger a repeating action every +interval+
15
+ # milliseconds. The action is specified by the passed block. The Timer
16
+ # is owned by the global App object, and is returned by the method.
17
+ def self.every(interval, &block)
18
+ timer = new(Wx::THE_APP, Wx::ID_ANY)
19
+ Wx::THE_APP.evt_timer(timer.get_id, block)
20
+ timer.start(interval)
21
+ timer
22
+ end
23
+
24
+ # In common with other classes, make the id method refer to the
25
+ # wxWidgets id, not ruby's deprecated name for object_id
26
+ alias :id :get_id
27
+
3
28
  # This class can be linked to an owner - an instance of a class
4
29
  # derived from EvtHandler which will receive Timer events. However,
5
30
  # event if a Wx::Timer is attached to a Wx::Window, it is (unlike most
data/lib/wx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wx
2
- WXRUBY_VERSION = '1.9.3'
2
+ WXRUBY_VERSION = '1.9.4'
3
3
  end
data/lib/wxruby2.so CHANGED
Binary file
@@ -198,27 +198,31 @@ end
198
198
  class GraphicsFrame < Wx::Frame
199
199
  def initialize()
200
200
  super(nil,:title=>"Graphics Context example",:size=>[500,400])
201
- hbox = Wx::BoxSizer.new(Wx::VERTICAL)
202
201
  @win = GraphicsWindow.new(self)
203
- hbox.add(@win,1,Wx::EXPAND|Wx::ALL)
204
- grid = Wx::GridSizer.new(2,2)
205
- cb_rect = Wx::CheckBox.new(self,:label=>"Draw Rectangles")
206
- cb_corner = Wx::CheckBox.new(self,:label=>"Draw Corners")
207
- create_status_bar()
208
- get_status_bar.set_status_text("FPS: 0")
209
- grid.add(cb_rect)
210
- grid.add(cb_corner)
211
- @win.rect = cb_rect
212
- @win.corner = cb_corner
213
- hbox.add(grid)
214
- set_sizer(hbox)
215
- @timer = Wx::Timer.new(self,2000)
216
- evt_timer(2000, :fps_display)
217
- @timer.start(1000)
202
+
203
+ create_status_bar(3)
204
+ status_bar.set_status_text("Frames per sec: 0", 0)
205
+ @win.rect = Wx::CheckBox.new(status_bar,:label=>"Draw Rectangles")
206
+ @win.corner = Wx::CheckBox.new(status_bar,:label=>"Draw Corners")
207
+
208
+ Wx::Timer.every(1000) { fps_display }
209
+ evt_size :on_size
218
210
  end
219
-
211
+
212
+
213
+ # Place the two control checkboxes within the StatusBar
214
+ def on_size
215
+ rect = status_bar.field_rect(1)
216
+ @win.rect.move [ rect.x + 2, rect.y + 2]
217
+ @win.rect.size = [ rect.width - 4, rect.height - 4 ]
218
+
219
+ rect = status_bar.field_rect(2)
220
+ @win.corner.move [ rect.x + 2, rect.y + 2]
221
+ @win.corner.size = [ rect.width - 4, rect.height - 4 ]
222
+ end
223
+
220
224
  def fps_display()
221
- get_status_bar.set_status_text("FPS: #{@win.fps}")
225
+ get_status_bar.set_status_text("Frames per sec: #{@win.fps}", 0)
222
226
  @win.fps = 0
223
227
  end
224
228
  end
@@ -65,14 +65,11 @@ class GaugeApp < Wx::App
65
65
  # Get a guaranteed-unique id
66
66
  THREAD_TIMER_ID = Wx::ID_HIGHEST + 1
67
67
  def on_init
68
- # Create a global application timer
69
- t = Wx::Timer.new(self, THREAD_TIMER_ID)
70
- # When the timer "ticks", switch control to other ruby threads
71
- evt_timer(THREAD_TIMER_ID) { Thread.pass }
72
- # Start the timer to run every 1/40 second (25ms); higher values
73
- # will make the other threads run more often, but will eventually
74
- # degrade the responsiveness of the GUI.
75
- t.start(25)
68
+ # Create a global application timer that passes control to other
69
+ # ruby threads. The timer will run every 1/40 second (25ms). Higher
70
+ # values will make the other threads run more often, but will
71
+ # eventually degrade the responsiveness of the GUI.
72
+ Wx::Timer.every(25) { Thread.pass }
76
73
  prog = ProgressFrame.new
77
74
  prog.show
78
75
  end
data/samples/html/html.rb CHANGED
@@ -18,6 +18,12 @@ require 'uri'
18
18
 
19
19
  class MyHtmlWindow < Wx::HtmlWindow
20
20
  attr_reader :html_src
21
+ def initialize(*args)
22
+ super
23
+ evt_html_link_clicked self, :on_link_clicked
24
+ evt_html_cell_hover self, :on_hover
25
+ end
26
+
21
27
  def load_page_from_uri(uri)
22
28
  case uri
23
29
  when URI::HTTP
@@ -64,21 +70,19 @@ class MyHtmlWindow < Wx::HtmlWindow
64
70
  def set_page(html)
65
71
  super html
66
72
  @html_src = html
67
- get_related_frame.addr_bar.set_value(@loaded_uri.to_s)
73
+ related_frame.addr_bar.value = @loaded_uri.to_s
68
74
  end
69
75
 
70
- def on_link_clicked(link)
71
- href = link.get_href
72
- if href =~ /^#/
73
- super(link)
74
- end
76
+ def on_link_clicked(event)
77
+ href = event.link_info.href
78
+ return if href =~ /^#/
75
79
  link_uri = URI.parse(href)
76
80
  @loaded_uri = load_page_from_uri(link_uri)
77
81
  end
78
82
 
79
- def on_cell_mouse_hover(cell, x, y)
80
- if link = cell.get_link
81
- related_frame.status_text = link.get_href, 1
83
+ def on_hover(event)
84
+ if link = event.cell.link
85
+ related_frame.set_status_text(link.href)
82
86
  else
83
87
  related_frame.status_text = ''
84
88
  end
@@ -114,7 +118,7 @@ class HtmlFrame < Wx::Frame
114
118
 
115
119
  @html_win = MyHtmlWindow.new(panel, -1)
116
120
  @html_win.set_related_frame(self, 'HTML Window: %s')
117
- @html_win.set_related_status_bar(2)
121
+
118
122
  @html_win.set_page(DATA.read)
119
123
  sizer.add(@html_win, 1, Wx::ALL|Wx::GROW, 4)
120
124
  panel.set_sizer(sizer)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.3
4
+ version: 1.9.4
5
5
  platform: x86-linux
6
6
  authors:
7
7
  - wxRuby development team
8
- autorequire: wx
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-15 00:00:00 +00:00
12
+ date: 2008-01-16 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15