VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtQIconConfiguration.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 
14 #include <string>
15 #include <unordered_set>
16 #include <unordered_map>
17 
18 namespace makVrv
19 {
22  {
23  Normal,
24  Disabled,
25  Active,
26  Selected
27  };
28 
31  {
32  On,
33  Off
34  };
35 
37  {
38  public:
42  DtQIconModeAndState() = delete;
43 
44  public:
45  virtual DtQIconModeAndState& operator=(const DtQIconModeAndState& other);
46 
47  virtual bool operator==(const DtQIconModeAndState& other) const;
48 
49  public:
52  };
53 
60  {
61  public:
63  DtQIconConfiguration(const std::string& fileNameOrPath,
67  DtQIconConfiguration() = delete;
68 
69  virtual DtQIconConfiguration& operator=(const DtQIconConfiguration& other);
70 
73  virtual bool operator==(const DtQIconConfiguration& other) const;
74 
75  public:
77  std::string myIconFileNameOrPath;
78  };
79 
80 }
81 
84 template <>
85 struct std::hash<makVrv::DtQIconModeAndState>
86 {
87  std::size_t operator()(const makVrv::DtQIconModeAndState& k) const
88  {
89  // Compute individual hash values for first,
90  // second and third and combine them using XOR
91  // and bit shifting:
92  return ((std::hash<int>()((int)k.myIconMode)
93  ^ (std::hash<int>()((int)k.myIconState) << 1)) >> 1);
94  }
95 };
96 
99 template <>
100 struct std::hash<makVrv::DtQIconConfiguration>
101 {
102  std::size_t operator()(const makVrv::DtQIconConfiguration& k) const
103  {
104  // Compute individual hash values for first,
105  // second and third and combine them using XOR
106  // and bit shifting:
107  return ((std::hash<std::string>()(k.myIconFileNameOrPath)
108  ^ (std::hash<int>()((int)k.myIconModeAndState.myIconMode) << 1)) >> 1)
109  ^ (std::hash<int>()((int)k.myIconModeAndState.myIconState) << 1);
110  }
111 };
112 
113 namespace makVrv
114 {
115 
132  {
133 
134  public:
140  explicit DtQIconConfigurations(bool useDefaultGenerationFlags);
141 
146 
148  virtual ~DtQIconConfigurations();
149 
150  public:
156  virtual void addConfiguration(const DtQIconConfiguration& configuration);
157 
159  virtual const std::unordered_set<DtQIconConfiguration>& configurations() const;
160 
163  virtual std::string iconFileNameOrPathFromQIconModeAndState(
164  DtQIconConfigurationMode iconMode, DtQIconConfigurationState iconState) const;
165 
170  virtual void setIsGenerateIconConfigurationsEnabledByModeAndState(
171  const DtQIconModeAndState& modeAndStateToSet, bool generateConfigurationForMode);
172 
177  virtual bool isGenerateIconConfigurationsEnabledByModeAndState(
178  const DtQIconModeAndState& modeAndStateToCheck) const;
179 
180  protected:
185  virtual void resetGenerateConfigurationFlags(bool useDefaultGenerationFlags);
186 
187  protected:
188  std::unordered_set<DtQIconConfiguration> myConfigurations;
189 
190  std::unordered_map<DtQIconModeAndState, bool> myGenerateConfigurationFlags;
191  };
192 
193 }
std::unordered_set< DtQIconConfiguration > myConfigurations
Definition: DtQIconConfiguration.h:188
DtQIconConfigurationMode myIconMode
Definition: DtQIconConfiguration.h:50
std::size_t operator()(const makVrv::DtQIconModeAndState &k) const
Definition: DtQIconConfiguration.h:87
Definition: DtQIconConfiguration.h:36
std::size_t operator()(const makVrv::DtQIconConfiguration &k) const
Definition: DtQIconConfiguration.h:102
DtQIconConfigurationState myIconState
Definition: DtQIconConfiguration.h:51
DtQIconModeAndState myIconModeAndState
Definition: DtQIconConfiguration.h:76
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
DtQIconConfigurationState
Duplicate of Qt&#39;s QIcon::State.
Definition: DtQIconConfiguration.h:30
A single configuration for an icon. The icon configuration is used by the DtWidgetIconStyleManager to...
Definition: DtQIconConfiguration.h:59
std::unordered_map< DtQIconModeAndState, bool > myGenerateConfigurationFlags
Definition: DtQIconConfiguration.h:190
bool operator==(const DtTextureAtlasIndexParser::StringOrFloatAttrib &lhs, const DtTextureAtlasIndexParser::StringOrFloatAttrib &rhs)
needed for search comparison code
Definition: DtTextureAtlasIndexParser.h:160
const char int mode
Definition: ioapi.h:38
std::string myIconFileNameOrPath
Definition: DtQIconConfiguration.h:77
DtQIconConfigurationMode
Duplicate of Qt&#39;s QIcon::Mode.
Definition: DtQIconConfiguration.h:21
A collection of icon configurations. The collection maintains flags indicating whether to generate ic...
Definition: DtQIconConfiguration.h:131
Contains DLL export macros.

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)