GButton Class Reference

A clickable button. More...

#include <GButton.h>

Inheritance diagram for GButton:

GView

List of all members.

Public Member Functions

 GButton (int id, int x, int y, int cx, int cy, char *name)
 Construct the control.
char * GetClass ()
bool Default ()
 True if the button is the default action on the dialog.
void Default (bool b)
 Sets the button to be the default action on the dialog.
int64 Value ()
 True if the button is down.
void Value (int64 i)
 Sets the button to down.
int OnEvent (GMessage *Msg)
 Called to process every message received by this window.
void OnMouseClick (GMouse &m)
 The mouse was clicked over this view.
void OnMouseEnter (GMouse &m)
 Mouse moves into the area over the control.
void OnMouseExit (GMouse &m)
 Mouse leaves the area over the control.
bool OnKey (GKey &k)
 A key was pressed while this view has focus.
void OnFocus (bool f)
 The view gains or loses the keyboard focus.
void OnPaint (GSurface *pDC)
 Called to paint the onscreen representation of the view.
void OnAttach ()
 Called after the view is attached to a new parent.
char * Name ()
 Returns the utf-8 text associated with this view.
char16NameW ()
 Returns the wide char text associated with this view.
bool Name (char *n)
 Sets the utf-8 text associated with this view.
bool NameW (char16 *n)
 Sets the wide char text associated with this view.
void SetFont (GFont *Fnt, bool OwnIt=false)
 Sets the font for this control.


Detailed Description

A clickable button.

When the user clicks a GButton the OnNotify() event of the GetNotify() or GetParent() view will be called with this control as the parameter. Allowing action to be taken in response to the click. This event by default bubbles up to the top level window unless some other view intercepts it on the way up the chain of parent views.


Constructor & Destructor Documentation

GButton::GButton ( int  id,
int  x,
int  y,
int  cx,
int  cy,
char *  name 
)

Construct the control.

Parameters:
id  The control's ID
x  x coord
y  y coord
cx  width
cy  height
name  Initial text

References LgiApp, Name(), SetFont(), GView::SetId(), GView::SetPos(), GView::SetTabStop(), and GRect::Valid().


Member Function Documentation

char* GButton::GetClass (  )  [inline]

The class' name. Should be overriden in child classes to return the right class name. Mostly used for debugging, but in the win32 port it is also the default WIN32 class name passed to RegisterClass() in GView::CreateClass().

Returns:
the Class' name for debugging

Reimplemented from GView.

bool GButton::Name ( char *  n  ) 

Sets the utf-8 text associated with this view.

Name and NameW are interchangable. Using them in any order will convert the text between utf-8 and wide to satify any requirement. Generally once the opposing version of the string is required both the utf-8 and wide copies of the string remain cached in RAM until the Name is changed.

Reimplemented from GView.

References GView::GetFont(), and Name().

char16* GButton::NameW (  )  [inline, virtual]

Returns the wide char text associated with this view.

On Win32 the wide characters are 16 bits, on unix systems they are 32-bit characters.

Reimplemented from GView.

References GView::NameW().

Referenced by NameW().

void GButton::SetFont ( GFont Fnt,
bool  OwnIt = false 
) [virtual]

Sets the font for this control.

The lifetime of the font passed in is the responsibility of the caller. The GView object assumes the pointer will be valid at all times.

Reimplemented from GView.

References GView::GetFont(), and GView::Invalidate().

Referenced by GButton().


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

Generated on Wed Dec 1 15:41:02 2010 for Lgi by  doxygen 1.5.7.1