Class: XRC2Ruby::ObjectTypes::SplitterWindow

Inherits:
Container show all
Defined in:
lib/wx_sugar/xrc/xrc2ruby_types/containers.rb

Overview

This has several options

Constant Summary

Constants inherited from Window

Window::BASE_NAME

Instance Attribute Summary collapse

Attributes included from Parent

#children, #main_sizer, #sizer_items

Attributes inherited from Window

#bg, #enabled, #exstyle, #fg, #help, #hidden, #tooltip

Attributes inherited from Object

#centered, #name, #parent, #sub_class, #win_class

Instance Method Summary collapse

Methods included from Parent

#add_child, #child_output, #named_windows, #size_child

Methods inherited from Window

#args

Methods included from InitArgs

#inherited, #init_arg, #init_args, #translatable_string_init_arg

Methods inherited from Object

#initialize, #inspect, next_id, #var_name

Constructor Details

This class inherits a constructor from XRC2Ruby::ObjectTypes::Object

Instance Attribute Details

#gravityObject

Returns the value of attribute gravity.



19
20
21
# File 'lib/wx_sugar/xrc/xrc2ruby_types/containers.rb', line 19

def gravity
  @gravity
end

#minsizeObject

Returns the value of attribute minsize.



19
20
21
# File 'lib/wx_sugar/xrc/xrc2ruby_types/containers.rb', line 19

def minsize
  @minsize
end

#orientationObject

Returns the value of attribute orientation.



19
20
21
# File 'lib/wx_sugar/xrc/xrc2ruby_types/containers.rb', line 19

def orientation
  @orientation
end

#sashposObject

Returns the value of attribute sashpos.



19
20
21
# File 'lib/wx_sugar/xrc/xrc2ruby_types/containers.rb', line 19

def sashpos
  @sashpos
end

Instance Method Details

#outputObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/wx_sugar/xrc/xrc2ruby_types/containers.rb', line 21

def output 
  # Fiddly - we have to have created the child windows before we can
  # split them in the 
  base = super 

  unless children
    Kernel.raise "SplitterWindow must have children to split"
  end
  child_wins = children.grep(Window)
  if child_wins.length != 2
    Kernel.raise "SplitterWindow must have exactly two children"
  end

  child_args = "#{child_wins[0].var_name}, #{child_wins[1].var_name}"
  if orientation == 'vertical'
    base << "#{var_name}.split_vertically(#{child_args})\n"
  else
    base << "#{var_name}.split_horizontally(#{child_args})\n"
  end
  base
end

#setupObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/wx_sugar/xrc/xrc2ruby_types/containers.rb', line 43

def setup 
  setup = ""
  if minsize
    setup << "#{var_name}.minimum_pane_size = #{minsize}\n"
  end
  if sashpos
    setup << "#{var_name}.sash_position = #{sashpos}\n"
  end
  if gravity
    setup << "#{var_name}.sash_gravity = #{gravity}\n"
  end

  setup
end