// generated by Fast Light User Interface Designer (fluid) version 2.0100

#include "eiconsconf.h"
/*
 * $Id$
 *
 * Icon properties (for eiconman - the EDE desktop)
 * Part of Equinox Desktop Environment (EDE).
 * Copyright (c) 2000-2006 EDE Authors.
 *
 * This program is licenced under terms of the
 * GNU General Public Licence version 2 or newer.
 * See COPYING for details.
 */
#include <fltk/ColorChooser.h>
#include "../edelib2/NLS.h"
#include "../edeconf.h"
#include "eicon.h"

fltk::Window *iconsConfWindow=(fltk::Window *)0;

static void cb_OK(fltk::Button*, void*) {
  writeIconsConfiguration();
  sendUpdateInfo();
  exit(0);
}

static void cb_Cancel(fltk::Button*, void*) {
  exit(0);
}

static void cb_Apply(fltk::Button*, void*) {
  writeIconsConfiguration();
  sendUpdateInfo();
}

fltk::Button *colorButton=(fltk::Button *)0;

static void cb_colorButton(fltk::Button*, void*) {
  changeBoxColor(colorButton);
  label_background = (int) colorButton->color();
}

fltk::Button *colorButton1=(fltk::Button *)0;

static void cb_colorButton1(fltk::Button*, void*) {
  changeBoxColor(colorButton1);
  label_foreground = (int) colorButton1->color();
}

fltk::ValueSlider *maxWidthSlider=(fltk::ValueSlider *)0;

static void cb_maxWidthSlider(fltk::ValueSlider*, void*) {
  label_maxwidth = (int) maxWidthSlider->value();
}

fltk::ValueSlider *fontsizeSlider=(fltk::ValueSlider *)0;

static void cb_fontsizeSlider(fltk::ValueSlider*, void*) {
  label_fontsize = (int)  fontsizeSlider->value();
}

fltk::ValueSlider *gridspaceSlider=(fltk::ValueSlider *)0;

static void cb_gridspaceSlider(fltk::ValueSlider*, void*) {
  label_gridspacing = (int) gridspaceSlider->value();
}

fltk::CheckButton *autoArrButton=(fltk::CheckButton *)0;

static void cb_autoArrButton(fltk::CheckButton* o, void*) {
  auto_arr = (o->value()>0);
}

fltk::CheckButton *engageButton=(fltk::CheckButton *)0;

static void cb_engageButton(fltk::CheckButton*, void*) {
  label_engage_1click = (int) engageButton->value();
}

fltk::CheckButton *bg_color_check=(fltk::CheckButton *)0;

static void cb_bg_color_check(fltk::CheckButton* o, void*) {
  if(o->value()) colorButton->activate();
  else colorButton->deactivate();
  label_trans = (o->value()==0);
}

#include <fltk/run.h>

int main (int argc, char **argv) {

  fltk::Window* w;
  //fl_init_locale_support("eiconsconf", PREFIX"/share/locale");
  readIconsConfiguration();
   {fltk::Window* o = iconsConfWindow = new fltk::Window(265, 310, "Icons settings");
    w = o;
    o->set_vertical();
    o->begin();
     {fltk::Button* o = new fltk::Button(25, 277, 75, 25, "&OK");
      o->callback((fltk::Callback*)cb_OK);
    }
     {fltk::Button* o = new fltk::Button(185, 277, 75, 25, "&Cancel");
      o->callback((fltk::Callback*)cb_Cancel);
    }
     {fltk::Button* o = new fltk::Button(105, 277, 75, 25, "&Apply");
      o->callback((fltk::Callback*)cb_Apply);
    }
     {fltk::TabGroup* o = new fltk::TabGroup(1, 5, 259, 262);
      o->set_vertical();
      o->color((fltk::Color)0xfffffffe);
      o->begin();
       {fltk::Group* o = new fltk::Group(0, 20, 255, 239, "Look&&feel");
        o->begin();
         {fltk::Button* o = colorButton = new fltk::Button(164, 20, 60, 18, "Background color: ");
          o->callback((fltk::Callback*)cb_colorButton);
          o->align(fltk::ALIGN_LEFT);
          o->color((fltk::Color)label_background);
          if(label_trans) o->deactivate();
        }
         {fltk::Button* o = colorButton1 = new fltk::Button(164, 45, 60, 18, "Label color: ");
          o->callback((fltk::Callback*)cb_colorButton1);
          o->align(fltk::ALIGN_LEFT);
          o->color((fltk::Color) label_foreground);
        }
         {fltk::ValueSlider* o = maxWidthSlider = new fltk::ValueSlider(114, 78, 125, 20, "Maximum width: ");
          o->minimum(48);
          o->maximum(200);
          o->step(1);
          o->value(50);
          o->slider_size(10);
          o->callback((fltk::Callback*)cb_maxWidthSlider);
          o->align(fltk::ALIGN_LEFT);
          o->value(label_maxwidth);
        }
         {fltk::ValueSlider* o = fontsizeSlider = new fltk::ValueSlider(114, 108, 125, 20, "Font height: ");
          o->type(fltk::ValueSlider::TICK_ABOVE);
          o->minimum(8);
          o->maximum(48);
          o->step(1);
          o->value(10);
          o->slider_size(10);
          o->callback((fltk::Callback*)cb_fontsizeSlider);
          o->align(fltk::ALIGN_LEFT);
          o->value(label_fontsize);
        }
         {fltk::ValueSlider* o = gridspaceSlider = new fltk::ValueSlider(114, 138, 125, 20, "Grid spacing: ");
          o->type(fltk::ValueSlider::TICK_ABOVE);
          o->minimum(1);
          o->maximum(50);
          o->step(1);
          o->value(10);
          o->slider_size(10);
          o->callback((fltk::Callback*)cb_gridspaceSlider);
          o->align(fltk::ALIGN_LEFT);
          o->value(label_gridspacing);
        }
         {fltk::CheckButton* o = autoArrButton = new fltk::CheckButton(24, 198, 222, 20, "Auto arrange icons");
          o->callback((fltk::Callback*)cb_autoArrButton);
          o->value(auto_arr);
        }
         {fltk::CheckButton* o = engageButton = new fltk::CheckButton(24, 173, 222, 20, "Engage with just one click");
          o->callback((fltk::Callback*)cb_engageButton);
          o->value(label_engage_1click);
        }
         {fltk::CheckButton* o = bg_color_check = new fltk::CheckButton(226, 20, 20, 18);
          o->callback((fltk::Callback*)cb_bg_color_check);
          o->tooltip("Clear this, to get transparent background.");
          if(!label_trans) o->set();
        }
        o->end();
      }
      o->end();
    }
    o->end();
    o->resizable(o);
  }
  w->show(argc, argv);
  return  fltk::run();
}

void changeBoxColor(fltk::Button *box) {
  //Fl_Button *colorBox = box;
  fltk::Color oldColor = box->color();
  fltk::Color defColor = oldColor;
  fltk::color_chooser(_("Choose color"), defColor);
  if ( defColor != oldColor ) {
  	box->color(defColor);
  	box->redraw();
  }
}
