ANY NONE
class interface DECORATOR
   -- The most complex decorator

creation
   make (s: BOOLEAN)
      ensure
         scaleable = s

feature(s) from STATE
   state: INTEGER
      -- use values from STATE_CONSTANTS

   is_state_normal: BOOLEAN

   is_state_active: BOOLEAN

   is_state_prelight: BOOLEAN

   is_state_selected: BOOLEAN

   is_state_insensitive: BOOLEAN

feature(s) from 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

   min_width: INTEGER

   min_height: INTEGER

   std_width: INTEGER

   std_height: INTEGER

   width: INTEGER

   height: INTEGER

   valid_width (w: INTEGER): BOOLEAN

   valid_height (h: INTEGER): BOOLEAN

   area: RECT

   root_area: RECT

   computing_size: BOOLEAN

   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

feature(s) from DECORATION
   set_widget (w: POINTER)

   widget: POINTER

   max_width: INTEGER

   max_height: INTEGER

feature(s) from DECORATOR
   make (s: BOOLEAN)
      ensure
         scaleable = s

   scaleable: BOOLEAN
      -- if True, the points are modified when the decorator is resized

feature(s) from DECORATOR
   add_segment (x1, y1, x2, y2: INTEGER)

   add_arc (x, y, w, h, angle1, angle2: INTEGER)

   add_polygon (x1, y1, x2, y2: INTEGER)

   add_pie (x, y, w, h, angle1, angle2: INTEGER)

   paint (x, y: INTEGER)

   resize (w, h: INTEGER)
      require
         w >= min_width;
         h >= min_height
      ensure
         width = w;
         height = h


invariant

    width >= min_width or computing_size;

    height >= min_height or computing_size;

    std_width > 0;

    std_height > 0;

    (not x_shrink_allowed implies width >= std_width) or computing_size;

    (not x_expand_allowed implies width <= std_width) or computing_size;

    (not y_shrink_allowed implies height >= std_height) or computing_size;

    (not y_expand_allowed implies height <= std_height) or computing_size;

end of DECORATOR