[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LButton



Overview:

LButton is a PowerPlant class that implements a button. The graphic for the button needs to be stored as a resource of one of these types:

The methods in this class are:

 

LButton()  
DrawGraphic()  
DrawSelf()  
HotSpotAction()  
HotSpotResult()  
PointIsInFrame()  
SetGraphics()  
SetGraphicsType()  

Data Members:

The data members in this class are:

 

mGraphicsType  
mNormalID  
mPushedID  
 

Operation:

When you create an object of this type, you provide two resource ID numbers. One is for the graphical element in its non-depressed state, and the other is for the depressed (user-pushed) state.

If you use the ICN# resource for the button, the Mac OS automatically picks the icon family member that best matches the display settings of the monitor on which it is rendered.

Although buttons are usually small, you can use a large PICT as a button. Note that ICON and ICN# resources describe images that are of Mac OS-standard, specific dimensions.

When the user releases the mouse button with the cursor inside the button perimeter, the button sends a message to its Listeners.

Source files:

(Pane Classes)

LButton.h

LButton.cp

Ancestors:

LBroadcaster

LControl

LPane

LButton()

Purpose:

The constructors create new objects from the passed-in parameters.

Access:

Public

Prototype:

LButton();

LButton( const LButton &inOriginal );

LButton( const SPaneInfo &inPaneInfo,
MessageT inClickedMessage,
OSType inGraphicsType,
ResIDT inNormalID,
ResIDT inPushedID );

LButton( LStream *inStream );
Parameters:

These constructors have the following parameters:

 

const   LButton&  
inOriginal  
A reference to the LButton object you want to copy.  
const   SPaneInfo&  
inPaneInfo  
A reference to the SPaneInfo object that is the super view.  
MessageT  
inClickedMessage  
The message sent when the button is clicked.  
OSType  
inGraphicsType  
Graphics Type ('ICN#', 'ICON', or 'PICT')  
ResIDT  
inNormalID  
Resource ID for normal graphic  
ResIDT  
inPushedID  
Resource ID for pushed graphic  
LStream*  
inStream  
A pointer to a stream object that contains the information to create the LButton object.  

DrawGraphic()

Purpose:

Draw the graphic for a button. The pane must already be focused; refer to LPane for more information.

Access:

Virtual, Protected

Prototype:

virtual void DrawGraphic( ResIDT inGraphicID );
Parameters:

The parameter for this method is:

 

ResIDT  
inGraphicID  
The resource ID of the graphic to draw in the button.  

Return:

None

DrawSelf()

Purpose:

This method is an override of the base class method DrawSelf() in LPane. It draws the normal graphic in the button.

HotSpotAction()

Purpose:

This method is an override of the base class method HotSpotAction() in LControl. It causes the buttons to toggle between two graphics, depending on whether the mouse is inside or outside the button.

HotSpotResult()

Purpose:

This method is an override of the base class method HotSpotResult() in LControl. It broadcasts a message to Listeners when the button is clicked.

PointIsInFrame()

Purpose:

This method is an override of the base class method PointIsInFrame() in LPane. It gives you information about whether a point lies within a given frame.

SetGraphics()

Purpose:

Sets the graphic resources to use for drawing the button.

Access:

Virtual, Public

Prototype:

virtual void SetGraphics( ResIDT inNormalID,
ResIDT inPushedID);
Parameters:

This method has the following parameters:

 

ResIDT  
inNormalID  
Resource ID for normal graphic  
ResIDT  
inPushedID  
Resource ID for pushed graphic  

Return:

None

SetGraphicsType()

Purpose:

This method sets the value of the mGraphicsType data member.

Access:

Virtual, Public

Prototype:

virtual void SetGraphicsType(
OSType inGraphicsType );
Parameters:

This method has the following parameters:

 

OSType  
inGraphicsType  
The value to set for mGraphicsType.  

Return:

None

mGraphicsType

Purpose:

This method holds the resource type descriptor for the graphic elements of the button. It should be one of the following:

ICN# ICON' `PICT' Access:

Protected

Prototype:

OSType mGraphicsType;

mNormalID

Purpose:

This data member holds the resource ID for the normal button graphic.

Access:

Protected

Prototype:

ResIDT mNormalID;

mPushedID

Purpose:

This data member holds the resource ID for the pushed button graphic.

Access:

Protected

Prototype:

ResIDT mPushedID;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000