with mcc.gui.container.window;
with mcc.gui.widget.button.text;
with mcc.gui.widget.button.picture;
with mcc.gui.colors;
with mcc.gui.image;
with ada.text_io;
use ada.text_io;

procedure button_test is
   Window  : aliased mcc.gui.container.window.main_window;
   button1 : aliased mcc.gui.widget.button.text.text_button;
   button2 : aliased mcc.gui.widget.button.text.text_button;
   button3 : aliased mcc.gui.widget.button.text.text_button;
   image1  : aliased mcc.gui.image.external_image;
   image2  : aliased mcc.gui.image.external_image;
   pbutton1: aliased mcc.gui.widget.button.picture.picture_button;


   procedure Key_Listener (
      Obj   : in out mcc.gui.Sized_Object'Class;
      Event : in     mcc.gui.Key_Event) is
   begin
      put_line(standard_output,"key " &
         mcc.gui.key_action_type'image(event.action) &
         mcc.gui.key_type'image(event.key));
   end Key_Listener;

   procedure Mouse_Listener (
      Obj   : in out mcc.gui.Sized_Object'Class;
      Event : in     mcc.gui.Mouse_Event) is
   begin
      put_line(standard_output,
         mcc.gui.mouse_action_type'image(event.action) & " " &
         mcc.gui.mouse_button'image(event.button) &
         natural'image(event.x) & natural'image(event.y));
   end Mouse_Listener;

   procedure button_pushed(
      obj : in out mcc.gui.widget.button.button'class) is
   begin
      put_line(standard_output,"button pushed");
   end button_pushed;

begin
   -- test window functions
   mcc.gui.container.window.create(window,
      100,100,300,300);
   mcc.gui.container.window.set_title(window,"Fr""ed");

   -- test text button functions
   mcc.gui.widget.button.text.create(
      button1,window,19,0,71,23,"reset");
   mcc.gui.widget.button.text.create(
      button2,window,89,10,71,23,"reset");
   mcc.gui.widget.button.text.create(
      button3,window,159,10,71,23,"reset");
   mcc.gui.widget.button.text.set_text(
      button3,"RESET!");
   mcc.gui.widget.button.set_push_callback(
      button1'unchecked_access,
      button_pushed'unrestricted_access);
   mcc.gui.widget.button.set_push_callback(
      button2'unchecked_access,
      button_pushed'unrestricted_access);
   mcc.gui.widget.button.text.set_text(
      button1,"RESET!");
   mcc.gui.widget.button.text.set_foreground_color(
      button1,mcc.gui.colors.to_color("FF00FF"));
   mcc.gui.widget.button.text.set_background_color(
      button1,mcc.gui.colors.named_color(
         mcc.gui.colors.red));
   mcc.gui.set_key_listener(button1'unchecked_access,
      key_listener'unrestricted_access);
   mcc.gui.set_mouse_listener(button1'unchecked_access,
      mouse_listener'unrestricted_access);

   -- test picture button
   skip_line;
   mcc.gui.image.create(image1,"save.bmp");
   mcc.gui.widget.button.picture.create(pbutton1,window,
      172,14,34,30,mcc.gui.image.image(image1));
   mcc.gui.set_key_listener(pbutton1'unchecked_access,
      key_listener'unrestricted_access);
   mcc.gui.set_mouse_listener(pbutton1'unchecked_access,
      mouse_listener'unrestricted_access);

   mcc.gui.container.window.event_loop;
end button_test;
