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.

110 lines
4.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCER_APPEARANCESETTINGS_H_34D762C7__
  19. #define __JUCER_APPEARANCESETTINGS_H_34D762C7__
  20. class AppearanceSettings : private ValueTree::Listener
  21. {
  22. public:
  23. AppearanceSettings (bool updateAppWhenChanged);
  24. bool readFromFile (const File& file);
  25. bool readFromXML (const XmlElement&);
  26. bool writeToFile (const File& file) const;
  27. void updateColourScheme();
  28. void applyToCodeEditor (CodeEditorComponent& editor) const;
  29. StringArray getColourNames() const;
  30. Value getColourValue (const String& colourName);
  31. bool getColour (const String& name, Colour& resultIfFound) const;
  32. Font getCodeFont() const;
  33. Value getCodeFontValue();
  34. ValueTree settings;
  35. static File getSchemesFolder();
  36. StringArray getPresetSchemes();
  37. void refreshPresetSchemeList();
  38. void selectPresetScheme (int index);
  39. static Font getDefaultCodeFont();
  40. static Colour getScrollbarColourForBackground (const Colour& background);
  41. static void showEditorWindow (ScopedPointer<Component>& ownerPointer);
  42. static const char* getSchemeFileSuffix() { return ".scheme"; }
  43. static const char* getSchemeFileWildCard() { return "*.scheme"; }
  44. private:
  45. Array<File> presetSchemeFiles;
  46. static void writeDefaultSchemeFile (const String& xml, const String& name);
  47. void applyToLookAndFeel (LookAndFeel&) const;
  48. void valueTreePropertyChanged (ValueTree&, const Identifier&) { updateColourScheme(); }
  49. void valueTreeChildAdded (ValueTree&, ValueTree&) { updateColourScheme(); }
  50. void valueTreeChildRemoved (ValueTree&, ValueTree&) { updateColourScheme(); }
  51. void valueTreeChildOrderChanged (ValueTree&) { updateColourScheme(); }
  52. void valueTreeParentChanged (ValueTree&) { updateColourScheme(); }
  53. void valueTreeRedirected (ValueTree&) { updateColourScheme(); }
  54. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AppearanceSettings);
  55. };
  56. //==============================================================================
  57. class IntrojucerLookAndFeel : public LookAndFeel
  58. {
  59. public:
  60. IntrojucerLookAndFeel();
  61. int getTabButtonOverlap (int tabDepth);
  62. int getTabButtonSpaceAroundImage();
  63. int getTabButtonBestWidth (TabBarButton& button, int tabDepth);
  64. static Colour getTabBackgroundColour (TabBarButton& button);
  65. void createTabTextLayout (const TabBarButton& button, const Rectangle<int>& textArea, GlyphArrangement& textLayout);
  66. void drawTabButton (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown);
  67. Rectangle<int> getTabButtonExtraComponentBounds (const TabBarButton& button, Rectangle<int>& textArea, Component& comp);
  68. void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int, int) {}
  69. void drawStretchableLayoutResizerBar (Graphics& g, int /*w*/, int /*h*/, bool /*isVerticalBar*/, bool isMouseOver, bool isMouseDragging);
  70. Rectangle<int> getPropertyComponentContentPosition (PropertyComponent&);
  71. bool areScrollbarButtonsVisible() { return false; }
  72. void drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height, bool isScrollbarVertical,
  73. int thumbStartPosition, int thumbSize, bool /*isMouseOver*/, bool /*isMouseDown*/);
  74. };
  75. #endif