2
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3
* http://www.gnu.org/licenses/lgpl-3.0.html
10
#include <wx/filename.h>
15
* @brief A workspace class.
17
* Workspaces are just collections of projects. By loading a workspace,
18
* all the projects it contains are loaded.\n
19
* There is always a workspace open. The default one does not contain any projects.\n
20
* Currently, no inter-project dependencies are supported but at some point
23
* @note The way WorkspaceLoader works now, requires that you save and delete the
24
* loaded workspace *before* creating a new one...
29
/** @brief Constructor
31
* @param filename The file from which to load the workspace. If this
32
* parameter is empty, the default workspace is loaded.
34
cbWorkspace(const wxString& filename = DEFAULT_WORKSPACE);
36
/** @brief Destructor */
37
virtual ~cbWorkspace();
39
/** @brief Save the workspace
41
* @param force If false (the default), the workspace will not be written to disk,
42
* if it is not marked as modified.
43
* @return True if saving succeeded, false if not.
45
virtual bool Save(bool force = false);
47
/** @brief Save the workspace under a different filename
49
* @param filename The name of the file to save.
50
* @return True if saving succeeded, false if not.
51
* @note If the filename parameter is empty, a file dialog to choose
52
* the filename to save will be displayed.
54
virtual bool SaveAs(const wxString& filename);
56
/** @brief Get the workspace file's name
58
* @return The name of the file this workspace was loaded from.
60
virtual wxString GetFilename() const
62
return m_Filename.GetFullPath();
65
/** @brief Get the workspace's title
67
* @return The title of the workspace.
69
virtual wxString GetTitle() const
74
/** @brief Set the workspace's title
76
* @param title The new title.
78
virtual void SetTitle(const wxString& title);
80
/** @brief Was this workspace loaded succesfully?
82
* @return True if the workspace was loaded succesfully, false if not.
83
* @note Because the only way to load a workspace is through its
84
* constructor, and because we don't use exceptions, this is the only
85
* way to know if loading succeeded.
87
virtual bool IsOK() const { return m_IsOK; }
89
/** @brief Is this workspace the Code::Blocks default?
91
* @return True if the workspace is the default, false if not.
93
virtual bool IsDefault() const { return m_IsDefault; }
95
/** @brief Is this workspace modified?
97
* @return True if the workspace is modified, false if not.
98
* @note A workspace is considered modified when projects
99
* are added-to/removed-from it, when the project's order
100
* is changed or when the active project is changed.
102
virtual bool GetModified() const { return m_Modified; }
104
/** @brief Mark the workspace as modified or not
106
* @param modified If true, the workspace will be marked as modified. If
107
* false, the workspace will be marked as unmodified.
109
virtual void SetModified(bool modified);
111
bool m_IsOK; // succeeded loading?
112
bool m_IsDefault; // is this the Code::Blocks default workspace?
113
bool m_Modified; // is it modified?
114
wxFileName m_Filename; // filename
115
wxString m_Title; // title
117
void Load(); // utility function
120
#endif // CBWORKSPACE_H