Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
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.

66 lines
2.5KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2009 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. /* wrap a widget in a group as wide as the widget's label. This is
  19. * useful when you want to put labeled widgets into a pack */
  20. #include <FL/Fl_Widget.H>
  21. #include <FL/Fl_Group.H>
  22. #include <FL/fl_draw.H>
  23. class Fl_Labelpad_Group : public Fl_Group
  24. {
  25. public:
  26. Fl_Labelpad_Group ( Fl_Widget *o ) : Fl_Group( 0, 0, 50, 50, 0 )
  27. {
  28. resizable( 0 );
  29. end();
  30. add( o );
  31. fl_font( FL_HELVETICA, o->labelsize() );
  32. int W, H;
  33. W = fl_width( o->label() );
  34. H = fl_height();
  35. // fl_measure( w->label(), H, W );
  36. // set size to contain widget
  37. size( W > o->w() ? W : o->w(), o->h() + H );
  38. // center widget in group
  39. if ( o->align() & FL_ALIGN_TOP )
  40. o->position( x() + w() / 2 - (o->w() / 2 ), y() + H );
  41. else if ( o->align() & FL_ALIGN_BOTTOM )
  42. o->position( x() + w() / 2 - (o->w() / 2 ), y() );
  43. else
  44. {
  45. /* TODO: other alignments */
  46. }
  47. }
  48. virtual ~Fl_Labelpad_Group ( )
  49. {
  50. }
  51. };