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.

106 lines
2.3KB

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