wx_sugar 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,7 +51,9 @@ require 'wx_sugar/class_definitions'
51
51
  module WxSugar
52
52
  module Arranger
53
53
  def self.included(klass)
54
- unless klass.instance_methods.include?('add')
54
+ old_meths = klass.instance_methods
55
+ # Needs to be correct for both ruby 1.8 and ruby 1.9
56
+ unless old_meths.include?('add') or old_meths.include?(:add)
55
57
  # don't over-write methods in sizer
56
58
  klass.module_eval { alias_method :add, :nest }
57
59
  end
@@ -135,6 +137,7 @@ module Arranger
135
137
  proportion = layout_hints[:proportion] || 0
136
138
  siz = self.current_sizer
137
139
  padding = layout_hints[:padding] || @padding
140
+
138
141
  siz.add(child, proportion, layout, padding || 0)
139
142
  siz.layout()
140
143
 
@@ -1,3 +1,3 @@
1
1
  module WxSugar
2
- VERSION = '0.1.20'
2
+ VERSION = '0.1.21'
3
3
  end
@@ -62,8 +62,8 @@ module XRC2Ruby
62
62
  when 'sizeritem'
63
63
  stack.push( SizerItem.new(last_sizer) )
64
64
 
65
- # Some "special" object not corresponding to
66
- when 'panewindow', 'tool', 'separator'
65
+ # Some "special" object not corresponding to a standard class
66
+ when 'panewindow', 'tool', 'separator', 'button'
67
67
  special = ObjectTypes.const_get(attrs['class'].upcase)
68
68
  stack.push( special.new(last_parent, attrs['name']) )
69
69
  # An ordinary window
@@ -36,4 +36,37 @@ module XRC2Ruby::ObjectTypes
36
36
  "#{var_name} = Wx::BoxSizer.new(#{orient.gsub(/^wx/, "Wx::")})\n"
37
37
  end
38
38
  end
39
+
40
+ class StaticBoxSizer < Sizer
41
+ attr_accessor :orient, :label
42
+ def output
43
+ "#{var_name} = Wx::StaticBoxSizer.new(#{orient.gsub(/^wx/, "Wx::")}," +
44
+ " #{parent.var_name}, '#{label}')"
45
+ end
46
+ end
47
+
48
+ class FlexGridSizer < Sizer
49
+ attr_accessor :cols, :rows, :vgap, :hgap
50
+ def output
51
+ "#{var_name} = Wx::StaticBoxSizer.new(#{orient.gsub(/^wx/, "Wx::")}," +
52
+ " Wx::ID_ANY, '#{label}')"
53
+ end
54
+ end
55
+
56
+ class StdDialogButtonSizer < Sizer
57
+ attr_accessor :cols, :rows, :vgap, :hgap
58
+ def output
59
+ "#{var_name} = Wx::StaticBoxSizer.new(#{orient.gsub(/^wx/, "Wx::")}," +
60
+ " Wx::ID_ANY, '#{label}')"
61
+ end
62
+ end
63
+
64
+ # Not a real wxRuby class - this is a button within a
65
+ # StdDialogButtonSizer (do not confuse with Wx::Button)
66
+ class BUTTON
67
+ attr_accessor :flag, :border,
68
+ def initialize(b_sizer, an_id)
69
+ p an_id
70
+ end
71
+ end
39
72
  end
@@ -44,7 +44,7 @@ module XRC2Ruby::ObjectTypes
44
44
  init_arg(:style) { | val | val.gsub(/wx/, "Wx::") }
45
45
 
46
46
  # Tooltip and help text, applicable to all windows
47
- attr_accessor :tooltip, :help, :hidden, :enabled, :fg, :bg
47
+ attr_accessor :tooltip, :help, :hidden, :enabled, :fg, :bg, :exstyle
48
48
 
49
49
  def output
50
50
  # The base constructor
@@ -84,6 +84,11 @@ module XRC2Ruby::ObjectTypes
84
84
  base << "Wx::Colour.new(#{colour.join(', ')})\n"
85
85
  end
86
86
 
87
+ # If extra style set
88
+ if self.exstyle
89
+ base << "#{var_name}.extra_style = #{exstyle.gsub(/^wx/, "Wx::")}"
90
+ end
91
+
87
92
  # If explicitly disabled or enabled
88
93
  if self.enabled
89
94
  if self.enabled.to_i.zero?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wx_sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fenton
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-15 00:00:00 +01:00
12
+ date: 2008-11-14 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements: []
89
89
 
90
90
  rubyforge_project: weft-qda
91
- rubygems_version: 1.0.1
91
+ rubygems_version: 1.3.1
92
92
  signing_key:
93
93
  specification_version: 2
94
94
  summary: Syntax extensions for WxRuby.