wx-pac 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ require 'wx-pac/agent'
2
+ require 'wx-pac/notebook'
3
+ require 'wx-pac/status_bar'
@@ -0,0 +1,41 @@
1
+ class PacAgent
2
+ attr_reader :panel, :parent
3
+
4
+ def initialize(panel, parent=nil)
5
+ @panel = panel
6
+ @parent = parent
7
+ #todo: should improve handling when parent is nil .. ie do we need a root agent?
8
+ add
9
+ end
10
+
11
+ def split_vertically(sash_position, style, &block)
12
+ set_split_mode(split(sash_position, style, &block), 2) #todo: should use: SPLIT_VERTICAL, but it doesn't work
13
+ end
14
+
15
+ def split_horizontally(sash_position, style, &block)
16
+ set_split_mode(split(sash_position, style, &block), 1) #todo: should use: SPLIT_HORIZONTAL, but it doesn't work
17
+ end
18
+
19
+ private
20
+
21
+ def set_split_mode(splitter, mode)
22
+ splitter.split_mode = mode
23
+ splitter
24
+ end
25
+
26
+ def split(sash_position, style)
27
+ Kernel.raise "split requires a block" unless block_given?
28
+
29
+ splitter = panel.add(SplitterWindow[style], :proportion => 1)
30
+ panel1 = splitter.add(Panel, :proportion => 1)
31
+ panel2 = splitter.add(Panel, :proportion => 1)
32
+
33
+ yield panel1, panel2
34
+
35
+ #todo: more of these need to be defineable args
36
+ splitter.minimum_pane_size = 10
37
+ splitter.split_vertically(panel1, panel2, sash_position)
38
+ splitter.sash_gravity = 0.5
39
+ splitter
40
+ end
41
+ end
@@ -0,0 +1,13 @@
1
+ class PacNotebookAgent < PacAgent
2
+ def initialize(panel, parent=nil)
3
+ @agents = []
4
+ super
5
+ end
6
+
7
+ def add_page_for_agent(name)
8
+ tab = @notebook.add(Panel) {|p| p.arrange_vertically(:padding => 5)
9
+ @agents << (yield p)
10
+ }
11
+ @notebook.add_page(tab, name)
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ class StatusBarAgent < PacAgent
2
+ def add
3
+ panel.create_status_bar(1)
4
+ end
5
+
6
+ def update(messages)
7
+ panel.status_bar.fields_count = messages.size
8
+ messages.size.times{|n| panel.set_status_text(messages[n], n) }
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.2
3
+ specification_version: 1
4
+ name: wx-pac
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2007-08-30 00:00:00 +01:00
8
+ summary: Some support for PAC (Presentation Abstraction Control) in wxruby
9
+ require_paths:
10
+ - lib
11
+ email: ""
12
+ homepage: ""
13
+ rubyforge_project:
14
+ description:
15
+ autorequire: wx-pac
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Paul Allton
31
+ files:
32
+ - lib/wx-pac
33
+ - lib/wx-pac.rb
34
+ - lib/wx-pac/agent.rb
35
+ - lib/wx-pac/notebook.rb
36
+ - lib/wx-pac/status_bar.rb
37
+ test_files: []
38
+
39
+ rdoc_options: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ executables: []
44
+
45
+ extensions: []
46
+
47
+ requirements: []
48
+
49
+ dependencies:
50
+ - !ruby/object:Gem::Dependency
51
+ name: wx_sugar
52
+ version_requirement:
53
+ version_requirements: !ruby/object:Gem::Version::Requirement
54
+ requirements:
55
+ - - "="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.1.15
58
+ version: