DISTRHO Plugin Framework
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.

79 lines
2.3KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "../ImageAboutWindow.hpp"
  17. START_NAMESPACE_DGL
  18. // -----------------------------------------------------------------------
  19. ImageAboutWindow::ImageAboutWindow(App& app, Window& parent, const Image& image)
  20. : Window(app, parent),
  21. Widget((Window&)*this),
  22. fImgBackground(image)
  23. {
  24. Window::setResizable(false);
  25. Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
  26. Window::setTitle("About");
  27. }
  28. ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image)
  29. : Window(widget->getParentApp(), widget->getParentWindow()),
  30. Widget((Window&)*this),
  31. fImgBackground(image)
  32. {
  33. Window::setResizable(false);
  34. Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
  35. Window::setTitle("About");
  36. }
  37. void ImageAboutWindow::setImage(const Image& image)
  38. {
  39. fImgBackground = image;
  40. Window::setSize(static_cast<unsigned int>(image.getWidth()), static_cast<unsigned int>(image.getHeight()));
  41. }
  42. void ImageAboutWindow::onDisplay()
  43. {
  44. fImgBackground.draw();
  45. }
  46. bool ImageAboutWindow::onMouse(int, bool press, int, int)
  47. {
  48. if (press)
  49. {
  50. Window::close();
  51. return true;
  52. }
  53. return false;
  54. }
  55. bool ImageAboutWindow::onKeyboard(bool press, uint32_t key)
  56. {
  57. if (press && key == CHAR_ESCAPE)
  58. {
  59. Window::close();
  60. return true;
  61. }
  62. return false;
  63. }
  64. // -----------------------------------------------------------------------
  65. END_NAMESPACE_DGL