/*------------------------------------------------------------------------------
 src/lib/djWidget/base.cxx

 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

#include "djWidgetBase.h"
#include <djDialog.h>
#include <djFileBrowser.h>
#include <djApp.h>

namespace dj {

const Color colorFg() { return djApp->colorFg(); }
const Color colorBg() { return djApp->colorBg(); }
const Color colorBg2() { return djApp->colorBg2(); }

Fl_Font font() { return djApp->font(); }
Fl_Font fontBold() { return djApp->fontBold(); }
int fontSize() { return djApp->fontSize(); }

void messageDialog(const Str & in)
{
  djApp->messageDialog()->set(in);
  djApp->messageDialog()->show();
}

void questionDialog(
  const Str & message, void * in, Signal<bool>::Callback * callback
) {
  djApp->questionDialog()->set(message);
  djApp->questionDialog()->okSig().set(in, callback);
  djApp->questionDialog()->show();
}

void questionDialogDel(void * in, Signal<bool>::Callback * callback)
{
  djApp->questionDialog()->okSig().del(in, callback);
}

void inputDialog(
  const Str & message, const Str & value,
  void * in, Signal<const Str &>::Callback * callback
) {
  djApp->inputDialog()->set(message);
  djApp->inputDialog()->value(value);
  djApp->inputDialog()->okSig().set(in, callback);
  djApp->inputDialog()->show();
}

void inputDialogDel(void * in, Signal<const Str &>::Callback * callback)
{
  djApp->inputDialog()->okSig().del(in, callback);
}

void fileBrowser(void * in, Signal<const Str &>::Callback * callback)
{
  djApp->fileBrowser()->sig().set(in, callback);
  djApp->fileBrowser()->show();
}

void fileBrowserDel(void * in, Signal<const Str &>::Callback * callback)
{
  djApp->fileBrowser()->sig().del(in, callback);
}

}
