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.

96 lines
2.2KB

  1. /*
  2. * DISTRHO Plugin Toolkit (DPT)
  3. * Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * For a full copy of the license see the LGPL.txt file
  15. */
  16. #ifndef __DGL_WIDGET_HPP__
  17. #define __DGL_WIDGET_HPP__
  18. #include "Geometry.hpp"
  19. START_NAMESPACE_DISTRHO
  20. // -------------------------------------------------
  21. class Window;
  22. class Widget
  23. {
  24. public:
  25. Widget(Window* parent);
  26. virtual ~Widget();
  27. bool isVisible();
  28. void setVisible(bool yesNo);
  29. void show()
  30. {
  31. setVisible(true);
  32. }
  33. void hide()
  34. {
  35. setVisible(false);
  36. }
  37. int getX() const;
  38. int getY() const;
  39. const Point<int>& getPos() const;
  40. void setX(int x);
  41. void setY(int y);
  42. void setPos(int x, int y);
  43. void setPos(const Point<int>& pos);
  44. void move(int x, int y);
  45. void move(const Point<int>& pos);
  46. int getWidth() const;
  47. int getHeight() const;
  48. const Size<int>& getSize() const;
  49. void setWidth(int width);
  50. void setHeight(int height);
  51. void setSize(int width, int height);
  52. void setSize(const Size<int>& size);
  53. const Rectangle<int>& getArea() const;
  54. Window* getParent() const;
  55. void repaint();
  56. protected:
  57. virtual void onDisplay();
  58. virtual bool onKeyboard(bool press, uint32_t key);
  59. virtual bool onMouse(int button, bool press, int x, int y);
  60. virtual bool onMotion(int x, int y);
  61. virtual bool onScroll(float dx, float dy);
  62. virtual bool onSpecial(bool press, Key key);
  63. virtual void onReshape(int width, int height);
  64. virtual void onClose();
  65. private:
  66. Window* fParent;
  67. bool fVisible;
  68. Rectangle<int> fArea;
  69. friend class Window;
  70. };
  71. // -------------------------------------------------
  72. END_NAMESPACE_DISTRHO
  73. #endif // __DGL_WIDGET_HPP__