FINAL CUT
fcolorpalette.h
1 /***********************************************************************
2 * fcolorpalette.h - Define RGB color value for a palette entry *
3 * *
4 * This file is part of the FINAL CUT widget toolkit *
5 * *
6 * Copyright 2018-2023 Markus Gans *
7 * *
8 * FINAL CUT is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation; either version 3 of *
11 * the License, or (at your option) any later version. *
12 * *
13 * FINAL CUT is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this program. If not, see *
20 * <http://www.gnu.org/licenses/>. *
21 ***********************************************************************/
22 
23 /* Standalone class
24  * ════════════════
25  *
26  * ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
27  * ▕ FColorPalette ▏
28  * ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
29  */
30 
31 #ifndef FCOLORPALETTE_H
32 #define FCOLORPALETTE_H
33 
34 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
35  #error "Only <final/final.h> can be included directly."
36 #endif
37 
38 #include <functional>
39 #include <memory>
40 
41 #include "final/util/fstring.h"
42 
43 namespace finalcut
44 {
45 
46 //----------------------------------------------------------------------
47 // class FColorPalette
48 //----------------------------------------------------------------------
49 
51 {
52  public:
53  // Using-declaration
54  using FSetPalette = std::function<void(FColor, int, int, int)>;
55 
56  // Constructor
57  explicit FColorPalette (FSetPalette);
58 
59  // Destructor
60  virtual ~FColorPalette() noexcept;
61 
62  // Accessor
63  virtual auto getClassName() const -> FString;
64  static auto getInstance() -> std::shared_ptr<FColorPalette>&;
65 
66  // Methods
67  virtual void setColorPalette() = 0;
68  virtual void resetColorPalette() = 0;
69 
70  protected:
71  void setPalette (FColor, int, int, int) const;
72  void setVGAdefaultPalette() const;
73 
74  private:
75  // Data members
76  FSetPalette set_palette;
77 };
78 
79 // FColorPalette inline functions
80 //----------------------------------------------------------------------
81 inline auto FColorPalette::getClassName() const -> FString
82 { return "FColorPalette"; }
83 
84 
85 /* Inheritance diagram
86  * ═══════════════════
87  *
88  * ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
89  * ▕ FColorPalette ▏
90  * ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
91  * ▲
92  * │
93  * ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
94  * ▕ default8ColorPalette ▏
95  * ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
96  */
97 
98 //----------------------------------------------------------------------
99 // class default8ColorPalette
100 //----------------------------------------------------------------------
101 
103 {
104  public:
105  // Constructor
106  explicit default8ColorPalette (FSetPalette);
107 
108  // Destructor
109  ~default8ColorPalette() noexcept override;
110 
111  // Accessor
112  auto getClassName() const -> FString override;
113 
114  // Methods
115  void setColorPalette() override;
116  void resetColorPalette() override;
117 };
118 
119 // default8ColorPalette inline functions
120 //----------------------------------------------------------------------
121 inline auto default8ColorPalette::getClassName() const -> FString
122 { return "default8ColorPalette"; }
123 
124 
125 /* Inheritance diagram
126  * ═══════════════════
127  *
128  * ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
129  * ▕ FColorPalette ▏
130  * ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
131  * ▲
132  * │
133  * ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
134  * ▕ default16ColorPalette ▏
135  * ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
136  */
137 
138 //----------------------------------------------------------------------
139 // class default16ColorPalette
140 //----------------------------------------------------------------------
141 
143 {
144  public:
145  // Constructor
146  explicit default16ColorPalette (FSetPalette);
147 
148  // Destructor
149  ~default16ColorPalette() noexcept override;
150 
151  // Accessor
152  auto getClassName() const -> FString override;
153 
154  // Methods
155  void setColorPalette() override;
156  void resetColorPalette() override;
157 };
158 
159 // default16ColorPalette inline functions
160 //----------------------------------------------------------------------
161 inline auto default16ColorPalette::getClassName() const -> FString
162 { return "default16ColorPalette"; }
163 
164 /* Inheritance diagram
165  * ═══════════════════
166  *
167  * ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
168  * ▕ FColorPalette ▏
169  * ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
170  * ▲
171  * │
172  * ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
173  * ▕ default16DarkColorPalette ▏
174  * ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
175  */
176 
177 //----------------------------------------------------------------------
178 // class default16DarkColorPalette
179 //----------------------------------------------------------------------
180 
182 {
183  public:
184  // Constructor
185  explicit default16DarkColorPalette (FSetPalette);
186 
187  // Destructor
188  ~default16DarkColorPalette() noexcept override;
189 
190  // Accessor
191  auto getClassName() const -> FString override;
192 
193  // Methods
194  void setColorPalette() override;
195  void resetColorPalette() override;
196 };
197 
198 // default16ColorPalette inline functions
199 //----------------------------------------------------------------------
200 inline auto default16DarkColorPalette::getClassName() const -> FString
201 { return "default16DarkColorPalette"; }
202 
203 } // namespace finalcut
204 
205 #endif // FCOLORPALETTE_H
Definition: fcolorpalette.h:102
Definition: class_template.cpp:25
Definition: fcolorpalette.h:50
Definition: fcolorpalette.h:181
Definition: fstring.h:79
Definition: fcolorpalette.h:142