Class: XRC2Ruby::ObjectTypes::TopLevelWindow

Inherits:
Window
  • Object
show all
Includes:
Parent
Defined in:
lib/wx_sugar/xrc/xrc2ruby_types/toplevelwindows.rb

Overview

All windows which may be top-level containers (eg Frames, Dialogs). In particular, they may become named ruby subclasses

Direct Known Subclasses

Dialog, Frame, MiniFrame

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, #setup

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

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toplevelwindows.rb', line 6

def title
  @title
end

Instance Method Details

#outputObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toplevelwindows.rb', line 7

def output
  if not named_windows.empty?
    attr_reader = "attr_reader " + 
      named_windows.map { | name | name.tr('@', ':') }.join(', ')
  end

  @name = "self"
  # get child widgets code and indent to four spaces
  "class #{sub_class} < #{win_class}
  #{attr_reader}" +
  ( XRC2Ruby.use_gettext ? "include GetText\n" : "" ) + "
  def initialize(parent)
super(parent, #{args})
" + child_output.gsub(/^/, '    ') + "
  end
end"
end