The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FLTK::Style - Simulate themes for the Fast Light Toolkit

Description

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_.

Functions

BORDER_BOX

my $box = $style->BORDER_BOX( );

BORDER_FRAME

my $box = $style->BORDER_FRAME( );

COURIER

my $font = $style->COURIER( );

COURIER_BOLD

my $font = $style->COURIER_BOLD( );

COURIER_BOLD_ITALIC

my $font = $style->COURIER_BOLD_ITALIC( );

COURIER_ITALIC

my $font = $style->COURIER_ITALIC( );

DIAMOND_DOWN_BOX

my $box = $style->DIAMOND_DOWN_BOX( );

DIAMOND_UP_BOX

my $box = $style->DIAMOND_UP_BOX( );

DOWN_BOX

my $box = $style->DOWN_BOX( );
my $box = $style->DOWN_BOX( );

EMBOSSED_BOX

my $box = $style->EMBOSSED_BOX( );

EMBOSSED_LABEL

my $type = $style->EMBOSSED_LABEL( );

ENGRAVED_BOX

my $box = $style->ENGRAVED_BOX( );

ENGRAVED_LABEL

my $type = $style->ENGRAVED_LABEL( );

FLAT_BOX

my $box = $style->FLAT_BOX( );

HELVETICA

my $font = $style->HELVETICA( );

HELVETICA_BOLD

my $font = $style->HELVETICA_BOLD( );

HELVETICA_BOLD_ITALIC

my $font = $style->HELVETICA_BOLD_ITALIC( );

HELVETICA_ITALIC

my $font = $style->HELVETICA_ITALIC( );

HIGHLIGHT_DOWN_BOX

my $box = $style->HIGHLIGHT_DOWN_BOX( );

HIGHLIGHT_UP_BOX

my $box = $style->HIGHLIGHT_UP_BOX( );

NORMAL_LABEL

my $type = $style->NORMAL_LABEL( );

NO_LABEL

my $type = $style->NO_LABEL( );

OFLAT_BOX

my $box = $style->OFLAT_BOX( );

OSHADOW_BOX

my $box = $style->OSHADOW_BOX( );

OVAL_BOX

my $box = $style->OVAL_BOX( );

PLASTIC_DOWN_BOX

my $box = $style->PLASTIC_DOWN_BOX( );

PLASTIC_UP_BOX

my $box = $style->PLASTIC_UP_BOX( );

RFLAT_BOX

my $box = $style->RFLAT_BOX( );

ROUNDED_BOX

my $box = $style->ROUNDED_BOX( );

ROUND_DOWN_BOX

my $box = $style->ROUND_DOWN_BOX( );

ROUND_UP_BOX

my $box = $style->ROUND_UP_BOX( );

RSHADOW_BOX

my $box = $style->RSHADOW_BOX( );

SCREEN_BOLD_FONT

my $font = $style->SCREEN_BOLD_FONT( );

SCREEN_FONT

my $font = $style->SCREEN_FONT( );

SHADOW_BOX

my $box = $style->SHADOW_BOX( );

SHADOW_LABEL

my $type = $style->SHADOW_LABEL( );

SYMBOL_FONT

my $font = $style->SYMBOL_FONT( );

SYMBOL_LABEL

my $type = $style->SYMBOL_LABEL( );

THIN_DOWN_BOX

my $box = $style->THIN_DOWN_BOX( );
my $box = $style->THIN_DOWN_BOX( );

THIN_UP_BOX

my $box = $style->THIN_UP_BOX( );
my $box = $style->THIN_UP_BOX( );

TIMES

my $font = $style->TIMES( );

TIMES_BOLD

my $font = $style->TIMES_BOLD( );

TIMES_BOLD_ITALIC

my $font = $style->TIMES_BOLD_ITALIC( );

TIMES_ITALIC

my $font = $style->TIMES_ITALIC( );

UP_BOX

my $box = $style->UP_BOX( );

ZAPF_DINGBATS

my $font = $style->ZAPF_DINGBATS( );

box

my $box = $style->box( );

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.

$style->box( $box );

Sets the type of box to draw around the outer edge of widget.

buttonbox

my $box = $style->buttonbox( );

The type of box to draw buttons internal the widget (notice that FLTK::Button uses box, however). The default is FLTK::UP_BOX.

$style->buttonbox( $box );

Returns the type of box to draw buttions internal the widget.

buttoncolor

my $color = $style->buttoncolor( );

Color used when drawing buttons. Default is FLTK::GRAY75.

$style->buttoncolor( $color );

color

my $color = $style->color( );

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.

$style->color( $color );

draw_boxes_inactive

my $drawn = $style->draw_boxes_inactive( );

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.

$style->draw_boxes_inactive( $value );

dynamic

my $unique = $style->dynamic( );

True if this Style is unique to the Widget that owns it, and is not shared with other Widgets.

find

my $style = FLTK::find( $name );

glyph

my $image = $style->glyph( );

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 differnt symbols. The default value draws empty squares and arrow buttons if ALIGN flags are on, see Widget::default_glpyh.

$style->glyph( $image );

Sets a small image that some Widgets use to draw part of themselves.

hide_underscore

my $looks_awesome = $style->hide_underscore( );

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.

$style->hide_underscore( $value );

highlight_color

my $color = $style->highlight_color( );

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.

$style->highlight_color( $color );

highlight_textcolor

my $color = $style->highlight_textcolor( );

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.

$style->highlight_textcolor( $color );

labelcolor

my $color = $style->labelcolor( );

Color used to draw labels. Default is FLTK::BLACK.

$style->labelcolor( $color );

labelfont

my $font = $style->labelfont( );

The font used to draw the label. Default is FLTK::HELVETICA.

$style->labelfont( $font );

labelsize

my $size = $style->labelsize( );

Size of labelfont( ). Default is 12.

$style->labelsize( $size );

labeltype

my $type = $style->labeltype( );

How to draw the label. This provides things like inset, shadow, and the symbols. FLTK::NORMAL_LABEL.

$style->labeltype( $type );

leading

my $size = $style->leading( );

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.

$style->leading( $size );

new

my $style = $style->new( );

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.

scrollbar_align

my $location = $style->scrollbar_align( );

Where to place scrollbars around a Browser or other scrolling widget. The default is FLTK::ALIGN_RIGHT|FLTK::ALIGN_BOTTOM.

$style->scrollbar_align( $value );

scrollbar_width

my $width = $style->scrollbar_width( );

How wide the scrollbars are around a Browser or other scrolling widget. The default is 15.

$style->scrollbar_width( $value );

selection_color

my $color = $style->selection_color( );

Color drawn behind selected text in inputs, or selected browser or menu items, or lit light buttons. The default is FLTK::WINDOWS_BLUE.

$style->selection_color( $color );

selection_textcolor

my $color = $style->selection_textcolor( );

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.

$style->selection_textcolor( $color );

textcolor

my $color = $style->textcolor( );

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.

$style->textcolor( $color );

textfont

my $font = $style->textfont( );

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.

$style->textfont( $font );

textsize

my $size = $style->textsize( );

Size of textfont( ). This is also used by many Widgets to control the size they draw the glyph( ). Default is 12.

$style->textsize( $size );

wheel_scroll_lines

my $lines = $style->wheel_scroll_lines( );

How many lines to move for one click of a mouse wheel. The default is 3.

$style->wheel_scroll_lines( $lines );

Author

Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/

License and Legal

Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.

When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.