You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.9KB

  1. /* SpiralPlugin
  2. * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #include "SpiralPluginGUI.h"
  19. #include "SpiralPlugin.h"
  20. #include <FL/fl_draw.h>
  21. #include <FL/fl_draw.H>
  22. static const int GUI_COLOUR = 154;
  23. static const int GUIBG_COLOUR = 144;
  24. static const int GUIBG2_COLOUR = 145;
  25. SpiralPluginGUI::SpiralPluginGUI(int w, int h, SpiralPlugin* o) :
  26. SpiralGUIType(0,0,w,h,"")
  27. {
  28. Fl::visible_focus(false);
  29. box(FL_THIN_UP_BOX);
  30. //clear_border();
  31. m_DragBar = new Fl_DragBar(0,0,w,20,o->GetName().c_str());
  32. m_DragBar->type(Fl_DragBar::FLDRAG);
  33. add(m_DragBar);
  34. m_Hide = new Fl_Button(2,2,18,16,"X");
  35. m_Hide->labeltype(FL_ENGRAVED_LABEL);
  36. m_Hide->box(FL_NO_BOX);
  37. m_Hide->callback((Fl_Callback*)cb_Hide);
  38. add(m_Hide);
  39. }
  40. SpiralPluginGUI::~SpiralPluginGUI()
  41. {
  42. // Needed to properly remove the window.
  43. Fl::check();
  44. }
  45. // This could be improved.
  46. void SpiralPluginGUI::draw()
  47. {
  48. if (GetPlugin()->ValueChanged())
  49. {
  50. UpdateValues();
  51. }
  52. SpiralGUIType::draw();
  53. }
  54. //// Callbacks ////
  55. inline void SpiralPluginGUI::cb_Hide_i(Fl_Button* o, void* v)
  56. { hide(); }
  57. void SpiralPluginGUI::cb_Hide(Fl_Button* o, void* v)
  58. { ((SpiralPluginGUI*)(o->parent()))->cb_Hide_i(o,v); }