1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using mozilla::LookAndFeel::IntID from "mozilla/widget/WidgetMessageUtils.h";
using mozilla::LookAndFeel::ColorID from "mozilla/widget/WidgetMessageUtils.h";
using nscolor from "nsColor.h";
namespace mozilla {
namespace widget {
struct LookAndFeelInt {
IntID id;
int32_t value;
};
comparable struct LookAndFeelFont {
bool haveFont;
nsString name;
float size;
float weight;
bool italic;
};
struct LookAndFeelColor {
ColorID id;
nscolor color;
};
struct LookAndFeelCache {
LookAndFeelInt[] mInts;
LookAndFeelFont[] mFonts;
LookAndFeelColor[] mColors;
};
/**
* The format allows for some compression compared with having fixed
* length arrays for each value type and some indication of whether
* a value is present. This is because not all values are present on
* a given platform, and because there is also substantial repetition
* of specific values.
*
* Each of ints, floats, colors, and fonts is an array that stores the
* unique values that occur in the LookAndFeel. intMap, floatMap,
* colorMap, and fontMap map from value IDs (LookAndFeel::IntID, etc.)
* to indexes into the value arrays. The map arrays are of fixed
* length, determined by the maximum ID value. If a value for a
* particular ID is not present, the entry in the map is set to -1.
*
* (Note that fontMap is different from the others since it maps from a
* LookAndFeel::FontID value minus 1, as 1 is the minimum value of that
* enum.)
*/
struct LookAndFeelTables {
int32_t[] ints;
float[] floats;
nscolor[] colors;
LookAndFeelFont[] fonts;
uint8_t[] intMap;
uint8_t[] floatMap;
uint8_t[] colorMap;
uint8_t[] fontMap;
uint16_t passwordChar;
bool passwordEcho;
};
struct LookAndFeelTheme {
#ifdef MOZ_WIDGET_GTK
nsCString themeName;
bool preferDarkTheme;
#endif
};
/**
* Stores the entirety of a LookAndFeel's data.
*/
struct FullLookAndFeel {
LookAndFeelTables tables;
#ifdef MOZ_WIDGET_GTK
LookAndFeelTheme theme;
#endif
};
union LookAndFeelData {
LookAndFeelCache;
FullLookAndFeel;
};
} // namespace widget
} // namespace mozilla
|