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.

99 lines
3.5KB

  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. class Project;
  17. class CompileEngineChildProcess;
  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. void updateExporters() noexcept;
  34. String getSelectedExporterName() const noexcept;
  35. bool canCurrentExporterLaunchProject() const noexcept;
  36. void sidebarTabsWidthChanged (int newWidth) noexcept;
  37. private:
  38. //==============================================================================
  39. void changeListenerCallback (ChangeBroadcaster* source) override;
  40. void valueChanged (Value&) override;
  41. void timerCallback() override;
  42. //==============================================================================
  43. void valueTreeChildAdded (ValueTree& parentTree, ValueTree&) override { updateIfNeeded (parentTree); }
  44. void valueTreeChildRemoved (ValueTree& parentTree, ValueTree&, int) override { updateIfNeeded (parentTree); }
  45. void valueTreeChildOrderChanged (ValueTree& parentTree, int, int) override { updateIfNeeded (parentTree); }
  46. void updateIfNeeded (ValueTree tree) noexcept
  47. {
  48. if (tree == exportersTree)
  49. updateExporters();
  50. }
  51. //==============================================================================
  52. void initialiseButtons() noexcept;
  53. void updateName() noexcept;
  54. void updateExporterButton() noexcept;
  55. //==============================================================================
  56. void buildPing();
  57. void buildFinished (bool);
  58. void setRunAppButtonState (bool);
  59. //==============================================================================
  60. int tabsWidth = 200;
  61. bool isBuilding = false;
  62. Project* project = nullptr;
  63. ValueTree exportersTree;
  64. Value projectNameValue;
  65. ComboBox exporterBox;
  66. Label configLabel { "Config Label", "Selected exporter" },
  67. projectNameLabel;
  68. std::unique_ptr<ImageComponent> juceIcon;
  69. std::unique_ptr<IconButton> projectSettingsButton, saveAndOpenInIDEButton, runAppButton;
  70. ReferenceCountedObjectPtr<CompileEngineChildProcess> childProcess;
  71. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HeaderComponent)
  72. };