class CONTAINER

Features exported to DRAWABLE_HANDLER

A CONTAINER is designed to contain many widgets (called children). Children are arranged in the container using some LAYOUT, and painted. The CONTAINER may be seen as a shell: if the container is not shrinkable, it will not shrink any of it's children. If the container is shrinkable, it may shrink children that are shrinkable but never shrink not shrinkable children (it's like a shell again).

The LAYOUT is an algorithm attached to the container. It has to decide size and position for children.

Direct parents

conformant parents

DRAWABLE, SENSITIVE

Known children

conformant children

WINDOW

Summary

creation features

exported features

Details

default_create

Default creation method. It is used when no creation method is specified if allowed. Note it may be renamed.

make_layout (p: CONTAINER, lo: LAYOUT)

require

  • p /= Void
  • lo /= Void
  • lo.container = Void

ensure

  • parent = p
  • layout = lo

layout: LAYOUT
width: INTEGER
height: INTEGER
min_width: INTEGER
min_height: INTEGER
std_width: INTEGER
std_height: INTEGER
layout_update_paused: BOOLEAN

TODO: suppress. Handle this with mapped

set_layout (l: LAYOUT)

Change the layout for the container (layout choose children position and size). The layout has to be free (not used by another container).

require

  • l /= Void
  • l.container = Void

ensure

  • layout = l
  • layout.container = Current

layout_pause

TODO: remove when mapped ready

require

  • not layout_update_paused

ensure

  • layout_update_paused

layout_continue

TODO: remove when mapped ready

require

  • layout_update_paused

ensure

  • not layout_update_paused

child_attach (w: WIDGET)

Add widget w in this container.

require

  • layout /= Void
  • w /= Void
  • w.parent = Void
  • not has_child(w)

ensure

  • w.parent = Current
  • has_child(w)
  • last_child = w

child_dettach (w: WIDGET)
This feature is obsolete: Use `child_detach' instead.
child_detach (w: WIDGET)

Remove widget w from this container.

require

  • w /= Void
  • has_child(w)

ensure

  • not has_child(w)
  • w.parent = Void

has_child (w: WIDGET): BOOLEAN
last_child: WIDGET

require

  • not is_empty

is_empty: BOOLEAN
clear_area (x: INTEGER, y: INTEGER, w: INTEGER, h: INTEGER)

clear area and emit expose event (contents will be drawn) x and y are relative to current object

require

  • w > 0
  • h > 0
  • area.include(x, y)
  • area.include(x + w - 1, y + h - 1)

clear_without_expose

clear the all the drawable area. WARNING: don't redraw the content (no expose event)

refresh

clear and update entire object (sub_window(s) are not updated).

clear

clear and update entire object (sub_window(s) are not updated).

drawing_widget: POINTER

Because Windows can not paint on widgets like windows or bitmaps, it needs another object (Device Context) attached to the widget. For X11, it is the same value as widget.

parent: CONTAINER
pos_x: INTEGER
pos_y: INTEGER
x_shrink_allowed: BOOLEAN
x_expand_allowed: BOOLEAN
y_shrink_allowed: BOOLEAN
y_expand_allowed: BOOLEAN
valid_width (w: INTEGER): BOOLEAN
valid_height (h: INTEGER): BOOLEAN
area: RECT
root_area: RECT
set_x_shrink (b: BOOLEAN)
set_x_expand (b: BOOLEAN)
set_y_shrink (b: BOOLEAN)
set_y_expand (b: BOOLEAN)
set_shrink (b: BOOLEAN)

change both x and y shrink state

set_expand (b: BOOLEAN)

change both x and y expand state

state: INTEGER

use values from STATE_CONSTANTS

frozen is_state_normal: BOOLEAN
frozen is_state_active: BOOLEAN
frozen is_state_prelight: BOOLEAN
frozen is_state_selected: BOOLEAN
frozen is_state_insensitive: BOOLEAN
deferred hash_code: INTEGER

The hash-code value of Current.

ensure

  • good_hash_value: Result >= 0

deferred is_equal (other: CONTAINER): BOOLEAN

Is other attached to an object considered equal to current object ?

require

  • other /= Void

ensure

  • Result implies hash_code = other.hash_code
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)

Class invariant