Audio plugin host https://kx.studio/carla
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.

84 lines
2.3KB

  1. /*
  2. * DISTRHO Plugin Toolkit (DPT)
  3. * Copyright (C) 2012-2013 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. // FIXME: 32bit hack
  18. #if ! (defined (__LP64__) || defined (_LP64) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
  19. # define PAD_SIZE +1
  20. #else
  21. # define PAD_SIZE
  22. #endif
  23. START_NAMESPACE_DGL
  24. // -----------------------------------------------------------------------
  25. ImageAboutWindow::ImageAboutWindow(App* app, Window* parent, const Image& image)
  26. : Window(app, parent),
  27. Widget(this),
  28. fImgBackground(image)
  29. {
  30. Window::setSize(image.getWidth(), image.getHeight() PAD_SIZE);
  31. Window::setWindowTitle("About");
  32. }
  33. ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image)
  34. : Window(widget->getApp(), widget->getParent()),
  35. Widget(this),
  36. fImgBackground(image)
  37. {
  38. Window::setSize(image.getWidth(), image.getHeight() PAD_SIZE);
  39. Window::setWindowTitle("About");
  40. }
  41. void ImageAboutWindow::setImage(const Image& image)
  42. {
  43. fImgBackground = image;
  44. Window::setSize(image.getWidth(), image.getHeight() PAD_SIZE);
  45. }
  46. void ImageAboutWindow::onDisplay()
  47. {
  48. fImgBackground.draw();
  49. }
  50. bool ImageAboutWindow::onMouse(int, bool press, int, int)
  51. {
  52. if (press)
  53. {
  54. Window::close();
  55. return true;
  56. }
  57. return false;
  58. }
  59. bool ImageAboutWindow::onKeyboard(bool press, uint32_t key)
  60. {
  61. if (press && key == DGL_CHAR_ESCAPE)
  62. {
  63. Window::close();
  64. return true;
  65. }
  66. return false;
  67. }
  68. // -----------------------------------------------------------------------
  69. END_NAMESPACE_DGL