MGUI::ICON Class Reference

Icon bitmap. More...

#include <mgui/icon.h>

List of all members.

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
ICONoperator= (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

Detailed Description

Icon bitmap.


Member Enumeration Documentation

Orientation relative to original design.

Enumerator:
ORIENTATION_Upright 

Upright.

ORIENTATION_RotateCW 

Rotate clockwise 90 degrees.

ORIENTATION_RotateCCW 

Rotate counterclockwise 90 degrees.

ORIENTATION_Rotate180 

Rotate 180 degrees.

ORIENTATION_MirrorHorizontal 

Mirror in horizontal direction.

ORIENTATION_MirrorVertical 

Mirror in vertical direction.

ORIENTATION_MirrorRotateCW 

Mirror horizontally then rotate clockwise.

ORIENTATION_MirrorRotateCCW 

Mirror horizontally then rotate counterclockwise.

Drawing style.

Enumerator:
STYLE_Normal 

Normal style.

STYLE_Armed 

"Armed" (typically darker background)

STYLE_Disabled 

"Disabled" (grayed out)

STYLE_DisabledArmed 

Disabled and armed (grayed with darker background).

STYLE_NoDrawBackground 

Don't draw background pixels (for Draw method only).


Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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 (  ) 

Member Function Documentation

Pixmap MGUI::ICON::CreatePixmap ( Widget  widget,
STYLE  style 
) const

Create X Pixmap for icon in specified style.

Pixmap, caller is responsible for freeing.

Parameters:
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.

Parameters:
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.

ICON& MGUI::ICON::operator= ( const ICON rhs  ) 

Assignment.

Icons are partially reference-counted so assignment is relatively efficient.

void MGUI::ICON::SetColorBackground ( const COLOR ColorBgNormal,
const COLOR ColorBgArmed 
)

Set background colors for normal and "armed" states..

Parameters:
ColorBgNormal Color to use for normal background
ColorBgArmed Color to use for "armed" background
void MGUI::ICON::SetColorBackground ( const COLOR ColorBg  ) 

Set background color.

Parameters:
ColorBg Color for both "normal" and "armed" background
void MGUI::ICON::SetColorVar ( const COLOR color,
UINT8  var = 0 
)

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.

Parameters:
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.

Parameters:
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
void MGUI::ICON::UpdatePixmap ( Widget  widget,
Pixmap  pixmap,
STYLE  style 
) const

Update X Pixmap for icon in specified style.

Parameters:
widget Widget for display/screen access
pixmap Pixmap to update, must be correct size
style Icon style

The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:36:09 2012 for TNTsdk 2012 by  doxygen 1.6.1