class PControl: public PInteractor

This class defines a user inteface entity that allows the user to control some attribute or data within the system.

Inheritance:


Public Fields

[more]PRESOURCE_ID controlID
Unique menu ID for resource binding

Public Methods

[more]virtual ~PControl ()
Destroy a control.
[more]virtual PBalloon* OnBalloonHelp ()
This function is called whenever a balloon help function for the interactor is required
[more]virtual BOOL IsTabStop () const
Determine if the dialog tabbing will stop at this control.
[more]PRESOURCE_ID GetControlID () const
Get the resource identifier of the control when it was loaded from a resource in a dialog.
[more]void SetControlID ( PRESOURCE_ID theID )
Set the resource identifier of the control.
[more]const PNotifier& GetNotifier () const
Get the current call back function that is called whenever the control needs to notify the application of some change, eg.
[more]BOOL WillNotifyOnStateUpdate () const
Get the flag for notification function called when a control requires its enable or value state updated.
[more]void SetNotifier ( const PNotifier & func, BOOL notifyForStateUpdate = FALSE )
Set the call back function that is called whenever the control needs to notify the application of some change, eg when a pushbutton is pressed, or when the control needs to be updated by the application, eg when enable states are changed and the PInteractor::UpdateCommandSources() function is called.
[more]void* GetValuePointer () const
Get the current value pointer associated with the control.
[more]void SetValuePointer ( void * ptr )
Set the current value pointer associated with the control.
[more]virtual void TransferValue ( int option )
This function transfers the value of the control to or from the variable pointed to by the value pointer member variable.
[more]const PString& GetBalloonHelp () const
Get the balloon help text.
[more]void SetBalloonHelp ( const PString & text )
Set the balloon help text.
[more]virtual void DefaultDimensions ()
Set the default (minimum) dimensions for the control.
[more]virtual void UpdateMyCommandSources ()
Scan through all child interactors and if they are a command source, execute their notification function to enable or disable the item.

Public

[more] PNotifier codes
[more] Codes passed to the notification function on changes of state.
[more] Overrides from class PInteractor
[more] New functions for class

Protected Fields

[more]PNotifier callback
Notification function to call on menu selection.
[more]void* valuePointer
Pointer to the value that is attached to the control.
[more]BOOL notifyForStateUpdate
Flag for notification function called when a control requires its enable or value state updated
[more]PString balloonHelpText
Help text for balloon help.

Protected Methods

[more] PControl ( PInteractor * parent, const PNotifier & func, void * valuePtr )
Create a new control, storing all the information provided.
[more] PControl ( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & func, void * valuePtr )
Create control from interactor layout with the specified control ID.

Protected

[more] Overrides from class PInteractor
[more] Member variables


Inherited from PInteractor:

Public Classes

oenum PositionOrigin
oenum CoordinateSystem
oenum AutoAdjustType

Public Fields

oPCursor cursor

Public Methods

ovirtual Comparison Compare( const PObject & obj ) const
oPInteractor* GetParent() const
oBOOL IsChild( PInteractor * parent ) const
oPINDEX GetNumChildren()
oPInteractor& operator[]( PINDEX index )
ovirtual void UpdateCommandSources()
ovirtual void SetFont( const PFont & newFont, BOOL toChildren = TRUE )
oconst PRealFont& GetFont()
oPDIMENSION ToPixelsDX( PDIMENSION x ) const
oPDIMENSION ToPixelsDY( PDIMENSION y ) const
oPORDINATE ToPixelsX( PORDINATE x ) const
oPORDINATE ToPixelsY( PORDINATE y ) const
oPDim ToPixels( const PDim & dim ) const
oPPoint ToPixels( const PPoint & pt ) const
oPRect ToPixels( const PRect & r ) const
oPDIMENSION FromPixelsDX( PDIMENSION x ) const
oPDIMENSION FromPixelsDY( PDIMENSION y ) const
oPORDINATE FromPixelsX( PORDINATE x ) const
oPORDINATE FromPixelsY( PORDINATE y ) const
oPDim FromPixels( const PDim & dim ) const
oPPoint FromPixels( const PPoint & pt ) const
oPRect FromPixels( const PRect & r ) const
ovoid SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin = TopLeftParent, PositionOrigin yOrigin = TopLeftParent )
oPPoint GetPosition( CoordinateSystem coords ) const
oPPoint ToScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
oPPoint FromScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
ovoid SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
oPDim GetDimensions( CoordinateSystem coords ) const
oPRect GetStructureBounds( CoordinateSystem coords ) const
ovirtual PRect GetDrawingBounds( CoordinateSystem coords ) const
ovoid AutoAdjustBounds( PRect & bounds, AutoAdjustType type = AdjustBounds )
oBOOL ContainsPoint( const PPoint & pt, CoordinateSystem coords ) const
oPInteractor* FindInteractor( const PPoint & pt, CoordinateSystem coords ) const
ovirtual void Enable( BOOL enabled = TRUE )
ovoid Disable()
oBOOL IsEnabled() const
ovirtual void ShowAll()
ovirtual void Show( BOOL visible = TRUE )
ovoid Hide()
oBOOL IsVisible() const
ovirtual void BringToTop()
ovirtual BOOL IsOnTop() const
ovoid Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Update()
ovoid GrabMouse()
ovoid ReleaseMouse()
oBOOL HasMouse() const
ovoid GrabFocus()
oBOOL HasFocus() const
ovirtual void SetCursor( const PCursor & newCursor )
oPCursor GetCursor() const
ovoid SetCursorToParent( BOOL useParent = TRUE )
ovoid SetAllCursors( const PCursor & newCursor )
ovoid RestoreAllCursors()
ovoid SetWaitCursor()
ovoid SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCursorPos( CoordinateSystem coords ) const
ovirtual void ShowCursor( BOOL show = TRUE )
ovoid HideCursor()
ovoid SetCaret( const PCaret & newCaret )
oPCaret GetCaret() const
ovoid SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCaretPos( CoordinateSystem coords ) const
ovirtual void ShowCaret(BOOL show = TRUE)
ovoid HideCaret()
ovirtual void SetForegroundColour( const PColour & newColour )
oconst PColour& GetForegroundColour() const
ovirtual void SetBackgroundColour( const PColour & newColour )
oconst PColour& GetBackgroundColour() const
oPDim GetBorderSize() const
oconst PColour& GetBorderColour() const
oPCanvas* StartMouseTrack( BOOL wantsCanvas = FALSE )
ovirtual void OnMouseMove( PKeyCode button, const PPoint & where )
ovirtual void OnMouseDown( PKeyCode button, const PPoint & where, BOOL doubleClick )
ovirtual void OnMouseUp( PKeyCode button, const PPoint & where )
ovirtual BOOL OnKeyDown( PKeyCode key, unsigned repeat )
ovirtual void OnKeyUp( PKeyCode key )
ovirtual void OnKeyInput( const PString & str )
ovirtual void OnGainFocus()
ovirtual void OnLostFocus()
ovirtual void OnStartInput()
ovirtual BOOL OnEndInput()
ovirtual void OnRedraw( PCanvas & canvas )
ovirtual void OnControlNotify( PControl & control, int option )
ovirtual void OnSelectHelp()
ovirtual void OnMouseTrack( PCanvas * canvas, const PPoint & where, BOOL lastTrack )
ovirtual void _SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin, PositionOrigin yOrigin )

Public

Overrides from class PObject

System callback functions.

Protected Fields

oPApplication* owner
oPInteractor* parent
oPInteractorList children
oPRealFont font
oPCursor savedCursor
oPCaret caret
oPPoint caretPosition
oint caretVisible
oPColour foregroundColour
oPColour backgroundColour
oPInteractor* mouseTrackInteractor
oPInteractorCanvas* mouseTrackCanvas

Protected Methods

ovirtual void _SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void _SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void SetFocusInteractor( PInteractor * interactor )
ovirtual PInteractor* GetFocusInteractor() const

Protected

o Flag to indicate that the parent interactor layouts cursor should be used with this interactor.


Documentation

This class defines a user inteface entity that allows the user to control some attribute or data within the system. A control is most commonly placed on a PDialog or PInteractorLayout class of interactor.

The PControl class is an abstract class. No instances of PControl should ever be created. Descendents of PControl will implement some particular user interface element, eg edit text, list box, radio button etc

o PControl( PInteractor * parent, const PNotifier & func, void * valuePtr )
Create a new control, storing all the information provided.
Parameters:
parent - Interactor into which the control is placed.
func - Function to call when control changes state.
valuePtr - Variable to change to the controls state.

o PControl( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & func, void * valuePtr )
Create control from interactor layout with the specified control ID. This is mainly used in support of resource based dialogs.
Parameters:
parent - Interactor on which the control is placed.
ctlID - Identifier for the control in the layout.
func - Function to call when control changes state.
valuePtr - Variable to change to the controls state.

ovirtual ~PControl()
Destroy a control.

o PNotifier codes

o Codes passed to the notification function on changes of state.
Codes passed to the notification function on changes of state.

A change to a scroll bar may proceed for some time, for example if the mouse button is pressed in the down arrow and held down. An auto-repeat would occur to continually change the scroll bar value until it is released.

o NotifyEnable
This code is passed to the notification function when the system wishes the control to be enabled or disabled

o NotifyUpdate
This code is passed to the notification function when the system wishes the control to have its state updated

o NotifyChange
This code is passed to the notification function when the user has changed the state of the control

o Overrides from class PInteractor

ovirtual PBalloon* OnBalloonHelp()
This function is called whenever a balloon help function for the interactor is required

o New functions for class

ovirtual BOOL IsTabStop() const
Determine if the dialog tabbing will stop at this control.

Returns:
TRUE if the system will stop at this control when the tab key is pressed, FALSE if the system skips over it.

oPRESOURCE_ID GetControlID() const
Get the resource identifier of the control when it was loaded from a resource in a dialog.

Returns:
resource identifier for control.

ovoid SetControlID( PRESOURCE_ID theID )
Set the resource identifier of the control. This would be used rarely as the ID is usually only used to link a resource to its C++ object instance.
Parameters:
theID - New ID for the control.

oconst PNotifier& GetNotifier() const
Get the current call back function that is called whenever the control needs to notify the application of some change, eg. when a pushbutton is pressed.

Returns:
current notifier for the control.

oBOOL WillNotifyOnStateUpdate() const
Get the flag for notification function called when a control requires its enable or value state updated.

Returns:
current update flag for menu item.

ovoid SetNotifier( const PNotifier & func, BOOL notifyForStateUpdate = FALSE )
Set the call back function that is called whenever the control needs to notify the application of some change, eg when a pushbutton is pressed, or when the control needs to be updated by the application, eg when enable states are changed and the PInteractor::UpdateCommandSources() function is called.
Parameters:
func - New notifier function for the control.
notifyForStateUpdate - Notification function is to be called when a control requires its enable or value state updated. If FALSE the notification function is only called when the item is selected.

ovoid* GetValuePointer() const
Get the current value pointer associated with the control. This is a pointer to data that is updated whenever the state of the control changes. The type of this data and the exact semantics of the updating is dependent on the descendent class.

Returns:
current value pointer.

ovoid SetValuePointer( void * ptr )
Set the current value pointer associated with the control. This is a pointer to data that is updated whenever the state of the control changes. The type of this data and the exact semantics of the updating is dependent on the descendent class.
Parameters:
ptr - New value pointer for the control.

ovirtual void TransferValue( int option )
This function transfers the value of the control to or from the variable pointed to by the value pointer member variable.

The default action is to do nothing.

Parameters:
option - Transfer value option. When this is -1 when the function transfers the value from the value pointer into the control. This is called in PDialog::OnInit() function. When option is zero then the function transfers the value from the control to the value pointer variable. This is called just before the callback function every time the controls state changes.

oconst PString& GetBalloonHelp() const
Get the balloon help text.

Returns:
balloon help text string for control.

ovoid SetBalloonHelp( const PString & text )
Set the balloon help text.
Parameters:
text - New the balloon help text.

ovirtual void DefaultDimensions()
Set the default (minimum) dimensions for the control. The actual dimensions is dependent of the type of the descendent class.

The default action is to do nothing.

o Overrides from class PInteractor

ovirtual void UpdateMyCommandSources()
Scan through all child interactors and if they are a command source, execute their notification function to enable or disable the item.

The behaviour here is to call the notification function with the code NotifyEnable.

This function is used internally by the library. It would normally not be called directly.

o Member variables

oPRESOURCE_ID controlID
Unique menu ID for resource binding

oPNotifier callback
Notification function to call on menu selection.

ovoid* valuePointer
Pointer to the value that is attached to the control.

oBOOL notifyForStateUpdate
Flag for notification function called when a control requires its enable or value state updated

oPString balloonHelpText
Help text for balloon help.


Direct child classes:
PProgressMeter
PStaticRect
PStaticIcon
PScrollBar
PNamedControl
PListViewControl
PListBox
PEditBox
PComboBox
PChoiceBox

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.