Icon bitmap. More...
#include <mgui/icon.h>
Public Types | |
| enum | ORIENTATION { ORIENTATION_Upright = 0, ORIENTATION_RotateCW, ORIENTATION_RotateCCW, ORIENTATION_Rotate180, ORIENTATION_MirrorHorizontal, ORIENTATION_MirrorVertical, ORIENTATION_MirrorRotateCW, ORIENTATION_MirrorRotateCCW } |
| enum | STYLE { STYLE_Normal = 0, STYLE_Armed, STYLE_Disabled, STYLE_DisabledArmed, STYLE_NoDrawBackground } |
Public Member Functions | |
| ICON (ICONID iconid, const COLOR &ColorBg, UINT16 width=0, UINT16 height=0, INT16 MarginLeft=-1, INT16 MarginTop=-1, ORIENTATION orientation=ORIENTATION_Upright) | |
| ICON (ICONID iconid, UINT16 width=0, UINT16 height=0, INT16 MarginLeft=-1, INT16 MarginTop=-1, ORIENTATION orientation=ORIENTATION_Upright) | |
| ICON (const ICON &rhs) | |
| ICON () | |
| ~ICON () | |
| Pixmap | CreatePixmap (Widget widget, STYLE style) const |
| void | Draw (MGD::CONTEXT &gc, INT32 x, INT32 y, STYLE style=STYLE_Normal) const |
| UINT16 | GetHeight () const |
| UINT16 | GetWidth () const |
| bool | IsEmpty () const |
| ICON & | operator= (const ICON &rhs) |
| void | SetColorBackground (const COLOR &ColorBgNormal, const COLOR &ColorBgArmed) |
| void | SetColorBackground (const COLOR &ColorBg) |
| void | SetColorVar (const COLOR &color, UINT8 var=0) |
| void | SetOrientation (ORIENTATION orientation) |
| void | SetSize (UINT16 width, UINT16 height, INT16 MarginLeft=-1, INT16 MarginTop=-1) |
| void | UpdatePixmap (Widget widget, Pixmap pixmap, STYLE style) const |
Icon bitmap.
Orientation relative to original design.
| enum MGUI::ICON::STYLE |
| MGUI::ICON::ICON | ( | ) |
Default constructor, creates empty icon.
| MGUI::ICON::ICON | ( | const ICON & | rhs | ) |
Copy constructor.
Icons are partially reference-counted so copy and return-by-value is efficient.
| MGUI::ICON::ICON | ( | ICONID | iconid, | |
| UINT16 | width = 0, |
|||
| UINT16 | height = 0, |
|||
| INT16 | MarginLeft = -1, |
|||
| INT16 | MarginTop = -1, |
|||
| ORIENTATION | orientation = ORIENTATION_Upright | |||
| ) |
Construct using ICONID with common background color, optional size and orientation.
| width | Width in pixels, 0 to use as designed | |
| height | Height in pixels, 0 to use as designed | |
| MarginLeft | Left margin in pixels, -1 to center in specified width | |
| MarginTop | Top margin in pixels, -1 to center in specified height | |
| orientation | Orientation |
| MGUI::ICON::ICON | ( | ICONID | iconid, | |
| const COLOR & | ColorBg, | |||
| UINT16 | width = 0, |
|||
| UINT16 | height = 0, |
|||
| INT16 | MarginLeft = -1, |
|||
| INT16 | MarginTop = -1, |
|||
| ORIENTATION | orientation = ORIENTATION_Upright | |||
| ) |
Construct using ICONID and background color, with optional size and orientation.
| ColorBg | Background color | |
| width | Width in pixels, 0 to use as designed | |
| height | Height in pixels, 0 to use as designed | |
| MarginLeft | Left margin in pixels, -1 to center in specified width | |
| MarginTop | Top margin in pixels, -1 to center in specified height | |
| orientation | Orientation |
| MGUI::ICON::~ICON | ( | ) |
Create X Pixmap for icon in specified style.
Pixmap, caller is responsible for freeing.
| widget | Widget for display/screen access | |
| style | Icon style |
| void MGUI::ICON::Draw | ( | MGD::CONTEXT & | gc, | |
| INT32 | x, | |||
| INT32 | y, | |||
| STYLE | style = STYLE_Normal | |||
| ) | const |
Draw icon.
| x | X coordinate corresponding to left edge of icon | |
| y | Y coordinate corresponding to top edge of icon | |
| style | Icon style |
| UINT16 MGUI::ICON::GetHeight | ( | ) | const [inline] |
Get icon height.
| UINT16 MGUI::ICON::GetWidth | ( | ) | const [inline] |
Get icon width.
| bool MGUI::ICON::IsEmpty | ( | ) | const |
Determine if icon is empty.
Assignment.
Icons are partially reference-counted so assignment is relatively efficient.
Set background colors for normal and "armed" states..
| ColorBgNormal | Color to use for normal background | |
| ColorBgArmed | Color to use for "armed" background |
| void MGUI::ICON::SetColorBackground | ( | const COLOR & | ColorBg | ) |
Set background color.
| ColorBg | Color for both "normal" and "armed" background |
Set "variable" color.
An icon may have one or more "variable" colors that can be set at runtime. Attempts to set for index that is out of range will be ignored.
| var | Variable color index |
| void MGUI::ICON::SetOrientation | ( | ORIENTATION | orientation | ) | [inline] |
Set orientation.
Orientation is relative to original design, so changes are not cumulative.
| void MGUI::ICON::SetSize | ( | UINT16 | width, | |
| UINT16 | height, | |||
| INT16 | MarginLeft = -1, |
|||
| INT16 | MarginTop = -1 | |||
| ) |
Set icon size.
| width | Width in pixels, if less than design width will use as designed | |
| height | Height in pixels, if less than design height will use as designed | |
| MarginLeft | Left margin in pixels, -1 to center in specified width | |
| MarginTop | Top margin in pixels, -1 to center in specified height |
Update X Pixmap for icon in specified style.
| widget | Widget for display/screen access | |
| pixmap | Pixmap to update, must be correct size | |
| style | Icon style |
1.6.1