// generated by Fast Light User Interface Designer (fluid) version 1.0107
#include <config.h>
#include <global.hpp>
#include <wrap_bracket_dialog.hpp>

/*
#define WRAP_BRACKET_PARENTHESES 0
#define WRAP_BRACKET_BOX         1
*/


void wrap_molecule_dialog_cb(Fl_Widget* w, void* d){
  Fl_Double_Window* win=dynamic_cast<Fl_Double_Window*>(w->parent());
  win->hide();
}


int make_wrap_molecule_dialog(bool& merge, bool& free_wrap) {
 Fl_Menu_Item the_menu_item[] = {
     {"parentheses", 0, 0, reinterpret_cast<void*>(WRAP_BRACKET_PARENTHESES)},
     {"box bracket", 0, 0, reinterpret_cast<void*>(WRAP_BRACKET_BOX)},
     {"braces",0, 0, reinterpret_cast<void*>(WRAP_BRACKET_CURLY)},
     {0}
 };

 Fl_Double_Window* w=new Fl_Double_Window(300, 120, "Wrap in bracket");
 w->box(FL_ENGRAVED_BOX);
 
 int menu_w=LARG_BUTTON_DEFAULT*3;


 Fl_Menu_Button*  menb=new Fl_Menu_Button(w->w()/2-menu_w/2, 
                                          5, menu_w,
                                          LARG_BUTTON_DEFAULT, "Type");

 menb->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
 menb->copy(the_menu_item);


 Fl_Check_Button* merge_chk=new Fl_Check_Button(2,LARG_BUTTON_DEFAULT, 
                                            menu_w, LARG_BUTTON_DEFAULT, "merge with molecule");

 Fl_Check_Button* free_wrap_chk=new Fl_Check_Button(2,LARG_BUTTON_DEFAULT*2, 
                                                menu_w, LARG_BUTTON_DEFAULT, "free wrapping");

 
 Fl_Button* ok=new Fl_Button(w->w()/2 - 105/2, w->h() - 30, 105, 25, "OK");
 ok->callback(wrap_molecule_dialog_cb);

 w->add(menb); 
 w->add(merge_chk);
 w->add(free_wrap_chk);
 w->add(ok);
 w->end();
 w->set_modal();
 w->show();
 
 while(w->shown()){
   Fl::wait();  
 }
 

 merge=merge_chk->value(); 
 free_wrap=free_wrap_chk->value();

 const Fl_Menu_Item* the_type=menb->mvalue();
 WRAP_BRACKET_SIZE_USER_DATA_MENU type_br=reinterpret_cast<WRAP_BRACKET_SIZE_USER_DATA_MENU>(the_type->user_data());

 return type_br;
}
