xref: /core/include/vcl/vclenum.hxx (revision 2f4f4cbe)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_VCLENUM_HXX
21 #define INCLUDED_VCL_VCLENUM_HXX
22 
23 #include <sal/types.h>
24 #include <o3tl/typed_flags_set.hxx>
25 
26 enum class SelectionMode { NONE, Single, Range, Multiple };
27 
28 enum class TimeFieldFormat : sal_Int32 { F_NONE, F_SEC, F_SEC_CS };
29 
30 enum class MenuItemType { DONTKNOW, STRING, IMAGE, STRINGIMAGE, SEPARATOR };
31 
32 enum class MenuItemBits : sal_Int16
33 {
34     NONE                = 0x0000,
35     CHECKABLE           = 0x0001,
36     RADIOCHECK          = 0x0002,
37     AUTOCHECK           = 0x0004,
38     HELP                = 0x0010,
39     POPUPSELECT         = 0x0020,
40     // These have been said to be a preliminary (sic) solution since 2007
41     NOSELECT            = 0x0040,
42     ICON                = 0x0080,
43     TEXT                = 0x0100,
44 };
45 namespace o3tl
46 {
47     template<> struct typed_flags<MenuItemBits> : is_typed_flags<MenuItemBits, 0x1f7> {};
48 }
49 
50 enum class ToolBoxItemBits
51 {
52     NONE                = 0x0000,
53     CHECKABLE           = 0x0001,
54     RADIOCHECK          = 0x0002,
55     AUTOCHECK           = 0x0004,
56     LEFT                = 0x0008,
57     AUTOSIZE            = 0x0010,
58     DROPDOWN            = 0x0020,
59     REPEAT              = 0x0040,
60     DROPDOWNONLY        = 0x00a0, // 0x0080 | DROPDOWN
61     TEXT_ONLY           = 0x0100,
62     ICON_ONLY           = 0x0200
63 };
64 namespace o3tl
65 {
66     template<> struct typed_flags<ToolBoxItemBits> : is_typed_flags<ToolBoxItemBits, 0x3ff> {};
67 }
68 
69 enum class ToolBoxItemType { DONTKNOW, BUTTON, SPACE, SEPARATOR, BREAK };
70 
71 enum class ButtonType { SYMBOLONLY, TEXT, SYMBOLTEXT };
72 
73 enum class SymbolType : sal_uInt16
74 {
75     DONTKNOW         = 0,
76     IMAGE            = 1,
77     ARROW_UP         = 2,
78     ARROW_DOWN       = 3,
79     ARROW_LEFT       = 4,
80     ARROW_RIGHT      = 5,
81     SPIN_UP          = 6,
82     SPIN_DOWN        = 7,
83     SPIN_LEFT        = 8,
84     SPIN_RIGHT       = 9,
85     FIRST            = 10,
86     LAST             = 11,
87     PREV             = 12,
88     NEXT             = 13,
89     PAGEUP           = 14,
90     PAGEDOWN         = 15,
91     PLAY             = 16,
92     STOP             = 19,
93     CLOSE            = 25,
94     CHECKMARK        = 28,
95     RADIOCHECKMARK   = 29,
96     FLOAT            = 31,
97     DOCK             = 32,
98     HIDE             = 33,
99     HELP             = 34,
100     PLUS             = 35,
101     MENU             = SymbolType::SPIN_DOWN
102 };
103 
104 
105 // Border styles for SetBorder()
106 enum class WindowBorderStyle : sal_Int16
107 {
108     NONE              = 0x0000,
109     NORMAL            = 0x0001,
110     MONO              = 0x0002,
111     MENU              = 0x0010,
112     NWF               = 0x0020,
113     NOBORDER          = 0x1000,
114     REMOVEBORDER      = 0x2000
115 };
116 namespace o3tl
117 {
118     template<> struct typed_flags<WindowBorderStyle> : is_typed_flags<WindowBorderStyle, 0x3033> {};
119 }
120 
121 enum class WindowStateMask {
122     NONE             = 0x0000,
123     X                = 0x0001,
124     Y                = 0x0002,
125     Width            = 0x0004,
126     Height           = 0x0008,
127     State            = 0x0010,
128     Minimized        = 0x0020,
129     MaximizedX       = 0x0100,
130     MaximizedY       = 0x0200,
131     MaximizedWidth   = 0x0400,
132     MaximizedHeight  = 0x0800,
133     Pos              = X | Y,
134     Size             = Width | Height,
135     All              = X | Y | Width | Height | MaximizedX | MaximizedY | MaximizedWidth | MaximizedHeight | State | Minimized
136 };
137 namespace o3tl
138 {
139     template<> struct typed_flags<WindowStateMask> : is_typed_flags<WindowStateMask, 0x0f3f> {};
140 }
141 
142 enum class TimeFormat
143 {
144     Hour12, Hour24
145 };
146 
147 enum class ExtTimeFieldFormat
148 {
149     /** the first 4 of these are only used by base/dbaccess */
150     Short24H, Long24H,
151     Short12H, Long12H,
152     ShortDuration, LongDuration
153 };
154 
155 enum class ExtDateFieldFormat
156 {
157     SystemShort, SystemShortYY, SystemShortYYYY,
158     SystemLong,
159     ShortDDMMYY, ShortMMDDYY, ShortYYMMDD,
160     ShortDDMMYYYY, ShortMMDDYYYY, ShortYYYYMMDD,
161     ShortYYMMDD_DIN5008, ShortYYYYMMDD_DIN5008,
162     FORCE_EQUAL_SIZE=SAL_MAX_ENUM
163 };
164 
165 // this appears to be a direct copy of css::awt::GradientStyle
166 enum class GradientStyle
167 {
168     Linear = 0,
169     Axial = 1,
170     Radial = 2,
171     Elliptical = 3,
172     Square = 4,
173     Rect = 5,
174     FORCE_EQUAL_SIZE = SAL_MAX_ENUM
175 };
176 
177 enum class HatchStyle
178 {
179     Single = 0,
180     Double = 1,
181     Triple = 2,
182     FORCE_EQUAL_SIZE = SAL_MAX_ENUM
183 };
184 
185 enum class LineStyle
186 {
187     NONE = 0,
188     Solid = 1,
189     Dash = 2,
190     FORCE_EQUAL_SIZE = SAL_MAX_ENUM
191 };
192 
193 typedef sal_uInt32 sal_UCS4;    // TODO: this should be moved to rtl
194 
195 enum class OutDevSupportType { TransparentRect, B2DDraw };
196 
197 struct ItalicMatrix
198 {
199     double xx, xy, yx, yy;
200     ItalicMatrix() : xx(1), xy(0), yx(0), yy(1) {}
201 };
202 
203 inline bool operator ==(const ItalicMatrix& a, const ItalicMatrix& b)
204 {
205     return a.xx == b.xx && a.xy == b.xy && a.yx == b.yx && a.yy == b.yy;
206 }
207 
208 inline bool operator !=(const ItalicMatrix& a, const ItalicMatrix& b)
209 {
210     return !(a == b);
211 }
212 
213 enum class VclAlign
214 {
215     Fill,
216     Start,
217     End,
218     Center
219 };
220 
221 enum class VclPackType
222 {
223     Start = 0,
224     End = 1,
225     LAST = End
226 };
227 
228 // Return Values from Dialog::Execute
229 //!!! in case of changes adjust /basic/source/runtime/methods.cxx msgbox
230 
231 enum VclResponseType
232 {
233     RET_CANCEL  = 0,
234     RET_OK      = 1,
235     RET_YES     = 2,
236     RET_NO      = 3,
237     RET_RETRY   = 4,
238     RET_IGNORE  = 5,
239     RET_CLOSE   = 7,
240     RET_HELP    = 10
241 };
242 
243 enum class VclButtonsType
244 {
245     NONE,
246     Ok,
247     Close,
248     Cancel,
249     YesNo,
250     OkCancel
251 };
252 
253 enum class VclMessageType
254 {
255     Info,
256     Warning,
257     Question,
258     Error,
259     Other
260 };
261 
262 enum class VclSizeGroupMode
263 {
264     NONE,
265     Horizontal,
266     Vertical,
267     Both
268 };
269 
270 enum class VclPolicyType
271 {
272     ALWAYS,
273     AUTOMATIC,
274     NEVER
275 };
276 
277 enum class WizardButtonFlags : sal_Int16
278 {
279     NONE                = 0x0000,
280     NEXT                = 0x0001,
281     PREVIOUS            = 0x0002,
282     FINISH              = 0x0004,
283     CANCEL              = 0x0008,
284     HELP                = 0x0010,
285 };
286 
287 namespace o3tl
288 {
289     template<> struct typed_flags<WizardButtonFlags> : is_typed_flags<WizardButtonFlags, 0x001f> {};
290 }
291 
292 // small, large, size32 force an exact toolbox size for proper alignment
293 // DontCare will let the toolbox decide about its size
294 enum class ToolBoxButtonSize
295 {
296     DontCare,
297     Small,
298     Large,
299     Size32,
300 };
301 
302 enum class WindowStateState {
303     NONE           = 0x0000,
304     Normal         = 0x0001,
305     Minimized      = 0x0002,
306     Maximized      = 0x0004,
307     // Rollup is no longer used, but retained because WindowStateState is serialized
308     // from/to strings describing window state that are stored in a users config
309     Rollup         = 0x0008,
310     MaximizedHorz  = 0x0010,
311     MaximizedVert  = 0x0020,
312     FullScreen     = 0x0040,
313     SystemMask     = 0xffff
314 };
315 namespace o3tl
316 {
317     template<> struct typed_flags<WindowStateState> : is_typed_flags<WindowStateState, 0xffff> {};
318 }
319 
320 namespace vcl
321 {
322     // The exact sizes of the icons in each size grouping are not necessarily
323     // the exact size indicated by the name, but the upper limit of their size.
324     // e.g. many Size26 icons are often 24x24px and only some 26x26px
325     enum class ImageType
326     {
327         Size16,
328         Size26,
329         Size32,
330         Small = Size16,
331         LAST = Size32,
332     };
333 }
334 
335 enum class DrawFrameStyle
336 {
337     NONE                     = 0x0000,
338     In                       = 0x0001,
339     Out                      = 0x0002,
340     Group                    = 0x0003,
341     DoubleIn                 = 0x0004,
342     DoubleOut                = 0x0005,
343     NWF                      = 0x0006,
344 };
345 
346 // Flags for DrawFrame()
347 enum class DrawFrameFlags
348 {
349     NONE                     = 0x0000,
350     Menu                     = 0x0010,
351     WindowBorder             = 0x0020,
352     BorderWindowBorder       = 0x0040,
353     Mono                     = 0x1000,
354     NoDraw                   = 0x8000,
355 };
356 namespace o3tl
357 {
358     template<> struct typed_flags<DrawFrameFlags> : is_typed_flags<DrawFrameFlags, 0x9070> {};
359 }
360 
361 enum class TxtAlign
362 {
363     Left,
364     Center,
365     Right
366 };
367 
368 enum class FloatWinPopupFlags
369 {
370     NONE                 = 0x000000,
371     AllowTearOff         = 0x000001,
372     Down                 = 0x000002,
373     Up                   = 0x000004,
374     Left                 = 0x000008,
375     Right                = 0x000010,
376     NoKeyClose           = 0x000020,
377     AllMouseButtonClose  = 0x000040,
378     NoAppFocusClose      = 0x000080,
379     NewLevel             = 0x000100,
380     NoMouseUpClose       = 0x000200,
381     GrabFocus            = 0x000400,
382     NoHorzPlacement      = 0x000800,
383 };
384 namespace o3tl
385 {
386     template<> struct typed_flags<FloatWinPopupFlags> : is_typed_flags<FloatWinPopupFlags, 0x0fff> {};
387 }
388 
389 // Flags for Window::Show()
390 enum class ShowFlags
391 {
392     NONE                       = 0x0000,
393     NoFocusChange              = 0x0002,
394     NoActivate                 = 0x0004,
395     ForegroundTask             = 0x0008,
396 };
397 namespace o3tl
398 {
399     template<> struct typed_flags<ShowFlags> : is_typed_flags<ShowFlags, 0x000e> {};
400 }
401 
402 enum class TrackingEventFlags
403 {
404     NONE           = 0x0000,
405     Cancel         = 0x0001,
406     Key            = 0x0002,
407     Focus          = 0x0004,
408     Repeat         = 0x0100,
409     End            = 0x1000,
410 };
411 namespace o3tl
412 {
413     template<> struct typed_flags<TrackingEventFlags> : is_typed_flags<TrackingEventFlags, 0x1107> {};
414 }
415 
416 #endif // INCLUDED_VCL_VCLENUM_HXX
417 
418 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
419