FLImaging 6.5.8.1
GUIManagerModel.h
1#pragma once
2
11#include <functional>
12#include <map>
13
15namespace FLImaging
16{
18 namespace GUI
19 {
20 class CGUIMenuItemBase;
21 class CGUIFixedViewPlacementSet;
22
23 typedef std::function< CGUIMenuItemBase* (Base::CFLString<wchar_t> strPath, Base::CFLString<wchar_t> strName)> CCreateMenuItemProcedure;
24#define MakeMenuItemProcedure [=](Base::CFLString<wchar_t> strPath, Base::CFLString<wchar_t> strName) -> CGUIMenuItemBase*
25
26 typedef std::function< FLImaging::CResult()> CLoadSubMenuProcedure;
27#define MakeLoadSubMenuProcedure [=]() -> FLImaging::CResult
28
37 class FL_EXPORT CGUIManagerModel : public Base::CFLBase
38 {
46
56
57 public:
67
68 public:
69
82 static const CResult Initialize();
83
92 static bool IsInitialized();
93
105
114 static int64_t GetCurrentModelIndex();
115
132 static const CResult AddModel(const Base::CFLString<wchar_t>& strName);
133
148 static const CResult DeleteModel(int64_t i64Index);
149
166 static const CResult DeleteModel(const Base::CFLString<wchar_t>& strName);
167
183 static const CResult ChangeModel(int64_t i64Index, bool bWriteFileSystem = true);
184
202 static const CResult ChangeModel(const Base::CFLString<wchar_t>& strName, bool bWriteFileSystem = true);
203
220 static const CResult DuplicateModel(int64_t i64DstIndex, int64_t i64SrcIndex);
221
240 static const CResult DuplicateModel(const Base::CFLString<wchar_t>& strDstName, const Base::CFLString<wchar_t>& strSrcName);
241
260 static const CResult RenameModel(int64_t i64Index, const Base::CFLString<wchar_t>& strNewName);
261
280 static const CResult RenameModel(const Base::CFLString<wchar_t>& strOldName, const Base::CFLString<wchar_t>& strNewName);
281
293
305
317 static void SetModelRootPath(const Base::CFLString<wchar_t>& strPath);
318
330
343
358 static const CResult WriteLastUsedModel(const Base::CFLString<wchar_t>& strModelName);
359
369
378 static bool IsLoadingModel();
379
390 static std::vector<Base::CFLString<wchar_t>> GetModelList();
391
400 static int64_t GetModelCount();
401
402
423 static const CResult AddSubMenuList(const Base::CFLString<wchar_t>& strSubMenuName, CCreateMenuItemProcedure* pCreateMenuItemProcedure);
424
447 static const CResult CreateSubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strName, const Base::CFLString<wchar_t>& strSubMenuName, bool bWriteFileSystem = true);
448
471 static const CResult CopySubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strDstName, const Base::CFLString<wchar_t>& strSrcName, bool bWriteFileSystem = true);
472
491 static const CResult DeleteSubMenuItem(CGUIMenuItemBase* pMenuItem, bool bDeleteFile = true);
492
505 static const CResult LoadSubMenuItem();
506
523 static const CResult AddLoadSubMenuItemProcedure(CLoadSubMenuProcedure* pLoadSubMenuItemProcedure);
524
547 static const CResult RenameSubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strName, const Base::CFLString<wchar_t>& strNewName, bool bWriteFileSystem = true);
548
567 static CGUIMenuItemBase* FindSubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strName);
568
586
587
588
589 DeclareGetClassType();
590
591 protected:
592 static CGUIManagerModel* GetObject();
593
594 Base::CFLString<wchar_t> DeleteAllModelFile(Base::CFLString<wchar_t> strModelName);
595 Base::CFLString<wchar_t> CopyAllModelFile(Base::CFLString<wchar_t> strDstModelName, Base::CFLString<wchar_t> strSrcModelName);
596 Base::CFLString<wchar_t> RenameModelDir(Base::CFLString<wchar_t> strOldModelName, Base::CFLString<wchar_t> strNewModelName);
597 Base::CFLString<wchar_t> m_strModelRootPath;
598
599 std::vector<Base::CFLString<wchar_t>>& m_vctModel;
600
601 int64_t m_i64CurrentModelIndex;
602 bool m_bInitialized;
603 bool m_bSetModelRootPath;
604 bool m_bNowLoadLastUsedModel;
605 bool m_bNowLoadingModel;
606
607 //SubMenuItem
608 std::map<Base::CFLString<wchar_t>, CCreateMenuItemProcedure*>& m_mapCreateSubItem;
609 std::vector<CLoadSubMenuProcedure*>& m_vctLoadSubMenuItemProcedure;
610 std::vector <CGUIMenuItemBase*>& m_vctSubMenuItem;
611 };
612 }
613}
614
Top-level base class of FLImaging.
Definition FLBase.h:36
Template type string class.
Definition INIUtilities.h:20
FLImaging module execution result object.
Definition ResultsDef.h:1514
Represents the GUI Model Manager responsible for managing model data and operations....
Definition GUIManagerModel.h:38
static Base::CFLString< wchar_t > GetCurrentModel()
Gets the current model name.
static const CResult DeleteSubMenuItem(CGUIMenuItemBase *pMenuItem, bool bDeleteFile=true)
Deletes a submenu item. Deletes the specified submenu item and optionally deletes the associated file...
static const CResult Initialize()
Initializes the GUI Model Manager. Performs the necessary initialization steps for the GUI Model Mana...
static const CResult ChangeModel(int64_t i64Index, bool bWriteFileSystem=true)
Changes the current model by index. Changes the model to the one specified by the index.
static void SetModelRootPath(const Base::CFLString< wchar_t > &strPath)
Sets the root path for saving and loading model folders. If an empty string is specified,...
static const CResult WriteLastUsedModel(const Base::CFLString< wchar_t > &strModelName)
Writes the most recently used model name to the LastUsedModel.ini file.
static Base::CFLString< wchar_t > GetModelRootPath()
Gets the root path for saving and loading model folders.
static const CResult DeleteModel(int64_t i64Index)
Deletes a model by index. Deletes the model at the specified index.
static bool IsInitialized()
Checks if the GUI Model Manager is initialized.
static int64_t GetCurrentModelIndex()
Gets the index of the current model.
static const CResult RenameSubMenuItem(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strName, const Base::CFLString< wchar_t > &strNewName, bool bWriteFileSystem=true)
Renames a submenu item. Renames the submenu item located at the specified path with a new name.
static const CResult AddLoadSubMenuItemProcedure(CLoadSubMenuProcedure *pLoadSubMenuItemProcedure)
Adds a procedure to load submenu items. Adds a procedure to be used when loading submenu items.
static bool IsLoadingLastUsedModel()
Checks if the last used model is currently being loaded.
static const CResult RenameModel(int64_t i64Index, const Base::CFLString< wchar_t > &strNewName)
Renames a model by index. Renames the model at the specified index with a new name.
static const CResult LoadSubMenuItem()
Loads submenu items. Loads all submenu items that are available.
static const CResult ChangeModel(const Base::CFLString< wchar_t > &strName, bool bWriteFileSystem=true)
Changes the current model by name. Changes the model to the one specified by the name.
static const CResult RenameModel(const Base::CFLString< wchar_t > &strOldName, const Base::CFLString< wchar_t > &strNewName)
Renames a model by name. Renames the model specified by the old name to the new name.
static const CResult DuplicateModel(int64_t i64DstIndex, int64_t i64SrcIndex)
Duplicates a model by index. Creates a duplicate of the model specified by the source index and store...
static const CResult DuplicateModel(const Base::CFLString< wchar_t > &strDstName, const Base::CFLString< wchar_t > &strSrcName)
Duplicates a model by name. Creates a duplicate of the model specified by the source name and stores ...
static const CResult AddModel(const Base::CFLString< wchar_t > &strName)
Adds a new model. Adds a model with the specified name to the GUI Model Manager.
static Base::CFLString< wchar_t > GetCurrentModelFullPath()
Gets the full path of the current model.
static const CResult DeleteModel(const Base::CFLString< wchar_t > &strName)
Deletes a model by name. Deletes the model with the specified name.
static int64_t GetModelCount()
Gets the count of all models.
static const CResult AddSubMenuList(const Base::CFLString< wchar_t > &strSubMenuName, CCreateMenuItemProcedure *pCreateMenuItemProcedure)
Adds a new submenu list. Adds a submenu list with the specified name and procedure for creating menu ...
static CGUIMenuItemBase * FindSubMenuItem(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strName)
Finds a submenu item. Finds the submenu item located at the specified path with the given name.
static std::vector< Base::CFLString< wchar_t > > GetModelList()
Gets the list of all models.
static const CResult LoadLastUsedModel()
Loads the most recently used model. Should be called after CGUIManagerModel::Initialize().
static const CResult CopySubMenuItem(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strDstName, const Base::CFLString< wchar_t > &strSrcName, bool bWriteFileSystem=true)
Copies a submenu item. Copies a submenu item from the specified source name to the destination name a...
static bool IsLoadingModel()
Checks if a model is currently being loaded.
virtual ~CGUIManagerModel()
Destructor for CGUIManagerModel. Cleans up any resources used by the CGUIManagerModel instance.
static Base::CFLString< wchar_t > GetDefaultModelFullPath()
Gets the full path of the default model.
static const CResult CreateSubMenuItem(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strName, const Base::CFLString< wchar_t > &strSubMenuName, bool bWriteFileSystem=true)
Creates a new submenu item. Creates a submenu item at the specified path and with the specified name ...
static Base::CFLString< wchar_t > FindSubMenuName(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strName)
Finds the name of a submenu. Finds the name of the submenu located at the specified path with the giv...