module helper_demo
        version = 'v1.0'
        names = case_sensitive

include file '/usr/include/X11/DwtAppl.uil';

include file "XMUX.uil" ;

procedure callback (integer);
          toggle_proc (integer);
          create_proc (integer) ;
          select(integer) ;
          debug(integer) ;
          enter(integer) ;

value   adb_top_attachment      : argument('adbTopAttachment', integer);
        adb_bottom_attachment   : argument('adbBottomAttachment', integer);
        adb_left_attachment     : argument('adbLeftAttachment', integer);
        adb_right_attachment    : argument('adbRightAttachment', integer);
        adb_top_widget          : argument('adbTopWidget', any);
        adb_bottom_widget       : argument('adbBottomWidget', any);
        adb_left_widget         : argument('adbLeftWidget', any);
        adb_right_widget        : argument('adbRightWidget', any);
        adb_top_offset          : argument('adbTopOffset', integer);
        adb_bottom_offset       : argument('adbBottomOffset', integer);
        adb_left_offset         : argument('adbLeftOffset', integer);
        adb_right_offset        : argument('adbRightOffset', integer);

        button_add_cancel   : 8 ;
        button_chalk_ok     : 9 ;
        button_chalk_cancel : 10 ;
        button_remove_ok    : 11 ;
        button_remove_cancel: 12 ;
        button_main_quit    : 13 ;
        add_box             : 14 ;
        chalk_box           : 15 ;
        remove_box          : 16 ;
        chalk_list          : 17 ;
        remove_list         : 18 ;
        main_text           : 19 ;
        add_command         : 20 ;


object Main: main_window {

  arguments {
    x = 10;
    y = 17;
    width = 210;
    height = 25;
    main_menu_bar        = menu_bar MenuBar;
  };
  controls {
    menu_bar        MenuBar;
  };
};


object MenuBar : menu_bar {

  arguments {
    orientation = DwtOrientationHorizontal;
    spacing     = 15;
  };
  controls {                              
    push_button Add;
    push_button Chalk;
    push_button Remove;
  };
};

object  Add : push_button {
  arguments {
  };
  callbacks {
    activate = procedure callback ( add_box );
  };
};      
        
object  Remove : push_button {
  arguments {
  };
  callbacks {
    activate = procedure callback ( remove_box );
  };
};      
        
object  Chalk : push_button {
  arguments {
  };
  callbacks {
    activate = procedure callback ( chalk_box );
  };
};      

object ChalkBox : popup_attached_db {
  arguments {
    x = 100;
    y = 250;
    width  = 150;
    height = 200;
    title = "Pass Chalk";
    style = DwtModeless;
    cancel_button  =   push_button ChalkCancel ;
    default_button =   push_button ChalkOk ;
  };

  controls {
    list_box        ActiveHostsList; 
    push_button     ChalkOk ;
    push_button     ChalkCancel ;
      };

  callbacks {
!   create = procedure create_proc (k_order_box);
  };
};

object ActiveHostsList : list_box {
   arguments {
    visible_items_count = 6 ;
    adb_top_attachment = DwtAttachAdb;
    adb_top_offset = 5 ;
    adb_left_attachment = DwtAttachAdb;
    adb_left_offset = 5 ;
    adb_right_attachment = DwtAttachAdb;
    adb_right_offset = 5 ;
  };
  callbacks {
      create = procedure create_proc( chalk_list ) ;
      single = procedure select( chalk_list ) ;
  } ;
} ;

object ChalkOk : push_button {

  arguments {
     label_label       = "Ok";
    adb_top_attachment = DwtAttachWidget;
    adb_top_widget = list_box ActiveHostsList;
    adb_top_offset = 5 ;
    adb_bottom_attachment = DwtAttachAdb;
    adb_bottom_offset = 5 ;
    adb_left_attachment = DwtAttachAdb;
    adb_left_offset = 5 ;
  };
  callbacks {
    activate = procedure callback (button_chalk_ok);
  };
};

object ChalkCancel : push_button {

  arguments {
      label_label       = "Cancel";
      adb_top_attachment = DwtAttachWidget;
      adb_top_widget = list_box ActiveHostsList;
      adb_top_offset = 5 ;
      adb_bottom_attachment = DwtAttachAdb;
      adb_bottom_offset = 5 ;
      adb_left_attachment = DwtAttachWidget;
    adb_left_widget = push_button ChalkOk;
    adb_left_offset = 5 ;
    adb_right_attachment = DwtAttachAdb;
    adb_right_offset = 5 ;
  };
  callbacks {
    activate = procedure callback (button_chalk_cancel);
  };
};

object AddBox : popup_attached_db {
  arguments {
    x = 100;
    y = 50;
    height = 80;
    width = 150;
    title = "Add Host(s)";
    style = DwtModeless;
    cancel_button = push_button AddCancel;
  };

  controls {
    command_window  AddCommand;
    push_button     AddCancel;   
  };

  callbacks {
!   create = procedure create_proc (k_order_box);
  };
};

object RemoveBox : popup_attached_db {
  arguments {
    x = 300;
    y = 50;
    width  = 150;
    height = 230;
    title = "Remove Host(s)";
    style = DwtModeless;
    cancel_button = push_button RemoveCancel;
    default_button = push_button RemoveOk;    
  };

  controls {
    list_box        RemoveHostsList; 
    push_button     RemoveOk;
    push_button     RemoveCancel;   
  };

  callbacks {
   create = procedure create_proc (remove_box);
  };
};

object RemoveHostsList : list_box {
   arguments {
    visible_items_count = 6 ;
    adb_top_attachment = DwtAttachAdb;
    adb_top_offset = 5 ;
    adb_left_attachment = DwtAttachAdb;
    adb_left_offset = 5 ;
    adb_right_attachment = DwtAttachAdb;
    adb_right_offset = 5 ;
  };
  callbacks {
      create = procedure create_proc( remove_list ) ;
      single = procedure select( remove_list ) ;
  } ;
} ;

object RemoveOk : push_button {

  arguments {
     label_label       = "Ok";
    adb_top_attachment = DwtAttachWidget;
    adb_top_widget = list_box RemoveHostsList;
    adb_top_offset = 5 ;
    adb_bottom_attachment = DwtAttachAdb;
    adb_bottom_offset = 5 ;
    adb_left_attachment = DwtAttachAdb;
    adb_left_offset = 5 ;
  };
  callbacks {
    activate = procedure callback (button_remove_ok);
  };
};

object RemoveCancel : push_button {

  arguments {
      label_label       = "Cancel";
      adb_top_attachment = DwtAttachWidget;
      adb_top_widget = list_box RemoveHostsList;
      adb_top_offset = 5 ;
      adb_bottom_attachment = DwtAttachAdb;
      adb_bottom_offset = 5 ;
      adb_left_attachment = DwtAttachWidget;
    adb_left_widget = push_button RemoveOk;
    adb_left_offset = 5 ;
    adb_right_attachment = DwtAttachAdb;
    adb_right_offset = 5 ;
  };
  callbacks {
    activate = procedure callback (button_remove_cancel);
  };
};

object AddCommand : command_window {
  arguments {
    prompt = ">";
    lines   = 0 ;
    adb_top_attachment = DwtAttachAdb;
    adb_top_offset = 0 ;
    adb_right_attachment = DwtAttachAdb;
    adb_right_offset = 0 ;
    adb_left_attachment = DwtAttachAdb;
    adb_left_offset = 0 ;
  };
  callbacks {
    command_entered = procedure enter (add_command);
  };
};
  

object AddCancel : push_button {

  arguments {
    label_label       = "Cancel";
    adb_top_attachment = DwtAttachWidget;
    adb_top_widget = command_window AddCommand;
    adb_top_offset = 5 ;
    adb_bottom_attachment = DwtAttachAdb;
    adb_bottom_offset = 5 ;
    adb_right_attachment = DwtAttachAdb;
    adb_right_offset = 5 ;
  };
  callbacks {
   activate = procedure callback (button_add_cancel);
  };
};

end module;

