1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-13 00:04:19 +00:00
JUCE/extras/Introjucer/Source/Application/jucer_MainWindow.h
2013-12-29 11:23:13 +00:00

123 lines
4.2 KiB
C++

/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2013 - Raw Material Software Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
#ifndef __JUCER_MAINWINDOW_JUCEHEADER__
#define __JUCER_MAINWINDOW_JUCEHEADER__
#include "../Project/jucer_ProjectContentComponent.h"
//==============================================================================
/**
The big top-level window where everything happens.
*/
class MainWindow : public DocumentWindow,
public ApplicationCommandTarget,
public FileDragAndDropTarget,
public DragAndDropContainer
{
public:
//==============================================================================
MainWindow();
~MainWindow();
//==============================================================================
void closeButtonPressed() override;
//==============================================================================
bool canOpenFile (const File& file) const;
bool openFile (const File& file);
void setProject (Project* newProject);
Project* getProject() const { return currentProject; }
void makeVisible();
void restoreWindowPosition();
bool closeProject (Project* project);
bool closeCurrentProject();
void showNewProjectWizard();
bool isInterestedInFileDrag (const StringArray& files) override;
void filesDropped (const StringArray& filenames, int mouseX, int mouseY) override;
void activeWindowStatusChanged() override;
void updateTitle (const String& documentName);
ProjectContentComponent* getProjectContentComponent() const;
//==============================================================================
ApplicationCommandTarget* getNextCommandTarget() override;
void getAllCommands (Array <CommandID>& commands) override;
void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) override;
bool perform (const InvocationInfo& info) override;
bool shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails,
StringArray& files, bool& canMoveFiles) override;
private:
ScopedPointer <Project> currentProject;
static const char* getProjectWindowPosName() { return "projectWindowPos"; }
void createProjectContentCompIfNeeded();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
};
//==============================================================================
class MainWindowList
{
public:
MainWindowList();
void forceCloseAllWindows();
bool askAllWindowsToClose();
void closeWindow (MainWindow*);
void createWindowIfNoneAreOpen();
void openDocument (OpenDocumentManager::Document*, bool grabFocus);
bool openFile (const File& file);
MainWindow* createNewMainWindow();
MainWindow* getOrCreateFrontmostWindow();
MainWindow* getOrCreateEmptyWindow();
Project* getFrontmostProject();
void reopenLastProjects();
void saveCurrentlyOpenProjectList();
void updateAllWindowTitles();
void avoidSuperimposedWindows (MainWindow*);
void sendLookAndFeelChange();
OwnedArray<MainWindow> windows;
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindowList)
};
#endif // __JUCER_MAINWINDOW_JUCEHEADER__