Example #1
0
void create_about_tab(int x, int y, int w, int h)
{
  int              border;
  Fl_Text_Display *ptext;
  Fl_Text_Buffer  *pbuff;

  Fl_Group *group1 = new Fl_Group(x, y, w, h, "About");
  {
    border = 10;
    ptext = new Fl_Text_Display(x + border, y + border, w - 3 * border, h - 3 * border);
    pbuff = new Fl_Text_Buffer();
    ptext->buffer(pbuff);
    ptext->textcolor(fl_rgb_color(85, 170, 255));
    ptext->color(fl_rgb_color(8, 7, 5));
    pbuff->text("\n"
		" BMS manager Feb 2016.\n"
		" Part of SombreroBMS (battery management system)\n"
		" Copyright 2016 Patrick Xavier Areny\n"
		"\n"
		"\n"
		" Used libraries:\n"
		"\n"
		"  Tinyxml    \tLee Thomason\n"
		"  FLTK       \twww.fltk.org\n"
		"  OpenGl     \tKhronos group\n"
		"\n"
		"\n"
		" Used font: "
		"\n"
		"\n"
		" VeraMono ttf, Bitstream, Inc.\n"
		"\n");
  }
  group1->end();
}
Example #2
0
int about()
{
  Fl_Group *g1, *g2;
  Fl_Box *box, *dummy;
  Fl_Text_Display *display;
  Fl_Return_Button *but_close;
  Fl_Button *but_lic, *but_hp;
  const int w = 500, h = 500;
  int range_w = 40;

  Fl_PNG_Image *logo = new Fl_PNG_Image(NULL, fltk_png, fltk_png_len);
  int logo_h = logo->h();

  win = new Fl_Double_Window(w, h, "FLTK dialog");
  win->callback(close_cb);
  {
    box = new Fl_Box(0, 20, w, logo_h);
    box->box(FL_NO_BOX);
    box->image(logo);

    g1 = new Fl_Group(10, logo_h + 40, w - 20, h - logo_h - 90);
    {
      buffer = new Fl_Text_Buffer();
      display = new Fl_Text_Display(10, logo_h + 40, w - 20, h - logo_h - 90);
      display->buffer(buffer);
      buffer->text(text);
    }
    g1->end();

    g2 = new Fl_Group(0, h - 40, w, 40);
    {
      int but_w = measure_button_width(label_license, 20);
      but_lic = new Fl_Button(10, h - 40, but_w, 28, label_license);
      but_lic->callback(callback);
      range_w += but_w;

      const char *label_homepage = "Homepage";
      but_w = measure_button_width(label_homepage, 20);
      but_hp = new Fl_Button(but_lic->w() + 20, h - 40, but_w, 28, label_homepage);
      but_hp->callback(url_cb);
      range_w += but_w;

      but_w = measure_button_width(fl_close, 40);
      but_close = new Fl_Return_Button(w - but_w - 10, h - 40, but_w, 28, fl_close);
      but_close->callback(close_cb);
      range_w += but_w;

      dummy = new Fl_Box(but_close->x() - 1, h - 40, 1, 1);
      dummy->box(FL_NO_BOX);
    }
    g2->resizable(dummy);
    g2->end();
  }
  run_window(win, g1, range_w, logo_h + 130);

  return 0;
}
Example #3
0
/*
=========================================================================
Checks for errors and updates icon.
=========================================================================
*/
void VTLpt::ShowErrors(void)
{
	int		c, count;

	if (m_pActivePrinter == NULL)
		return;

	count = m_pActivePrinter->GetErrorCount();

	if (count == 1)
	{
		fl_message("%s", (const char *) m_pActivePrinter->GetError(0));
	}
	else
	{
		Fl_Text_Buffer* tb = new Fl_Text_Buffer();
		for (c = 0; c < count; c++)
		{
			tb->append(m_pActivePrinter->GetError(c));
			tb->append("\n");
		}
		Fl_Window*	o = new Fl_Window(500, 300, "Printer Errors");
		Fl_Text_Display* td = new Fl_Text_Display(0, 0, 500, 300, "");
		td->buffer(tb);
		o->show();
	}

	// Clear the errors
	m_pActivePrinter->ClearErrors();

	// Set the icon back to normal
	gpPrint->set_image(&gPrinterIcon);
	gpPrint->label("Idle");
	m_PortStatus = LPT_STATUS_IDLE;
	gPrintMenu[3].flags = FL_MENU_INVISIBLE;
	gAnimationNeeded = FALSE;
	m_animIconIndex = 1;

	// Report port status change
	if (m_pMonCallback != NULL)
		m_pMonCallback(LPT_MON_PORT_STATUS_CHANGE, 0);
}
Example #4
0
int main() {
	DirWatch::init();

	win = new Fl_Window(380, 360, "Directory watch test");
	win->begin();
		dirlist = new Fl_Multi_Browser(10, 32, 360, 175, "Watched directories");
		dirlist->align(FL_ALIGN_TOP_LEFT);

		Fl_Text_Display* td = new Fl_Text_Display(10, 217, 360, 98);
		tlog = new Fl_Text_Buffer();
		td->buffer(tlog);

		if(DirWatch::notifier() == DW_FAM)
			tlog->append("Loaded with FAM\n");
		else if(DirWatch::notifier() == DW_INOTIFY)
			tlog->append("Loaded with inotify\n");
		else
			tlog->append("Loaded with none notifier\n");

		Fl_Button* badd = new Fl_Button(80, 325, 90, 25, "&Add");
		badd->callback(add_cb);

		Fl_Button* bremove = new Fl_Button(175, 325, 90, 25, "&Remove");
		bremove->callback(remove_cb);

		Fl_Button* bclose = new Fl_Button(280, 325, 90, 25, "&Close");
		bclose->callback(close_cb);
	win->end();
	win->show();

	DirWatch::callback(notify_cb, tlog);

	Fl::run();
	DirWatch::shutdown();

	return 0;
}