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.

109 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. #include "../../Application/jucer_Headers.h"
  15. #include "../../Utility/UI/jucer_IconButton.h"
  16. #include "../../Utility/UI/jucer_UserSettingsPopup.h"
  17. class Project;
  18. //==============================================================================
  19. class HeaderComponent : public Component,
  20. private ValueTree::Listener,
  21. private ChangeListener,
  22. private Value::Listener,
  23. private Timer
  24. {
  25. public:
  26. HeaderComponent();
  27. ~HeaderComponent() override;
  28. //==============================================================================
  29. void resized() override;
  30. void paint (Graphics&) override;
  31. //==============================================================================
  32. void setCurrentProject (Project*) noexcept;
  33. //==============================================================================
  34. void updateExporters() noexcept;
  35. String getSelectedExporterName() const noexcept;
  36. bool canCurrentExporterLaunchProject() const noexcept;
  37. //==============================================================================
  38. int getUserButtonWidth() const noexcept;
  39. void sidebarTabsWidthChanged (int newWidth) noexcept;
  40. //==============================================================================
  41. void showUserSettings() noexcept;
  42. private:
  43. //==============================================================================
  44. void lookAndFeelChanged() override;
  45. void changeListenerCallback (ChangeBroadcaster* source) override;
  46. void valueChanged (Value&) override;
  47. void timerCallback() override;
  48. //==============================================================================
  49. void valueTreeChildAdded (ValueTree& parentTree, ValueTree&) override { updateIfNeeded (parentTree); }
  50. void valueTreeChildRemoved (ValueTree& parentTree, ValueTree&, int) override { updateIfNeeded (parentTree); }
  51. void valueTreeChildOrderChanged (ValueTree& parentTree, int, int) override { updateIfNeeded (parentTree); }
  52. void updateIfNeeded (ValueTree tree) noexcept
  53. {
  54. if (tree == exportersTree)
  55. updateExporters();
  56. }
  57. //==============================================================================
  58. void initialiseButtons() noexcept;
  59. void updateName() noexcept;
  60. void updateExporterButton() noexcept;
  61. void updateUserAvatar() noexcept;
  62. //==============================================================================
  63. void buildPing();
  64. void buildFinished (bool);
  65. void setRunAppButtonState (bool);
  66. //==============================================================================
  67. int tabsWidth = 200;
  68. bool isBuilding = false;
  69. Project* project = nullptr;
  70. ValueTree exportersTree;
  71. Value projectNameValue;
  72. ComboBox exporterBox;
  73. Label configLabel { "Config Label", "Selected exporter" },
  74. projectNameLabel;
  75. std::unique_ptr<ImageComponent> juceIcon;
  76. std::unique_ptr<IconButton> projectSettingsButton, saveAndOpenInIDEButton, userSettingsButton, runAppButton;
  77. SafePointer<CallOutBox> userSettingsWindow;
  78. ReferenceCountedObjectPtr<CompileEngineChildProcess> childProcess;
  79. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HeaderComponent)
  80. };