FLImaging 7.4.14.3
GUIManagerModel.h
1#pragma once
2
10
11#include <functional>
12#include <map>
13
15namespace FLImaging
16{
18 namespace GUI
19 {
20 class CGUIMenuItemBase;
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 {
45 CGUIManagerModel();
46
55 CGUIManagerModel(const CGUIManagerModel& rh);
56
57 public:
67
68 public:
69
82 static const CResult Initialize();
83
98 static const CResult ReloadModelList();
99
108 static bool IsInitialized();
109
121
130 static int64_t GetCurrentModelIndex();
131
148 static const CResult AddModel(const Base::CFLString<wchar_t>& strName);
149
164 static const CResult DeleteModel(int64_t i64Index);
165
182 static const CResult DeleteModel(const Base::CFLString<wchar_t>& strName);
183
199 static const CResult ChangeModel(int64_t i64Index, bool bSaveToConfig = true);
200
218 static const CResult ChangeModel(const Base::CFLString<wchar_t>& strName, bool bSaveToConfig = true);
219
236 static const CResult DuplicateModel(int64_t i64DstIndex, int64_t i64SrcIndex);
237
256 static const CResult DuplicateModel(const Base::CFLString<wchar_t>& strDstName, const Base::CFLString<wchar_t>& strSrcName);
257
276 static const CResult RenameModel(int64_t i64Index, const Base::CFLString<wchar_t>& strNewName);
277
296 static const CResult RenameModel(const Base::CFLString<wchar_t>& strOldName, const Base::CFLString<wchar_t>& strNewName);
297
309
321
333 static void SetModelRootPath(const Base::CFLString<wchar_t>& strPath);
334
346
359
374 static const CResult WriteLastUsedModel(const Base::CFLString<wchar_t>& strModelName);
375
385
394 static bool IsLoadingModel();
395
406 static std::vector<Base::CFLString<wchar_t>> GetModelList();
407
416 static int64_t GetModelCount();
417
418
439 static const CResult AddSubMenuList(const Base::CFLString<wchar_t>& strSubMenuName, CCreateMenuItemProcedure* pCreateMenuItemProcedure);
440
463 static const CResult CreateSubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strName, const Base::CFLString<wchar_t>& strSubMenuName, bool bSaveToConfig = true);
464
487 static const CResult CopySubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strDstName, const Base::CFLString<wchar_t>& strSrcName, bool bSaveToConfig = true);
488
507 static const CResult DeleteSubMenuItem(CGUIMenuItemBase* pMenuItem, bool bDeleteFile = true);
508
521 static const CResult LoadSubMenuItem();
522
539 static const CResult AddLoadSubMenuItemProcedure(CLoadSubMenuProcedure* pLoadSubMenuItemProcedure);
540
563 static const CResult RenameSubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strName, const Base::CFLString<wchar_t>& strNewName, bool bSaveToConfig = true);
564
583 static CGUIMenuItemBase* FindSubMenuItem(const Base::CFLString<wchar_t>& strPath, const Base::CFLString<wchar_t>& strName);
584
602
603
604
605 DeclareGetClassType();
606
607 protected:
608 static CGUIManagerModel* GetObject();
609
610 Base::CFLString<wchar_t> DeleteAllModelFile(Base::CFLString<wchar_t> strModelName);
611 Base::CFLString<wchar_t> CopyAllModelFile(Base::CFLString<wchar_t> strDstModelName, Base::CFLString<wchar_t> strSrcModelName);
612 Base::CFLString<wchar_t> RenameModelDir(Base::CFLString<wchar_t> strOldModelName, Base::CFLString<wchar_t> strNewModelName);
613 Base::CFLString<wchar_t> m_strModelRootPath;
614
615 std::vector<Base::CFLString<wchar_t>>& m_vctModel;
616
617 int64_t m_i64CurrentModelIndex;
618 bool m_bInitialized;
619 bool m_bSetModelRootPath;
620 bool m_bNowLoadLastUsedModel;
621 bool m_bNowLoadingModel;
622
623 //SubMenuItem
624 std::map<Base::CFLString<wchar_t>, CCreateMenuItemProcedure*>& m_mapCreateSubItem;
625 std::vector<CLoadSubMenuProcedure*>& m_vctLoadSubMenuItemProcedure;
626 std::vector <CGUIMenuItemBase*>& m_vctSubMenuItem;
627 };
628 }
629}
630
Top-level base class of FLImaging.
Definition FLBase.h:36
Template type string class.
Definition FLString.h:34
FLImaging module execution result object.
Definition ResultsDef.h:1676
A class on a set of fixed view positions.
Definition GUIFixedViewPlacementSet.h:30
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 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 ChangeModel(int64_t i64Index, bool bSaveToConfig=true)
Changes the current model by index. Changes the model to the one specified by the index.
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 CopySubMenuItem(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strDstName, const Base::CFLString< wchar_t > &strSrcName, bool bSaveToConfig=true)
Copies a submenu item. Copies a submenu item from the specified source name to the destination name a...
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 CreateSubMenuItem(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strName, const Base::CFLString< wchar_t > &strSubMenuName, bool bSaveToConfig=true)
Creates a new submenu item. Creates a submenu item at the specified path and with the specified name ...
static const CResult ChangeModel(const Base::CFLString< wchar_t > &strName, bool bSaveToConfig=true)
Changes the current model by name. Changes the model to the one specified by the name.
static const CResult ReloadModelList()
Reloads the models in the GUI Model Manager. Rescans the model directory, updates the internal model ...
static const CResult LoadSubMenuItem()
Loads submenu items. Loads all submenu items that are available.
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 RenameSubMenuItem(const Base::CFLString< wchar_t > &strPath, const Base::CFLString< wchar_t > &strName, const Base::CFLString< wchar_t > &strNewName, bool bSaveToConfig=true)
Renames a submenu item. Renames the submenu item located at the specified path with a new name.
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 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 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...
Definition D2DObject.h:12