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

 

LGrafPortView



Overview:

LGrafPortView is a PowerPlant class that is used as an alternative to LWindow in non-PowerPlant applications.

LGrafPortView can be useful in application frameworks and program extensions such as XCMDs.

Methods :

The methods in this class are:

 

LGrafPortView()  
~LGrafPortView()  
Activate()  
ApplyForeAndBackColors()  
ClickInContent()  
CreateGrafPortView()  
Deactivate()  
DispatchCommand()  
DoIdle()  
DoKeyPress()  
Draw()  
DrawSelf()  
EstablishPort()  
GetMacPort()  
InitGrafPortView()  
InvalPortRect()  
InvalPortRgn()  
SetForeAndBackColors()  
UpdatePort()  
ValidPortRect()  
ValidPortRgn()  
 

Data Members:

The data members in this class are:

 

mGrafPtr  
mForeColor  
mBackColor  
 

Operation:

When you create a GrafPortView, you should set the current port to the Toolbox window (or other valid GrafPort) in which you want to place the GrafPortView. Then call LGrafPortView::CreateGrafPortView() to create and initialize the GrafPortView from a PPob resource.

Source files:

(Pane Classes)

LGrafPortView.h

LGrafPortView.cp

See also:

 

LGrafPortView()

Purpose:

LGrafPortView has four constructor methods. The first is the default contructor. The second constructor is a parameter constructor that copies inGrafPtr to mGrafPtr and then initializes the view.

The third constructor creates a LGrafPortView object from data in the SViewInfo structure and sets the pane states. Signals if mGrafPtr is nil.

The last constructor creates a LGrafPortView object from a stream (usually from a PPob resource), and sets the pane states. Signals if mGrafPtr is nil.

Access :

Public

Prototype:

LGrafPortView();

LGrafPortView( GrafPtr inGrafPtr);

LGrafPortView( const SPaneInfo& inPaneInfo,
  const SViewInfo &inViewInfo)
  : LView(inPaneInfo, inViewInfo);
LGrafPortView(LStream *inStream):LView(inStream);
Parameters:

None

Return:

No return value for a constructor

~LGrafPortView()

Purpose:

The destructor destroys the LGrafPortView object.

Access :

Public

Prototype:

virtual ~LGrafPortView();
Parameters:

None

Return:

No return value for a destructor

Activate()

Purpose:

Checks the pane state to see if the GrafPortView is off. If so, sets it on and activates the window. If this Window can contain the Target, and it is not already OnDuty, restore the Target to what it was when the Window was last active.

Access :

Public, Virutal

Prototype:

void Activate();
Parameters:

None

Return:

None

ApplyForeAndBackColors()

Purpose:

Uses Mac OS toolbox calls to set the foreground and background colors of the current port.

Access :

Protected, Virutal

Prototype:

void ApplyForeAndBackColors() const;
Parameters:

None

Return:

None

Remarks:

The GrafPortView or one of its SubPanes must already be focused.

ClickInContent()

Purpose:

Called when the mouse click is in the content part of a GrafPortView object. If it is enabled, sets up the extended event record, calls the object's Click method.

Access :

Public, Virtual

Prototype:

void ClickInContent(
  const EventRecord& inMacEvent);
Parameters:

 

const EventRecord&  
inMacEvent  
The Mac OS event record  

Return:

None

CreateGrafPortView()

Purpose:

Return a new GrafPortView object initialized from a PPob resource.

Access :

Public

Prototype:

static GrafPortView* CreateGrafPortView(
  ResIDT inGrafPortViewID,
  LCommander* inSuperCommander);
Parameters:

 

ResIDT  
inGrafPortViewID  
ID in PPob resource  
LCommander*  
inSuperCommander  
Pointer to the SuperCommander  

Return:

Pointer to a GrafPortView object.

Remarks:

GrafPortView is put inside the current GrafPort.

Deactivate()

Purpose:

Deactivates a GrafPortView object, and, if it was OnDuty, switches the Target to the SuperCommander.

Access :

Public, Virtual

Prototype:

virtual void Deactivate();
Parameters:

None

Return:

None

DispatchCommand()

Purpose:

Handle a Command for a GrafPortView by getting the target and passing the command to it.

Access :

Public, Virtual

Prototype:

void DispatchCommand(
  CommandT inCommand,
  void* ioParam);
Parameters:

 

CommandT  
inCommand  
The command  
void *  
ioParam  
Misc. i/o parameter  

Return:

None

DoIdle()

Purpose:

Saves the port state and sends a message to the periodical handler to idle.

Access :

Public, Virtual

Prototype:

void DoIdle(
  const EventRecord& inMacEvent);
Parameters:

 

const EventRecord&  
inMacEvent  
Address of Mac OS Event record  

Return:

None

DoKeyPress()

Purpose:

Called when the GrafPortView gets a KeyDown event. If the LCommander's sTarget data member indicates that this object is the target, process the event.

Access :

Public, Virtual

Prototype:

void DoKeyPress(
  const EventRecord& inMacEvent);
Parameters:

 

const EventRecord&  
inMacEvent  
Address of Mac OS Event record  

Return:

None

Draw()

Purpose:

Draw a GrafPortView using LView::Draw(). inSuperDrawRgnH specifies, in port coordinates, the portion of the View's SuperView that needs to be drawn. Specify nil to draw the entire view.

Access :

Protected, Virtual

Prototype:

void Draw(
  RgnHandle inSuperDrawRgnH);
Parameters:

 

RgnHandle  
inSuperDrawRgnH  
Mac OS region handle  

Return:

None

Remarks:

Overrides LPane::Draw() to deal with special non-window condition and then cycle through Subpanes. Rather than overriding this, you should override LGrafPortView::DrawSelf(), and get called from here.

DrawSelf()

Purpose:

Draws the contents of the GrafPortView object. Currently erases the frame as well.

Access :

Protected, Virtual

Prototype:

virtual void DrawSelf();
Parameters:

None

Return:

None

EstablishPort()

Purpose:

Make GrafPortView the current Port.

Access :

Public, Virtual

Prototype:

Boolean EstablishPort();
Parameters:

None

Return:

Always returns TRUE.

Remarks:

If you call this function directly, you should call LView::OutOfFocus(nil), since changing the current port may invalidate the Focus.

GetMacPort()

Purpose:

Return the Toolbox GrafPort associated with a LGrafPortView.

Access :

Public, Virtual

Prototype:

GrafPtr GetMacPort() const;
Parameters:

None

Return:

Mac OS GrafPtr

InitGrafPortView()

Purpose:

Private initializer. Initialize the GrafPortView, assuming that mGrafPtr is already initialized, set the pane states, and initialize all mForeColor fields to black and all mBackColor fields to white.

Access :

Private

Prototype:

void InitGrafPortView();
Parameters:

None

Return:

None

InvalPortRect()

Purpose:

Make the Mac OS Toolbox issue an update event, which will initiate a redraw of the rectangle.

Access :

Public, Virtual

Prototype:

void InvalPortRect(
  const Rect *inRect);
Parameters:

 

const Rect  
*inRect  
Pointer to the rectangle to redraw.  

Return:

None

Remarks:

Use this instead of the Mac OS Toolbox routine InvalRect() (see Pane validation for more information).

InvalPortRgn()

Purpose:

Ma

Access :

Public

Prototype:

virtual void InvalPortRgn(
  RgnHandle inRgnH);
Parameters:

 

RgnHandle  
inRgnH  
Mac OS handle to the region to redraw.  

Return:

None

Remarks:

Use this instead of the Mac OS Toolbox routine InvalRgn() (see Pane validation for more information).

SetForeAndBackColors()

Purpose:

Sprecify the foreground and/or background colors of a GrafPortView.

Access :

Public, Virtual

Prototype:

void SetForeAndBackColors(
  const RGBColor *inForeColor,
  const RGBColor *inBackColor);
Parameters:

 

const RGBColor  
*inForeColor  
Pointer to the foreground color  
const RGBColor  
*inBackColor  
Pointer to the background color  

Return:

None

Remarks:

Specify nil for inForeColor and/or inBackColor to leave that color trait unchanged.

UpdatePort()

Purpose:

Redraw invalidated area of the GrafPortView.

Access :

Public, Virtual

Prototype:

void UpdatePort();
Parameters:

None

Return:

None

ValidPortRect()

Purpose:

Tells the Mac OS Toolbox that the selected rectangle does not need to be redrawn.

Access :

Public, Virtual

Prototype:

void ValidPortRect(
  const Rect *inRect);
Parameters:

 

const Rect  
*inRect  
Pointer to the rectangle.  

Return:

None

Remarks:

Use intead of the Mac OS Toolbox routine InvalRect() (see Pane validation for more information).

ValidPortRgn()

Purpose:

Tells the Mac OS Toolbox that the selected region does not need to be redrawn.

Access :

Public, Virutal

Prototype:

void ValidPortRgn(
  RgnHandle inRgnH);
Parameters:

 

RgnHandle  
inRgnH  
Mac OS Handle to the region.  

Return:

None

Remarks:

Use intead of the Mac OS Toolbox routine InvalRgn() (see Pane validation for more information).

mGrafPtr

Purpose:

Maintains a pointer to the current GrafPort.

Access :

Protected

Prototype:

GrafPtr mGrafPtr;

mForeColor

Purpose:

Maintains the current foregrounc color setting.

Access :

Protected

Prototype:

RGBColor mForeColor;

mBackColor

Purpose:

Maintains the current background color setting.

Access :

Protected

Prototype:

RGBColor mBackColor;

 


[ 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