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.

71 lines
2.0KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2019 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 "DistrhoUI.hpp"
  17. #include "DemoWidgetBanner.hpp"
  18. #include "DemoWidgetClickable.hpp"
  19. #include "Window.hpp"
  20. START_NAMESPACE_DISTRHO
  21. class CairoExampleUI : public UI
  22. {
  23. public:
  24. CairoExampleUI()
  25. : UI(200, 200)
  26. {
  27. DemoWidgetClickable* widgetClickable = new DemoWidgetClickable(this);
  28. fWidgetClickable = widgetClickable;
  29. widgetClickable->setSize(50, 50);
  30. widgetClickable->setAbsolutePos(100, 100);
  31. DemoWidgetBanner* widgetBanner = new DemoWidgetBanner(this);
  32. fWidgetBanner = widgetBanner;
  33. widgetBanner->setSize(180, 80);
  34. widgetBanner->setAbsolutePos(10, 10);
  35. }
  36. ~CairoExampleUI()
  37. {
  38. }
  39. void onDisplay()
  40. {
  41. cairo_t* cr = getParentWindow().getGraphicsContext().cairo;
  42. cairo_set_source_rgb(cr, 1.0, 0.8, 0.5);
  43. cairo_paint(cr);
  44. }
  45. void parameterChanged(uint32_t index, float value)
  46. {
  47. // unused
  48. (void)index;
  49. (void)value;
  50. }
  51. private:
  52. ScopedPointer<DemoWidgetClickable> fWidgetClickable;
  53. ScopedPointer<DemoWidgetBanner> fWidgetBanner;
  54. };
  55. UI* createUI()
  56. {
  57. return new CairoExampleUI;
  58. }
  59. END_NAMESPACE_DISTRHO