Apycom jQuery Menus

Class MyLabel Used to print text The text is first printed into a surface to speed later rendering... More...

#include <SDK_Manila_Sense.h>

Inherits Element.

Collaboration diagram for MyLabel:

List of all members.

Public Member Functions

 MyLabel (int idElement, int x, int y, int width, int height, wstring text, int fontType=0, bool centered=true, DWORD color=0)
 Use this constructor if you know the size you want...
 MyLabel (int idElement, int x, int y, wstring text, int fontType=0, DWORD color=0, bool realPos=false, DWORD backColor=1)
 Use this constructor if your text has a background (if you have a MyPictureBox object, use the next constructor).
 MyLabel (int idElement, int x, int y, wstring text, MyPictureBox *image, int paddingText, int fontType=0, DWORD color=0)
 Use this constructor if you want a background below your text (if you have a surface, use the previous constructor).
 MyLabel (int idElement, int x, int y, wstring text, DIRECTDRAW_GDI *bkgHover, int fontType=0, DWORD color=0)
 Use this constructor if your text has a background (if you have a MyPictureBox object, use the next constructor).
 ~MyLabel (void)
void center ()
 Use this function to center the text both horizontally and vertically.
void centerH (int left, int right)
 Use this function to center the text horizontally.
void centerV (int top=-1, int bottom=-1)
 Use this function to center the text vertically.
void changeColor (DWORD color, int state=LABEL_STATE_NORMAL)
 Use this function to change the color of text.
void changeState (int newState)
 To change the state of text (LABEL_STATE_NORMAL, LABEL_STATE_HOVER, LABEL_STATE_DSBL, LABEL_STATE_SELECTED).
void changeVisibility (bool vis, bool eraseBckground=true)
 Use this function to change visibility of text.
int getPaddingLeft ()
 Use this function to get the padding left of text.
int getPaddingTop ()
 Use this function to get the padding top of text.
int getState ()
 Return the state of text (useful only when a background with different state are associated)...
wstring getText ()
 To get the text.
virtual ElementisClicked (int x, int y)
 To test if a position is inside the element...
virtual void paint (DIRECTDRAW_GDI *lpDDraw, int x, int y)
 To draw the text...
virtual void paintColor (DIRECTDRAW_GDI *lpDDraw, int x, int y, COLORREF color, COLORREF background)
 To draw the text with particular color...
bool run (bool isRightClicked=false)
 To start action associated with this element.
void setBkg (DIRECTDRAW_GDI *surf)
 Use this function to set the background of text (to get a pointer of DIRECTDRAW_GDI, use Element::loadImage).
void setPaddingLeft (int l)
 Use this function to set the padding left of text.
void setPaddingTop (int t)
 use this function to set the padding top of text
void setText (wstring nT, bool redraw=true)
 To change the text.
void unClick ()
 To notify the item it is no longer active.

Public Attributes

bool isClickable
 Set to true if you want that the text can be clicked.

Static Public Attributes

static HFONT fontItalic = NULL
 Italic font (9pt).
static HFONT fontNormal = NULL
 Normal Font (9pt).
static HFONT fontSmall = NULL
 small font (7pt)
static HFONT fontTitle = NULL
 Font for titles (10pt).

Detailed Description

Class MyLabel Used to print text The text is first printed into a surface to speed later rendering...

Can use a lot of memory if your app have a lot of text...

Definition at line 533 of file SDK_Manila_Sense.h.


Constructor & Destructor Documentation

MyLabel::MyLabel ( int  idElement,
int  x,
int  y,
int  width,
int  height,
wstring  text,
int  fontType = 0,
bool  centered = true,
DWORD  color = 0 
)

Use this constructor if you know the size you want...

Parameters:
idElement a number used to identify the Element (Can be used to get a pointer with Element::getElementByID)
x padding left of the element
y padding top of the element
width width of text
height height of text (if text is too long, your bounding box will may be not respect this constraint)
text What you want to be printed
fontType Font type (TEXT_NORMAL, TEXT_BIG, TEXT_ITALIC or TEXT_SMALL)
centered Set to true if you want your text being horizontally centered)
color Color of your text (use RGB macro for easier use)

Definition at line 172 of file MyLabel.cpp.

MyLabel::MyLabel ( int  idElement,
int  x,
int  y,
wstring  text,
int  fontType = 0,
DWORD  color = 0,
bool  realPos = false,
DWORD  backColor = 1 
)

Use this constructor if your text has a background (if you have a MyPictureBox object, use the next constructor).

Parameters:
idElement a number used to identify the Element (Can be used to get a pointer with Element::getElementByID)
x padding left of the element
y padding top of the element
text What you want to be printed
fontType Font type (TEXT_NORMAL, TEXT_BIG, TEXT_ITALIC or TEXT_SMALL)
color Color of your text (use RGB macro for easier use)
realPos If true, text will not being re positioned when using not VGA devices (not using GlobalInformations::percentOfVGA)
backColor Depreciated, only for compatibility with previous versions

Definition at line 159 of file MyLabel.cpp.

MyLabel::MyLabel ( int  idElement,
int  x,
int  y,
wstring  text,
DIRECTDRAW_GDI bkgHover,
int  fontType = 0,
DWORD  color = 0 
)

Use this constructor if your text has a background (if you have a MyPictureBox object, use the next constructor).

Parameters:
idElement a number used to identify the Element (Can be used to get a pointer with Element::getElementByID)
x padding left of the element
y padding top of the element
text What you want to be printed
bkgHover Background image
fontType Font type (TEXT_NORMAL, TEXT_BIG, TEXT_ITALIC or TEXT_SMALL)
color Color of your text (use RGB macro for easier use)

Definition at line 137 of file MyLabel.cpp.

MyLabel::MyLabel ( int  idElement,
int  x,
int  y,
wstring  text,
MyPictureBox image,
int  paddingText,
int  fontType = 0,
DWORD  color = 0 
)

Use this constructor if you want a background below your text (if you have a surface, use the previous constructor).

Parameters:
idElement a number used to identify the Element (Can be used to get a pointer with Element::getElementByID)
x padding left of the element
y padding top of the element
text What you want to be printed
image Background image
paddingText top-left padding relative to background
fontType Font type (TEXT_NORMAL, TEXT_BIG, TEXT_ITALIC or TEXT_SMALL)
color Color of your text (use RGB macro for easier use)

Definition at line 114 of file MyLabel.cpp.

MyLabel::~MyLabel ( void   ) 

Definition at line 290 of file MyLabel.cpp.


Member Function Documentation

void MyLabel::center (  ) 

Use this function to center the text both horizontally and vertically.

Definition at line 215 of file MyLabel.cpp.

void MyLabel::centerH ( int  left,
int  right 
)

Use this function to center the text horizontally.

Parameters:
left left of bounding box
right right of bounding box

Definition at line 208 of file MyLabel.cpp.

void MyLabel::centerV ( int  top = -1,
int  bottom = -1 
)

Use this function to center the text vertically.

Parameters:
top top of bounding box
bottom bottom of bounding box

Definition at line 198 of file MyLabel.cpp.

void MyLabel::changeColor ( DWORD  color,
int  state = LABEL_STATE_NORMAL 
)

Use this function to change the color of text.

Parameters:
color Use RGB macro to set value easily : RGB(255,0,0) will be red printed
state one of these values: LABEL_STATE_NORMAL, LABEL_STATE_HOVER, LABEL_STATE_DSBL or LABEL_STATE_SELECTED

Definition at line 19 of file MyLabel.cpp.

void MyLabel::changeState ( int  newState  )  [inline]

To change the state of text (LABEL_STATE_NORMAL, LABEL_STATE_HOVER, LABEL_STATE_DSBL, LABEL_STATE_SELECTED).

Definition at line 667 of file SDK_Manila_Sense.h.

void MyLabel::changeVisibility ( bool  vis,
bool  eraseBckground = true 
)

Use this function to change visibility of text.

Parameters:
vis if true show the text, else hide the text
eraseBckground if true erase background before repaint the text (usually true)

Definition at line 492 of file MyLabel.cpp.

int MyLabel::getPaddingLeft (  )  [inline]

Use this function to get the padding left of text.

Definition at line 693 of file SDK_Manila_Sense.h.

int MyLabel::getPaddingTop (  )  [inline]

Use this function to get the padding top of text.

Definition at line 691 of file SDK_Manila_Sense.h.

int MyLabel::getState (  )  [inline]

Return the state of text (useful only when a background with different state are associated)...

Definition at line 665 of file SDK_Manila_Sense.h.

wstring MyLabel::getText (  )  [inline]

To get the text.

Returns:
The value of the text

Definition at line 662 of file SDK_Manila_Sense.h.

Element * MyLabel::isClicked ( int  x,
int  y 
) [virtual]

To test if a position is inside the element...

Parameters:
x position of click
y position of click
Returns:
NULL if not clicked, this else

Implements Element.

Definition at line 295 of file MyLabel.cpp.

void MyLabel::paint ( DIRECTDRAW_GDI lpDDraw,
int  x,
int  y 
) [virtual]

To draw the text...

Parameters:
lpDDraw surface to print (GlobalInformations::primaryBuffer for example)
x position of top-left
y position of top-left

Implements Element.

Definition at line 473 of file MyLabel.cpp.

void MyLabel::paintColor ( DIRECTDRAW_GDI lpDDraw,
int  x,
int  y,
COLORREF  color,
COLORREF  background 
) [virtual]

To draw the text with particular color...

Parameters:
lpDDraw surface to print (GlobalInformations::primaryBuffer for example)
x position of top-left
y position of top-left
color Use RGB macro to set value easily : RGB(255,0,0) will be red printed

Definition at line 331 of file MyLabel.cpp.

bool MyLabel::run ( bool  isRightClicked = false  )  [virtual]

To start action associated with this element.

Parameters:
isRightClicked true if your want to start action associated with a right click
Returns:
true if element has take control of future drawing (usually return false)

Reimplemented from Element.

Definition at line 314 of file MyLabel.cpp.

void MyLabel::setBkg ( DIRECTDRAW_GDI surf  ) 

Use this function to set the background of text (to get a pointer of DIRECTDRAW_GDI, use Element::loadImage).

Parameters:
left left of bounding box
right right of bounding box

Definition at line 484 of file MyLabel.cpp.

void MyLabel::setPaddingLeft ( int  l  )  [inline]

Use this function to set the padding left of text.

Definition at line 688 of file SDK_Manila_Sense.h.

void MyLabel::setPaddingTop ( int  t  )  [inline]

use this function to set the padding top of text

Definition at line 686 of file SDK_Manila_Sense.h.

void MyLabel::setText ( wstring  nT,
bool  redraw = true 
)

To change the text.

Parameters:
nT new text
redraw if true, the background will be erased (usually set to true)

Definition at line 220 of file MyLabel.cpp.

void MyLabel::unClick (  )  [virtual]

To notify the item it is no longer active.

Reimplemented from Element.

Definition at line 325 of file MyLabel.cpp.


Member Data Documentation

HFONT MyLabel::fontItalic = NULL [static]

Italic font (9pt).

Definition at line 565 of file SDK_Manila_Sense.h.

HFONT MyLabel::fontNormal = NULL [static]

Normal Font (9pt).

Definition at line 564 of file SDK_Manila_Sense.h.

HFONT MyLabel::fontSmall = NULL [static]

small font (7pt)

Definition at line 566 of file SDK_Manila_Sense.h.

HFONT MyLabel::fontTitle = NULL [static]

Font for titles (10pt).

Definition at line 563 of file SDK_Manila_Sense.h.

Set to true if you want that the text can be clicked.

Definition at line 667 of file SDK_Manila_Sense.h.


The documentation for this class was generated from the following files:
Thibault LELORE