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.

58 lines
1.6KB

  1. /*
  2. * Copyright (C) 2018-2019 Rob van den Berg <rghvdberg at gmail dot org>
  3. * Copyright (C) 2020-2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This file is part of CharacterCompressor
  6. *
  7. * Nnjas2 is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * CharacterCompressor is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with CharacterCompressor. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. #ifndef NANO_BUTTON_HPP_INCLUDED
  21. #define NANO_BUTTON_HPP_INCLUDED
  22. #include "NanoVG.hpp"
  23. #include <string>
  24. START_NAMESPACE_DGL
  25. class Button : public NanoSubWidget,
  26. public ButtonEventHandler
  27. {
  28. public:
  29. explicit Button(Widget* parent, ButtonEventHandler::Callback* cb);
  30. void setBackgroundColor(Color color);
  31. void setFontScale(float scale);
  32. void setLabel(const std::string& label);
  33. void setLabelColor(Color color);
  34. protected:
  35. void onNanoDisplay() override;
  36. bool onMouse(const MouseEvent& ev) override;
  37. bool onMotion(const MotionEvent& ev) override;
  38. private:
  39. Color backgroundColor;
  40. Color labelColor;
  41. std::string label;
  42. float fontScale;
  43. DISTRHO_LEAK_DETECTOR(Button)
  44. };
  45. END_NAMESPACE_DGL
  46. #endif // NANO_BUTTON_HPP_INCLUDED