Class: Wads::BorderLayout

Inherits:
SectionLayout show all
Defined in:
lib/wads/widgets.rb

Overview

The layout sections are as follows:

+-------------------------------------------------+
+                  SECTION_NORTH                  +
+-------------------------------------------------+
+              |                   |              +
+ SECTION_WEST |   SECTION_CENTER  | SECTION_EAST +
+              |                   |              +
+-------------------------------------------------+
+                  SECTION_SOUTH                  +
+-------------------------------------------------+

Instance Attribute Summary

Attributes inherited from SectionLayout

#container_map

Attributes inherited from WadsLayout

#args, #border_coords, #parent_widget

Instance Method Summary collapse

Methods inherited from SectionLayout

#get_coordinates

Methods inherited from WadsLayout

#add_button, #add_document, #add_graph_display, #add_horizontal_panel, #add_image, #add_max_panel, #add_multi_select_table, #add_plot, #add_single_select_table, #add_table, #add_text, #add_text_input, #add_vertical_panel, #add_widget, #get_coordinates, #internal_add_panel

Constructor Details

#initialize(x, y, width, height, parent_widget, args = {}) ⇒ BorderLayout

Returns a new instance of BorderLayout.



924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
# File 'lib/wads/widgets.rb', line 924

def initialize(x, y, width, height, parent_widget, args = {})
    super
    # Divide the height into 100, 100, and the middle gets everything else
    # Right now we are using 100 pixels rather than a percentage for the borders
    middle_section_y_start = y + 100
    bottom_section_y_start = y + height - 100

    height_middle_section = bottom_section_y_start - middle_section_y_start

    middle_section_x_start = x + 100
    right_section_x_start = x + width - 100
    width_middle_section = right_section_x_start - middle_section_x_start

    @container_map[SECTION_NORTH] = GuiContainer.new(x, y, width, 100)
    @container_map[SECTION_WEST] = GuiContainer.new(
        x, middle_section_y_start, 100, height_middle_section, FILL_VERTICAL_STACK)
    @container_map[SECTION_CENTER] = GuiContainer.new(
                           middle_section_x_start,
                           middle_section_y_start,
                           width_middle_section,
                           height_middle_section,
                           FILL_VERTICAL_STACK)
    @container_map[SECTION_EAST] = GuiContainer.new(
                           right_section_x_start,
                           middle_section_y_start,
                           100,
                           height_middle_section,
                           FILL_VERTICAL_STACK)
    @container_map[SECTION_SOUTH] = GuiContainer.new(x, bottom_section_y_start, width, 100)
end