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.

104 lines
2.7KB

  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. #include <FL/Fl_Multiline_Output.h>
  23. static const int GUI_COLOUR = 154;
  24. static const int GUIBG_COLOUR = 144;
  25. static const int GUIBG2_COLOUR = 145;
  26. SpiralPluginGUI::SpiralPluginGUI(int w, int h, SpiralPlugin* o, ChannelHandler *ch) :
  27. SpiralGUIType(0,0,w,h,""),
  28. m_HelpWin(NULL)
  29. {
  30. Fl::visible_focus(false);
  31. m_GUICH = ch;
  32. box(FL_THIN_UP_BOX);
  33. m_DragBar = new Fl_DragBar(0,0,w,15,o->GetName().c_str());
  34. m_DragBar->labelsize(10);
  35. m_DragBar->type(Fl_DragBar::FLDRAG);
  36. add(m_DragBar);
  37. m_Hide = new Fl_Button(0,0,18,16,"X");
  38. m_Hide->labeltype(FL_ENGRAVED_LABEL);
  39. m_Hide->labelsize(10);
  40. m_Hide->box(FL_NO_BOX);
  41. m_Hide->callback((Fl_Callback*)cb_Hide);
  42. add(m_Hide);
  43. m_Help = new Fl_Button(w-15,0,18,16,"?");
  44. m_Help->labeltype(FL_ENGRAVED_LABEL);
  45. m_Help->labelsize(10);
  46. m_Help->box(FL_NO_BOX);
  47. m_Help->callback((Fl_Callback*)cb_Help);
  48. add(m_Help);
  49. }
  50. SpiralPluginGUI::~SpiralPluginGUI()
  51. {
  52. // Needed to properly remove the window.
  53. Fl::check();
  54. }
  55. void SpiralPluginGUI::Update()
  56. {
  57. }
  58. const string SpiralPluginGUI::GetHelpText()
  59. {
  60. return "Help! I need some helptext!!!";
  61. }
  62. //// Callbacks ////
  63. inline void SpiralPluginGUI::cb_Hide_i(Fl_Button* o, void* v)
  64. { hide(); }
  65. void SpiralPluginGUI::cb_Hide(Fl_Button* o, void* v)
  66. { ((SpiralPluginGUI*)(o->parent()))->cb_Hide_i(o,v); }
  67. inline void SpiralPluginGUI::cb_Help_i(Fl_Button* o, void* v)
  68. {
  69. if (m_HelpWin==NULL)
  70. {
  71. int w=300,h=200;
  72. m_HelpWin = new Fl_Double_Window(w,h,"Help");
  73. Fl_Multiline_Output* text= new Fl_Multiline_Output(0,0,w,h);
  74. text->value(GetHelpText().c_str());
  75. text->textsize(10);
  76. text->set_output();
  77. m_HelpWin->add(text);
  78. m_HelpWin->show();
  79. }
  80. else
  81. {
  82. m_HelpWin->hide();
  83. delete m_HelpWin;
  84. }
  85. }
  86. void SpiralPluginGUI::cb_Help(Fl_Button* o, void* v)
  87. { ((SpiralPluginGUI*)(o->parent()))->cb_Help_i(o,v); }