/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. // Description : Custom preference page interfaces #ifndef CRYINCLUDE_EDITOR_INCLUDE_IPREFERENCESPAGE_H #define CRYINCLUDE_EDITOR_INCLUDE_IPREFERENCESPAGE_H #pragma once #include "Plugin.h" #include //! The interface class for preferences pages. struct IPreferencesPage { AZ_RTTI(IPreferencesPage, "{DEB112AD-55AD-4407-8482-BDA095A64752}") //! Return category where this preferences page belongs. virtual const char* GetCategory() = 0; //! Title of this preferences page. virtual const char* GetTitle() = 0; //! Return the icon for this page. virtual QIcon& GetIcon() = 0; //! Called by the editor when the Apply Now button is clicked. virtual void OnApply() = 0; //! Called by the editor when the Cancel button is clicked. virtual void OnCancel() = 0; //! Called by the editor when the Cancel button is clicked, and before the cancel has taken place. //! @return true to perform Cancel operation, false to abort Cancel. virtual bool OnQueryCancel() = 0; //! Called by the editor when the preferences page is made the active page or is not longer the active page. //! @param bActive true when page become active, false when page deactivated. }; //! Interface used to create new preferences pages. //! You can query this interface from any IClassDesc interface with ESYSTEM_CLASS_PREFERENCE_PAGE system class Id. struct IPreferencesPageCreator { DEFINE_UUID(0xD494113C, 0xBF13, 0x4171, 0x91, 0x71, 0x03, 0x33, 0xDF, 0x10, 0xEA, 0xFC) //! Get number of preferences page hosted by this class. virtual int GetPagesCount() = 0; //! Creates a new preferences page by page index. //! @param index must be within 0 <= index < GetPagesCount(). virtual IPreferencesPage* CreateEditorPreferencesPage(int index) = 0; }; //! A plugin class description for all IPreferencesPage derived classes. struct IPreferencesPageClassDesc : public IClassDesc { ////////////////////////////////////////////////////////////////////////// // IClassDesc implementation. ////////////////////////////////////////////////////////////////////////// virtual ESystemClassID SystemClassID() { return ESYSTEM_CLASS_PREFERENCE_PAGE; }; //! This method returns the human readable name of the class. virtual QString ClassName() { return "Preferences Page"; }; //! This method returns Category of this class, //! Category is specifying where this plugin class fits best in the create panel. virtual QString Category() { return "Preferences"; }; //! Show a modal about dialog / message box for the plugin. virtual void ShowAbout() {}; virtual bool CanExitNow() { return true; }; //! The plugin should write / read its data to the passed stream. The data is saved to or loaded //! from the editor project file. This function is called during the usual save / load process of //! the editor's project file virtual void Serialize(CXmlArchive& ar) {}; }; #endif // CRYINCLUDE_EDITOR_INCLUDE_IPREFERENCESPAGE_H