ANY LAYOUT NONE
class interface PIXMAP
   -- PIXMAP is DRAWABLE area like WINDOW but allow you to draw "off
   -- the screen" and the put it on the screen at any time.
   -- The pixmap is in display memory, not in the process' memory
   -- (see also IMAGE).

creation
   make (width_, height_: INTEGER)
      -- The pixmap is created with default_draw_kit color.
      require
         width_ > 0;
         height_ > 0

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 WIDGET
   expose_paint
      -- expose_paint paint with depth limited to the first window
      -- Containers have to propagate, with special
      -- attention to windows where expose_paint do nothing.

   set_geometry (x, y, w, h: INTEGER)
      require
         w >= 1;
         h >= 1
      require else
         x >= 0;
         y >= 0;
         w >= min_width;
         h >= min_height
      ensure
         width = w;
         height = h

feature(s) from DRAWABLE
   clear_without_expose
      -- clear the all the drawable area.
      -- WARNING: don't redraw the content (no expose event)

feature(s) from HASHABLE
   hash_code: INTEGER
      -- The hash-code value of Current.
      ensure
         good_hash_value: Result >= 0

feature(s) from PIXMAP
   make (width_, height_: INTEGER)
      -- The pixmap is created with default_draw_kit color.
      require
         width_ > 0;
         height_ > 0

feature(s) from PIXMAP
   depth: INTEGER

   background_color: COLOR
      --TODO: used ? no style ?

   set_background_color (c: COLOR)
      -- Define the color to use to clear the pixmap (pixmap is left
      -- unchanged).
      --TODO: use this color for clear
      require
         c /= Void

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