Class Theme¶
- Defined in File theme.h
Page Contents
Inheritance Relationships¶
Base Type¶
public nanogui::Object
(Class Object)
Class Documentation¶
-
class
Theme
: public nanogui::Object¶ Storage class for basic theme-related properties.
Public Functions
-
Theme
(NVGcontext *ctx)¶
Public Members
-
std::string
mDefaultFont
¶ The default font face:
"sans"
fromresources/Roboti-Regular.ttf
.
-
std::string
mDefaultBoldFont
¶ The default bold font face:
"sans-bold"
fromresources/Roboto-Bold.ttf
.
-
std::string
mDefaultMonoFont
¶ The default monospace font:
"mono"
fromresources/RobotoMono-Regular.ttf
.Not used directly in NanoGUI, but loaded and available for all applications.
-
std::string
mDefaultMonoBoldFont
¶ The default monospace bold font:
"mono-bold"
fromresources/RobotoMono-Bold.ttf
.Not used directly in NanoGUI, but loaded and available for all applications.
-
std::string
mDefaultIconFont
¶ The default icon font face:
"icons"
fromresources/entypo.ttf
.
-
int
mFontNormal
¶ The font memory identifier loaded for mDefaultFont.
Most applications should not have a need to use this variable. Its value should never be reassigned.
-
int
mFontBold
¶ The font memory identifier loaded for mDefaultBoldFont.
Most applications should not have a need to use this variable. Its value should never be reassigned.
-
int
mFontMonoNormal
¶ The font memory identifier loaded for mDefaultMonoFont.
Most applications should not have a need to use this variable. Its value should never be reassigned.
-
int
mFontMonoBold
¶ The font memory identifier loaded for mDefaultMonoBoldFont.
Most applications should not have a need to use this variable. Its value should never be reassigned.
-
int
mFontIcons
¶ The font memory identifier loaded for mDefaultIconFont.
Most applications should not have a need to use this variable. Its value should never be reassigned.
-
float
mIconScale
¶ The amount of scaling that is applied to each icon to fit the size of NanoGUI widgets. The default value is
0.77f
, setting to e.g. higher than1.0f
is generally discouraged.
-
float
mStandardFontSize
¶ The font size for all widgets other than buttons and textboxes (default:
16
).
-
float
mButtonFontSize
¶ The font size for buttons (default:
20
).
-
float
mTextBoxFontSize
¶ The font size for text boxes (default:
20
).
-
int
mTabControlWidth
¶ Used to help specify what lies “in bound” for a TabHeader widget (default:
20
).
-
int
mTabButtonHorizontalPadding
¶ The amount of horizontal padding for a TabHeader widget (default:
10
).
-
Color
mDropShadow
¶ The color of the drop shadow drawn behind widgets (default: intensity=
0
, alpha=128
; see nanogui::Color::Color(int,int)).
-
Color
mTransparent
¶ The transparency color (default: intensity=
0
, alpha=0
; see nanogui::Color::Color(int,int)).
-
Color
mBorderDark
¶ The dark border color (default: intensity=
29
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mBorderLight
¶ The light border color (default: intensity=
92
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mBorderMedium
¶ The medium border color (default: intensity=
35
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mTextColor
¶ The text color (default: intensity=
255
, alpha=160
; see nanogui::Color::Color(int,int)).
-
Color
mDisabledTextColor
¶ The disable dtext color (default: intensity=
255
, alpha=80
; see nanogui::Color::Color(int,int)).
-
Color
mTextColorShadow
¶ The text shadow color (default: intensity=
0
, alpha=160
; see nanogui::Color::Color(int,int)).
-
Color
mIconColor
¶ The icon color (default: nanogui::Theme::mTextColor).
-
Color
mButtonGradientTopFocused
¶ The top gradient color for buttons in focus (default: intensity=
64
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mButtonGradientBotFocused
¶ The bottom gradient color for buttons in focus (default: intensity=
48
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mButtonGradientTopUnfocused
¶ The top gradient color for buttons not in focus (default: intensity=
74
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mButtonGradientBotUnfocused
¶ The bottom gradient color for buttons not in focus (default: intensity=
58
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mButtonGradientTopPushed
¶ The top gradient color for buttons currently pushed (default: intensity=
41
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mButtonGradientBotPushed
¶ The bottom gradient color for buttons currently pushed (default: intensity=
29
, alpha=255
; see nanogui::Color::Color(int,int)).
-
float
mTooltipOpacity
¶ The maximum value for tooltip background opacity. Default:
0.8f
.Lower values result in more transparent tooltips, higher values result in less transparent tooltips. This represents an OpenGL
alpha
value, meaning1.0f
(or higher) will result in no transparency.In the implementation of
Screen::drawWidgets
, this variable is used asfloat opacity = std::min( widget->theme()->mTooltipOpacity, 2.0f * (static_cast<float>(elapsed) - 0.5f) ); nvgGlobalAlpha(mNVGContext, opacity);
These mechanics allow for the tooltip to fade-in.
elapsed
contains the amount of time the mouse has been hovering over the Widget whose tooltip is being displayed. After subtraction and scaling, when the mouse hover begins the calculation will result in smaller values (e.g., starting around0.05f
). After enough time,mTooltipOpacity
will always be the smaller value, makingmTooltipOpacity
the maximum alpha channel value for the tooltip.
-
Color
mTooltipBackgroundColor
¶ The background color to use for drawing nanogui::Widget::mTooltip (default: intensity=
0
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mTooltipTextColor
¶ The text color to use for drawing nanogui::Widget::mTooltip (default: intensity=
255
, alpha=255
; see nanogui::Color::Color(int,int)).
-
Color
mWindowFillUnfocused
¶ The fill color for a Window that is not in focus (default: intensity=
43
, alpha=230
; see nanogui::Color::Color(int,int)).
-
Color
mWindowFillFocused
¶ The fill color for a Window that is in focus (default: intensity=
45
, alpha=230
; see nanogui::Color::Color(int,int)).
-
Color
mWindowTitleUnfocused
¶ The title color for a Window that is not in focus (default: intensity=
220
, alpha=160
; see nanogui::Color::Color(int,int)).
-
Color
mWindowTitleFocused
¶ The title color for a Window that is in focus (default: intensity=
255
, alpha=190
; see nanogui::Color::Color(int,int)).
-
Color
mWindowHeaderGradientTop
¶ The top gradient color for Window headings (default: nanogui::Theme::mButtonGradientTopUnfocused).
-
Color
mWindowHeaderGradientBot
¶ The bottom gradient color for Window headings (default: nanogui::Theme::mButtonGradientBotUnfocused).
-
Color
mWindowHeaderSepTop
¶ The Window header top separation color (default: nanogui::Theme::mBorderLight).
-
Color
mWindowHeaderSepBot
¶ The Window header bottom separation color (default: nanogui::Theme::mBorderDark).
-
Color
mWindowPopup
¶ The popup window color (default: intensity=
50
, alpha=255
; see nanogui::Color::Color(int,int))).
-
Color
mWindowPopupTransparent
¶ The transparent popup window color (default: intensity=
50
, alpha=0
; see nanogui::Color::Color(int,int))).
-
float
mCheckBoxIconExtraScale
¶ Extra scaling needed for mCheckBoxIcon (default: defaultCheckBoxIconExtraScale).
-
int
mMessageInformationIcon
¶ Icon to use for informational MessageDialog widgets (default:
ENTYPO_ICON_INFO_WITH_CIRCLE
).
-
int
mMessageQuestionIcon
¶ Icon to use for interrogative MessageDialog widgets (default:
ENTYPO_ICON_HELP_WITH_CIRCLE
).
-
int
mMessageWarningIcon
¶ Icon to use for warning MessageDialog widgets (default:
ENTYPO_ICON_WARNING
).
-
int
mMessageAltButtonIcon
¶ Icon to use on MessageDialog alt button (default:
ENTYPO_ICON_CIRCLE_WITH_CROSS
).
-
int
mMessagePrimaryButtonIcon
¶ Icon to use on MessageDialog primary button (default:
ENTYPO_ICON_CHECK
).
-
int
mPopupChevronRightIcon
¶ Icon to use for PopupButton widgets opening to the right (default:
ENTYPO_ICON_CHEVRON_RIGHT
).
-
int
mPopupChevronLeftIcon
¶ Icon to use for PopupButton widgets opening to the left (default:
ENTYPO_ICON_CHEVRON_LEFT
).
-
float
mPopupIconExtraScale
¶ Extra scaling needed for mPopupChevronRightIcon and mPopupChevronLeftIcon (default: defaultPopupIconExtraScale).
-
int
mTabHeaderLeftIcon
¶ Icon to indicate hidden tabs to the left on a TabHeader (default:
ENTYPO_ICON_ARROW_BOLD_LEFT
).
-
int
mTabHeaderRightIcon
¶ Icon to indicate hidden tabs to the right on a TabHeader (default:
ENTYPO_ICON_ARROW_BOLD_RIGHT
).
-
int
mTextBoxUpIcon
¶ Icon to use when a TextBox has an up toggle (e.g. IntBox) (default:
ENTYPO_ICON_CHEVRON_UP
).
-
int
mTextBoxDownIcon
¶ Icon to use when a TextBox has a down toggle (e.g. IntBox) (default:
ENTYPO_ICON_CHEVRON_DOWN
).
-
float
mTextBoxIconExtraScale
¶ Extra scaling needed for mTextBoxUpIcon and mTextBoxDownIcon (default: defaultTextBoxIconExtraScale).
Public Static Functions
-
static float
defaultCheckBoxIconExtraScale
()¶ For the default theme,
1.2f
is used in conjunction withENTYPO_ICON_CHECK
. If overriding, mCheckBoxIcon, make sure mCheckBoxIconExtraScale is set appropriately for the new icon choice.This method exists for the rare occurence that a Theme instance is not available upon construction.
-
static float
defaultPopupIconExtraScale
()¶ For the default theme,
0.8f
is used in conjunction withENTYPO_ICON_CHEVRON_{LEFT,RIGHT}
. If overriding, mPopupChevronRightIcon and mPopupChevronLeftIcon, make sure mPopupIconExtraScale is set appropriately for the new icon choice.This method exists for the rare occurence that a Theme instance is not available upon construction.
Note
Observe that there is only one scale variable (instead of one for left and right). This means that you need to choose an icon pair for left / right that are the same original size.
-
static float
defaultTextBoxIconExtraScale
()¶ For the default theme,
0.8f
is used in conjunction withENTYPO_ICON_CHEVRON_{UP,DOWN}
. If overriding, mTextBoxUpIcon and mTextBoxDownIcon, make sure mTextBoxIconExtraScale is set appropriately for the new icon choice.This method exists for the rare occurence that a Theme instance is not available upon construction.
Note
Observe that there is only one scale variable (instead of one for up and down). This means that you need to choose an icon pair for up / down that are the same original size.
Protected Functions
-
virtual
~Theme
()¶ Default destructor does nothing; allows for inheritance.
-
struct
GlobalDefaultFonts
¶ The font face string identifiers that are always loaded / available for every Widget.
In the (rare) event that a Widget does not have a Theme instance (this only happens when a Widget is constructed without a parent), these values are also used in the Widget font getter methods.
The five available class-level string constants are
Normal
,Bold
,Mono
,MonoBold
, andIcons
.- See
- The implementation of nanogui::Widget::font.
Public Functions
-
GlobalDefaultFonts
()¶ This class shall not be instantiated.
-
GlobalDefaultFonts
(const GlobalDefaultFonts &other)¶ This class shall not be copied.
-
GlobalDefaultFonts
(const GlobalDefaultFonts &&other)¶ This class shall not be moved.
Public Static Attributes
-
constexpr auto
Normal
= "sans"¶ The
"sans"
font face: see nanogui::Theme::mDefaultFont.
-
constexpr auto
Bold
= "sans-bold"¶ The
"sans-bold"
font face: see nanogui::Theme::mDefaultBoldFont.
-
constexpr auto
Mono
= "mono"¶ The
"mono"
font face: see nanogui::Theme::mDefaultMonoFont.
-
constexpr auto
MonoBold
= "mono-bold"¶ The
"mono-bold"
font face: see nanogui::Theme::mDefaultMonoBoldFont.
-
constexpr auto
Icons
= "icons"¶ The
"icons"
font face: see nanogui::Theme::mDefaultIconFont.
-