forms_bitmap.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // "$Id: forms_bitmap.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
  3. //
  4. // Forms compatible bitmap function for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 by Bill Spitzak and others.
  7. //
  8. // This library is free software. Distribution and use rights are outlined in
  9. // the file "COPYING" which should have been included with this file. If this
  10. // file is missing or damaged, see the license at:
  11. //
  12. // http://www.fltk.org/COPYING.php
  13. //
  14. // Please report all bugs and problems on the following page:
  15. //
  16. // http://www.fltk.org/str.php
  17. //
  18. #include <FL/forms.H>
  19. /** Creates a bitmap widget from a box type, position, size and optional label specification */
  20. Fl_FormsBitmap::Fl_FormsBitmap(
  21. Fl_Boxtype t, int X, int Y, int W, int H, const char* l)
  22. : Fl_Widget(X, Y, W, H, l) {
  23. box(t);
  24. b = 0;
  25. color(FL_BLACK);
  26. align(FL_ALIGN_BOTTOM);
  27. }
  28. /** Sets a new bitmap bits with size W,H. Deletes the previous one.*/
  29. void Fl_FormsBitmap::set(int W, int H, const uchar *bits) {
  30. delete b;
  31. bitmap(new Fl_Bitmap(bits, W, H));
  32. }
  33. /** Draws the bitmap and its associated box. */
  34. void Fl_FormsBitmap::draw() {
  35. draw_box(box(), selection_color());
  36. if (b) {fl_color(color()); b->draw(x(), y(), w(), h());}
  37. draw_label();
  38. }
  39. //
  40. // End of "$Id: forms_bitmap.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $".
  41. //