///////////////////////////////////////////////////////////////////////////////
//                             Lisaac Library                                //
//                                                                           //
//                   LSIIT - ULP - CNRS - INRIA - FRANCE                     //
//                                                                           //
//   This program is free software: you can redistribute it and/or modify    //
//   it under the terms of the GNU General Public License as published by    //
//   the Free Software Foundation, either version 3 of the License, or       //
//   (at your option) any later version.                                     //
//                                                                           //
//   This program is distributed in the hope that it will be useful,         //
//   but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//   GNU General Public License for more details.                            //
//                                                                           //
//   You should have received a copy of the GNU General Public License       //
//   along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
//                                                                           //
//                     http://isaacproject.u-strasbg.fr/                     //
///////////////////////////////////////////////////////////////////////////////
Section Header
  
  + name        := LAB_KEY;


  - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
  
  - comment     := "Label Key.";
  
Section Inherit
  
  + parent_g_label:Expanded GUI_LABEL;
  
Section Public
  
  + key:UINTEGER_16;
  
  //
  // Creation.
  //
  
  - create k:UINTEGER_16 :SELF <-
  ( + result:SELF;
    
    result := clone;
    result.make k;
    result
  );
  
  - make k:UINTEGER_16 <-
  (    
    key := k;
    name := KEYBOARD.key_to_string k;
  );
    
Section GUI_LABEL
  
  - my_width_min :INTEGER <- BITMAP[PIXEL_32].font_width name + 1;
  
  - my_height_min:INTEGER <- 17;
  
  - my_display_in bmp:GUI_ITEM to (x,y:INTEGER) <- 
  ( + px:INTEGER;
    bmp.rectangle_fill (x,y) to ((x + my_width_min-1),(y + my_height_min-1)) color (bmp.rgbbackcolor); 
    bmp.color (bmp.blue);
    px := bmp.width - my_width_min;
    bmp.print name to (px,y);
  );

