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.

102 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. #include <cstdint>
  20. START_NAMESPACE_DGL
  21. // -------------------------------------------------
  22. class App;
  23. class Window;
  24. class Widget
  25. {
  26. public:
  27. Widget(Window* parent);
  28. virtual ~Widget();
  29. bool isVisible();
  30. void setVisible(bool yesNo);
  31. void show()
  32. {
  33. setVisible(true);
  34. }
  35. void hide()
  36. {
  37. setVisible(false);
  38. }
  39. int getX() const;
  40. int getY() const;
  41. const Point<int>& getPos() const;
  42. void setX(int x);
  43. void setY(int y);
  44. void setPos(int x, int y);
  45. void setPos(const Point<int>& pos);
  46. void move(int x, int y);
  47. void move(const Point<int>& pos);
  48. int getWidth() const;
  49. int getHeight() const;
  50. const Size<int>& getSize() const;
  51. void setWidth(int width);
  52. void setHeight(int height);
  53. void setSize(int width, int height);
  54. void setSize(const Size<int>& size);
  55. const Rectangle<int>& getArea() const;
  56. int getModifiers();
  57. App* getApp() const;
  58. Window* getParent() const;
  59. void repaint();
  60. protected:
  61. virtual void onDisplay();
  62. virtual bool onKeyboard(bool press, uint32_t key);
  63. virtual bool onMouse(int button, bool press, int x, int y);
  64. virtual bool onMotion(int x, int y);
  65. virtual bool onScroll(float dx, float dy);
  66. virtual bool onSpecial(bool press, Key key);
  67. virtual void onReshape(int width, int height);
  68. virtual void onClose();
  69. private:
  70. Window* fParent;
  71. bool fVisible;
  72. Rectangle<int> fArea;
  73. friend class Window;
  74. };
  75. // -------------------------------------------------
  76. END_NAMESPACE_DGL
  77. #endif // __DGL_WIDGET_HPP__