The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

95 lines
4.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. #pragma once
  20. //==============================================================================
  21. class ProjucerLookAndFeel : public LookAndFeel_V4
  22. {
  23. public:
  24. ProjucerLookAndFeel();
  25. ~ProjucerLookAndFeel();
  26. void drawTabButton (TabBarButton& button, Graphics&, bool isMouseOver, bool isMouseDown) override;
  27. int getTabButtonBestWidth (TabBarButton&, int tabDepth) override;
  28. void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int, int) override {}
  29. void drawPropertyComponentBackground (Graphics&, int, int, PropertyComponent&) override {}
  30. void drawPropertyComponentLabel (Graphics&, int width, int height, PropertyComponent&) override;
  31. Rectangle<int> getPropertyComponentContentPosition (PropertyComponent&) override;
  32. void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
  33. bool isMouseOverButton, bool isButtonDown) override;
  34. void drawButtonText (Graphics&, TextButton&, bool isMouseOverButton, bool isButtonDown) override;
  35. void drawToggleButton (Graphics&, ToggleButton&, bool isMouseOverButton, bool isButtonDown) override;
  36. void drawTextEditorOutline (Graphics&, int, int, TextEditor&) override {}
  37. void fillTextEditorBackground (Graphics&, int width, int height, TextEditor&) override;
  38. void layoutFileBrowserComponent (FileBrowserComponent&, DirectoryContentsDisplayComponent*,
  39. FilePreviewComponent*, ComboBox* currentPathBox,
  40. TextEditor* filenameBox,Button* goUpButton) override;
  41. void drawFileBrowserRow (Graphics&, int width, int height, const File&, const String& filename, Image* icon,
  42. const String& fileSizeDescription, const String& fileTimeDescription,
  43. bool isDirectory, bool isItemSelected, int itemIndex, DirectoryContentsDisplayComponent&) override;
  44. void drawCallOutBoxBackground (CallOutBox&, Graphics&, const Path&, Image&) override;
  45. void drawMenuBarBackground (Graphics&, int width, int height, bool isMouseOverBar, MenuBarComponent&) override;
  46. void drawMenuBarItem (Graphics&, int width, int height,
  47. int itemIndex, const String& itemText,
  48. bool isMouseOverItem, bool isMenuOpen, bool isMouseOverBar,
  49. MenuBarComponent&) override;
  50. void drawResizableFrame (Graphics&, int w, int h, const BorderSize<int>&) override;
  51. void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
  52. int buttonX, int buttonY, int buttonW, int buttonH,
  53. ComboBox&) override;
  54. void drawTreeviewPlusMinusBox (Graphics&, const Rectangle<float>& area,
  55. Colour backgroundColour, bool isItemOpen, bool isMouseOver) override;
  56. void drawProgressBar (Graphics&, ProgressBar&, int width, int height, double progress, const String& textToShow) override;
  57. //==============================================================================
  58. static Path getArrowPath (Rectangle<float> arrowZone, const int direction,
  59. const bool filled, const Justification justification);
  60. static Path getChoiceComponentArrowPath (Rectangle<float> arrowZone);
  61. static Font getPropertyComponentFont() { return { 14.0f, Font::FontStyleFlags::bold }; }
  62. static int getTextWidthForPropertyComponent (PropertyComponent* pp) { return jmin (200, pp->getWidth() / 2); }
  63. //==============================================================================
  64. void setupColours();
  65. private:
  66. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjucerLookAndFeel)
  67. };