Inherited by fltk::NamedStyle.
Public Member Functions | |
Box * | box () const |
Box * | buttonbox () const |
Color | buttoncolor () const |
Color | color () const |
bool | draw_boxes_inactive () const |
bool | dynamic () const |
Box * | focusbox () const |
Symbol * | glyph () const |
bool | hide_underscore () const |
Color | highlight_color () const |
Color | highlight_textcolor () const |
Color | labelcolor () const |
Font * | labelfont () const |
float | labelsize () const |
LabelType * | labeltype () const |
float | leading () const |
unsigned char | scrollbar_align () const |
unsigned char | scrollbar_width () const |
Color | selection_color () const |
Color | selection_textcolor () const |
Style () | |
Color | textcolor () const |
Font * | textfont () const |
float | textsize () const |
int | wheel_scroll_lines () const |
Each widget has a pointer to an instance of Style. Usually many widgets share pointers to the same one. Styles are linked into a hierarchy tree by the parent_ pointers.
When you look up a value from a style (such as when box() is called) it looks at that style and each parent up until it finds a non-zero value to return, or until there are no more parents, in which case zero is returned. Thus changing a parent style can make global changes as long as widgets do not have local values set.
When you "set" a style (such as by calling box(UP_BOX)) then the local member variable is set. Notice that by setting a zero value you will indicate that it should return the parent value.
The method Widget::box(BOX) will create a dynamic() style for that widget, which is a child of the original style, and set the box in that style. This "unique" style is reused for any other changes to that widget and it is deleted when the widget is deleted. Thus changes to a single widget do not affect other widgets, but the majority of widgets all share a Style structure.
Occasionally it is useful to see if a field has been set. To do this you can directly access the local member variables using names like box_.
Style::Style | ( | ) |
The constructor clears the style to entirely zeros, including the parent_ pointer. You probably want to set the parent to Widget::default_style in order to inherit the global settings.
Box * Style::box | ( | ) | const |
The type of box to draw around the outer edge of the widget (for the majority of widgets, some classes ignore this or use it to draw only text fields inside the widget). The default is fltk::DOWN_BOX.
Box * Style::buttonbox | ( | ) | const |
The type of box to draw buttons internal the widget (notice that fltk::Button uses box, however). The default is fltk::UP_BOX.
Color Style::buttoncolor | ( | ) | const |
Color used when drawing buttons. Default is fltk::GRAY75.
Color Style::color | ( | ) | const |
Color of the widgets. The default is fltk::WHITE. You may think most widgets are gray, but this is because Group and Window have their own Style with this set to fltk::GRAY75, and also because many parts of widgets are drawn with the buttoncolor().
If you want to change the overall color of all the gray parts of the interface you want to call fltk::set_background(color) instead, as this will set the entry for fltk::GRAY75 and also set the "gray ramp" so that the edges of buttons are the same color.
bool Style::draw_boxes_inactive | ( | ) | const [inline] |
If false then most of the built-in box types draw the same even if fltk::INACTIVE_R is passed to them. This repliates Windows appearance. If true (the default) then the boxes themselves gray out.
bool Style::dynamic | ( | ) | const [inline] |
Box * Style::focusbox | ( | ) | const |
The type of box to draw when a widget takes focus. The default is fltk::DEFAULT_FOCUS_BOX
Symbol * Style::glyph | ( | ) | const |
A small image that some Widgets use to draw part of themselves. For instance the fltk::CheckButton class has this set to a Symbol that draws the white box and the checkmark if VALUE is true.
Im most cases the fltk::drawflags() are examined to decide between different symbols. The default value draws empty squares and arrow buttons if ALIGN flags are on, see Widget::default_glpyh.
bool Style::hide_underscore | ( | ) | const [inline] |
If false, draw &x in labels as an underscore. If true (the default) then the underscores are not drawn. In this case you should limit your &x hotkeys to menubar items, as underscores in buttons are not visible. The menubar will show them when Alt is held down.
Color Style::highlight_color | ( | ) | const |
The color to draw the widget when the mouse is over it (for scrollbars and sliders this is used to color the buttons). Depending on the widget this will either recolor the buttons that are normally colored with buttoncolor(), or will recolor the main area that is normally colored with color().
The default value is zero, which indicates that highlighting is disabled.
Color Style::highlight_textcolor | ( | ) | const |
Color used to draw the labels or text when the background is drawn in the highlight_color. The default of zero indicates that fltk will choose a contrasting color (either the same as the original color or white or black). I recommend you use the default if possible.
Color Style::labelcolor | ( | ) | const |
Color used to draw labels. Default is fltk::BLACK.
Font * Style::labelfont | ( | ) | const |
The font used to draw the label. Default is fltk::HELVETICA.
float Style::labelsize | ( | ) | const |
Size of labelfont(). Default is 12.
LabelType * Style::labeltype | ( | ) | const |
How to draw the label. This provides things like inset, shadow, and the symbols. fltk::NORMAL_LABEL.
float Style::leading | ( | ) | const |
Extra spacing added between text lines or other things that are stacked vertically. The default is 2. The function fltk::drawtext() will use the value from Widget::default_style, but text editors and browsers and menus and similar widgets will use the local value.
unsigned char Style::scrollbar_align | ( | ) | const |
Where to place scrollbars around a Browser or other scrolling widget. The default is fltk::ALIGN_RIGHT|fltkALIGN_BOTTOM.
unsigned char Style::scrollbar_width | ( | ) | const |
How wide the scrollbars are around a Browser or other scrolling widget. The default is 15.
Color Style::selection_color | ( | ) | const |
Color drawn behind selected text in inputs, or selected browser or menu items, or lit light buttons. The default is fltk::WINDOWS_BLUE.
Color Style::selection_textcolor | ( | ) | const |
The color to draw text atop the selection_color. The default of zero indicates that fltk will choose a contrasting color (either the same as the original color or white or black). I recommend you use the default if possible.
Color Style::textcolor | ( | ) | const |
Color to draw text inside the widget. Default is black. This is also used by many widgets to control the color when they draw the glyph(), thus it can control the color of checkmarks in fltk::CheckButton.
Font * Style::textfont | ( | ) | const |
Font to use to draw information inside the widget, such as the text in a text editor or menu or browser. Default is fltk::HELVETICA.
float Style::textsize | ( | ) | const |
Size of textfont(). This is also used by many Widgets to control the size they draw the glyph(). Default is 12.
int Style::wheel_scroll_lines | ( | ) | const [inline] |
How many lines to move for one click of a mouse wheel. The default is 3.