UIQ Technology
Symbian OS Library

UIQ 3.1 SDK        UIQ developer portal

[Index] [Spacer] [Previous] [Next]



Location: EIKBUTB.H
Link against: eikcoctl.lib

Class CEikButtonBase

class CEikButtonBase : public CEikBorderedControl, public MQikCommandListOwner, public MQikCommandHandler;

Description

This is the base class from which concrete button controls (command buttons, option buttons and checkboxes) are derived.

The base class implements knowledge of the buttons logical state, and can respond to user events. It cannot, however, draw itself.Derived classes should provide an appropriate implementation of CCoeControl::Draw() . It is usual to make the on-screen appearance of the button dependent on its current state. Derived classes may also implement StateChanged() to respond appropriately to changes in the draw state.

Derivation

  • MObjectProvider - An interface that allows an object to be part of a network of object providers
  • CBase - Base class for all classes to be instantiated on the heap
  • Members

    Defined in CEikButtonBase:
    ActivateL(), Animate(), Border(), CEikButtonBase(), CEikButtonBase_Reserved_1(), CEikButtonBase_Reserved_2(), CEikButtonBase_Reserved_3(), ComponentControl(), ConstructFromResourceL(), CopyDrawStateTo(), CountComponentControls(), Draw(), DrawState(), EClear, EDrawClear, EDrawClearPressed, EDrawIndeterminate, EDrawIndeterminatePressed, EDrawSet, EDrawSetPressed, EIndeterminate, ESet, FocusChanged(), GetColorUseListL(), GetHelpContext(), GetTextDrawer(), HandleCommandL(), HandleControlArrayEventL(), HandlePointerBufferReadyL(), HandlePointerEventL(), HandleResourceChange(), HasBorder(), InputCapabilities(), IsPressed(), MakeVisible(), MapCommandHandler(), MinimumSize(), MopSupplyObject(), OfferKeyEventL(), PositionChanged(), PrepareForFocusGainL(), PrepareForFocusLossL(), RequestRelayout(), SetAdjacent(), SetAllowTristate(), SetBehavior(), SetBorder(), SetBorder(), SetBubbleHelpTextL(), SetContainerWindowL(), SetCoordinator(), SetDimmed(), SetIgnoreNextPointerUp(), SetLayoutManagerL(), SetNeighbor(), SetParent(), SetReportOnPointerDown(), SetState(), SetTextBaselineSpacing(), SizeChanged(), State(), StateChanged(), TDrawState, TState, TextBaselineOffset(), WriteInternalStateL(), iButFlags, ~CEikButtonBase()

    Inherited from CBase:
    Delete(), Extension_(), operator new()

    Inherited from CCoeControl:
    AccumulatedZoom(), ActivateGc(), BackedUpWindow(), Background(), CapturesPointer(), ClaimPointerGrab(), CloseWindow(), ComponentArrayExists(), Components(), ControlContext(), ControlEnv(), CopyControlContextFrom(), CreateBackedUpWindowL(), CreateWindowL(), DeactivateGc(), DrawBackground(), DrawDeferred(), DrawForeground(), DrawNow(), DrawableWindow(), EAbsoluteZoom, ERelativeZoom, EnableDragEvents(), FindBackground(), FindFontProvider(), GetColor(), GetGc(), GrabbingComponent(), HandleComponentControlsResourceChange(), HandleRedrawEvent(), HitTest(), IgnoreEventsUntilNextPointerUp(), Index(), InitComponentArrayL(), IsActivated(), IsBackedUp(), IsBeingDestroyed(), IsBlank(), IsDimmed(), IsFocused(), IsNonFocusing(), IsReadyToDraw(), IsVisible(), LayoutManager(), MaximumWidth(), MopNext(), Observer(), OverrideColorL(), OwnsWindow(), Parent(), Position(), PositionRelativeToScreen(), Rect(), RecursivelyMergedInputCapabilities(), ReportEventL(), Reserved_2(), ResetGc(), ScreenFont(), SetAllowStrayPointers(), SetBackground(), SetBlank(), SetCanDrawOutsideRect(), SetComponentsToInheritVisibility(), SetControlContext(), SetCornerAndSize(), SetExtent(), SetExtentToWholeScreen(), SetFocus(), SetFocusing(), SetFontProviderL(), SetGc(), SetGloballyCapturing(), SetHitTest(), SetMaximumWidth(), SetMopParent(), SetNonFocusing(), SetObserver(), SetPointerCapture(), SetPosition(), SetRect(), SetSize(), SetSizeWithoutNotification(), SetUniqueHandle(), SetZoomFactorL(), Size(), SystemGc(), TZoomType, TextDrawer(), UniqueHandle(), Window(), ZoomWithType(), iCoeEnv, iContext, iPosition, iSize

    Inherited from CEikBorderedControl:
    iBorder

    Inherited from MEikBorderedControl:
    ETypeId, anonymous

    Inherited from MObjectProvider:
    MObjectProvider_Reserved1(), MObjectProvider_Reserved2(), MopGetObject(), MopGetObjectNoChaining()

    Inherited from MQikCommandHandler:
    HandleAttemptDimmedSelectionL()


    Construction and destruction


    CEikButtonBase()

    IMPORT_C CEikButtonBase();

    Description

    Empty default constructor.


    ~CEikButtonBase()

    IMPORT_C ~CEikButtonBase();

    Description

    Destructor.

    Destroys a CEikButtonBase object. Button base objects do not own their coordinator, the destructor therefore does not delete it.

    [Top]


    Member functions


    State()

    IMPORT_C TState State() const;

    Description

    Gets the buttons logical state.

    Return value

    TState

    " TState " The buttons logical state. This can be one of three possible TState values.


    SetState()

    IMPORT_C void SetState(TState aState);

    Description

    Sets the buttons state. In order to create a Tri-State button, this method should be called once with the state EIndeterminate.

    Parameters

    TState aState


    Animate()

    virtual IMPORT_C void Animate();

    Description

    Animates a button; showing the control as momentarily depressed.

    This is called by OfferKeyEventL() ; it may also be called by an application when the state of a button control is changed from elsewhere to mimic button behaviour and provide more feedback to the user.


    SetCoordinator()

    IMPORT_C void SetCoordinator(TEikButtonCoordinator *aButCoord);

    Description

    Sets the buttons co-ordinator.

    This function sets the specified TEikButtonCoordinator object as the buttons co-ordinator. A button co-ordinator manages the interdependence between buttons in a group.

    Parameters

    TEikButtonCoordinator *aButCoord


    SetBehavior()

    IMPORT_C void SetBehavior(TButtonBehavior aBehavior);

    Description

    Sets the buttons behaviour.

    A button can be made to stay set or stay clear. It can also be made a latching button.

    Parameters

    TButtonBehavior aBehavior


    SetIgnoreNextPointerUp()

    IMPORT_C void SetIgnoreNextPointerUp();

    Description

    Sets the button flag so that the next pointer up event is ignored.


    SetBubbleHelpTextL()

    IMPORT_C void SetBubbleHelpTextL(const TDesC &aText);

    Description

    Sets the text to appear in a bubble help message for the button.

    Parameters

    const TDesC &aText


    SetReportOnPointerDown()

    protected: IMPORT_C void SetReportOnPointerDown();

    Description

    Sets event reporting on pointer down events.

    If this flag is set, HandlePointerEvent() will report events to the control observer on incoming pointer down events. Normally events are only sent by the button in response to an incoming pointer down event followed by a pointer up event.


    DrawState()

    protected: IMPORT_C TDrawState DrawState() const;

    Description

    Gets the current draw state.

    Return value

    TDrawState

    " TDrawState " The current draw state.


    IsPressed()

    protected: IMPORT_C TBool IsPressed() const;

    Description

    Tests whether the button is currently being pressed by the user.

    Return value

    TBool

    " TBool " ETrue if the button is currently being pressed by the user.


    SetAllowTristate()

    protected: IMPORT_C void SetAllowTristate();

    Description

    Specifies the button can have an indeterminate state that is neither on, nor off.


    CopyDrawStateTo()

    protected: IMPORT_C void CopyDrawStateTo(CEikButtonBase *aTargetButton) const;

    Description

    Copies the current draw state to the specified button.

    Parameters

    CEikButtonBase *aTargetButton


    GetColorUseListL()

    virtual IMPORT_C void GetColorUseListL(CArrayFix< TCoeColorUse > &aColorUseList) const;

    Description

    Gets a list of logical colours employed in the drawing of the control, paired with an explanation of how they are used.

    Appends the list to aColorUseList .

    Parameters

    CArrayFix< TCoeColorUse > &aColorUseList


    HandleResourceChange()

    virtual IMPORT_C void HandleResourceChange(TInt aType);

    Description

    Handles a change to the control's resources which are shared across the environment.

    For example, colours or fonts.

    Parameters

    TInt aType


    WriteInternalStateL()

    virtual IMPORT_C void WriteInternalStateL(RWriteStream &aWriteStream) const;

    Description

    Writes the internal state of the control and its components to aStream. Does nothing in release mode. Designed to be overidden and base called by subclasses.

    Parameters

    RWriteStream &aWriteStream


    PrepareForFocusGainL()

    virtual IMPORT_C void PrepareForFocusGainL();

    Description

    Notifier called upon before the control gains focus.


    PrepareForFocusLossL()

    virtual IMPORT_C void PrepareForFocusLossL();

    Description

    Notifier called upon before the control loses focus.


    GetTextDrawer()

    private: virtual IMPORT_C void GetTextDrawer(CCoeTextDrawerBase *&aTextDrawer, const CCoeControl *aDrawingControl, TInt aKey) const;

    Description

    Parameters

    CCoeTextDrawerBase *&aTextDrawer

    const CCoeControl *aDrawingControl

    TInt aKey


    MapCommandHandler()

    virtual IMPORT_C MQikCommandHandler *MapCommandHandler(CQikCommand &aCommand);

    Description

    From MQikCommandListOwner

    Parameters

    CQikCommand &aCommand

    Return value

    MQikCommandHandler *


    HandleCommandL()

    virtual IMPORT_C void HandleCommandL(CQikCommand &aCommand);

    Description

    From MQikCommandHandler

    Parameters

    CQikCommand &aCommand


    StateChanged()

    private: virtual IMPORT_C void StateChanged();

    Description

    Notifies the button that its draw state has changed.

    This function is called by CEikButtonBase when the buttons draw state changes, and may be overriden by derived classes in order to respond appropriately. For example, certain standard Uikon classes change their border type ready for drawing.Subclasses should call their own StateChanged() function whenever they update the draw state.


    CEikButtonBase_Reserved_1()

    private: virtual IMPORT_C void CEikButtonBase_Reserved_1();

    Description


    CEikButtonBase_Reserved_2()

    private: virtual IMPORT_C void CEikButtonBase_Reserved_2();

    Description


    CEikButtonBase_Reserved_3()

    private: virtual IMPORT_C void CEikButtonBase_Reserved_3();

    Description


    HandlePointerEventL()

    virtual IMPORT_C void HandlePointerEventL(const TPointerEvent &aPointerEvent);

    Description

    Handles pointer events occurring on the control.

    This function provides an appropriate implementation of CCoeControl::HandlePointerEventL() .

    Parameters

    const TPointerEvent &aPointerEvent


    OfferKeyEventL()

    virtual IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);

    Description

    Handles key events offered to the control by the control environment.

    This function provides an appropriate implementation of CCoeControl::OfferKeyEventL() .

    Parameters

    const TKeyEvent &aKeyEvent

    TEventCode aType

    Return value

    TKeyResponse

    " TKeyResponse " Whether or not the key event was consumed.


    InputCapabilities()

    virtual IMPORT_C TCoeInputCapabilities InputCapabilities() const;

    Description

    Returns the controls input capabilities.

    Return value

    TCoeInputCapabilities

    " TCoeInputCapabilities " The controls input capabilities.


    MopSupplyObject()

    virtual IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);

    Description

    Retrieves an object of the same type as that encapsulated in aId. From CCoeControl .

    Parameters

    TTypeUid aId

    An encapsulated object type ID.

    Return value

    TTypeUid::Ptr

    Encapsulates the pointer to the object provided. Note that the encapsulated pointer may be NULL.

    See also:


    HasBorder()

    virtual IMPORT_C TBool HasBorder() const;

    Description

    Tests if the control has a border. From CCoeControl .

    Return value

    TBool

    ETrue if the control has a border, EFalse if the control does not have a border. The default implementation of this function returns EFalse.

    See also:


    SetAdjacent()

    virtual IMPORT_C void SetAdjacent(TInt aAdjacent);

    Description

    Sets the control's appearance when it is next to other controls. From CCoeControl .

    Parameters

    TInt aAdjacent

    Typically a value defined in TGulAdjacent.

    See also:


    MakeVisible()

    virtual IMPORT_C void MakeVisible(TBool aVisible);

    Description

    Sets this control as visible or invisible. From CCoeControl .

    Parameters

    TBool aVisible

    ETrue to make the control visible, EFalse to make it invisible.

    See also:


    SetDimmed()

    virtual IMPORT_C void SetDimmed(TBool aDimmed);

    Description

    Sets the control to be dimmed. From CCoeControl .

    Parameters

    TBool aDimmed

    ETrue to dim the control, EFalse to set the control as not dimmed.

    See also:


    SetContainerWindowL()

    virtual IMPORT_C void SetContainerWindowL(const CCoeControl &aContainer);

    Description

    Sets the control's containing window by copying it from aContainer. From CCoeControl .

    Parameters

    const CCoeControl &aContainer

    The compound control that is the container for this control

    See also:


    ConstructFromResourceL()

    virtual IMPORT_C void ConstructFromResourceL(TResourceReader &aReader);

    Description

    Constructs the control from a resource file. From CCoeControl .

    Parameters

    TResourceReader &aReader

    The resource reader to use.

    See also:


    ActivateL()

    virtual IMPORT_C void ActivateL();

    Description

    Sets the control as ready to be drawn. From CCoeControl .

    See also:


    SetNeighbor()

    virtual IMPORT_C void SetNeighbor(CCoeControl *aNeighbor);

    Description

    Sets an associated control. From CCoeControl .

    Parameters

    CCoeControl *aNeighbor

    A control to be used by this function.

    See also:


    MinimumSize()

    virtual IMPORT_C TSize MinimumSize();

    Description

    Gets the control's minimum required size. From CCoeControl .

    Return value

    TSize

    The minimum size required by the control.

    See also:


    GetHelpContext()

    virtual IMPORT_C void GetHelpContext(TCoeHelpContext &aContext) const;

    Description

    Gets the control's help context. From CCoeControl .

    Parameters

    TCoeHelpContext &aContext

    The control's help context

    See also:


    SetParent()

    virtual IMPORT_C TInt SetParent(CCoeControl *aParent);

    Description

    Sets aParent as the parent of this control. From CCoeControl .

    Parameters

    CCoeControl *aParent

    The control to set as this control's parent.

    Return value

    TInt

    KErrNone if successful, otherwise another of the system error codes.

    See also:


    SetLayoutManagerL()

    virtual IMPORT_C void SetLayoutManagerL(MCoeLayoutManager *aLayout);

    Description

    Sets the layout manager From CCoeControl .

    Parameters

    MCoeLayoutManager *aLayout

    The new layout manager, NULL if you just want to remove the current layout manager.

    See also:


    RequestRelayout()

    virtual IMPORT_C TBool RequestRelayout(const CCoeControl *aChildControl);

    Description

    Requests a relayout. From CCoeControl .

    Parameters

    const CCoeControl *aChildControl

    The child control that requests the relayout, might be NULL.

    Return value

    TBool

    ETrue if the request is addressed, otherwise EFalse

    See also:


    TextBaselineOffset()

    virtual IMPORT_C TInt TextBaselineOffset(const TSize &aSize) const;

    Description

    Gets the offset to the first text baseline relative to the top of the control. From CCoeControl .

    Parameters

    const TSize &aSize

    The offset of the baseline may depend on the size of the control. This argument specifies the size to use when computing the baseline offset.

    Return value

    TInt

    The offset of the baseline from the top of the control.

    See also:


    SetTextBaselineSpacing()

    virtual IMPORT_C void SetTextBaselineSpacing(TInt aSpacing);

    Description

    Sets the spacing between text baselines. From CCoeControl .

    Parameters

    TInt aSpacing

    The baseline spacing i.e. the space in pixels between the text baselines.

    See also:


    CountComponentControls()

    virtual IMPORT_C TInt CountComponentControls() const;

    Description

    Gets the number of controls contained in a compound control. From CCoeControl .

    Return value

    TInt

    The number of component controls contained by this control.

    See also:


    ComponentControl()

    virtual IMPORT_C CCoeControl *ComponentControl(TInt aIndex) const;

    Description

    Gets an indexed component of a compound control. From CCoeControl .

    Parameters

    TInt aIndex

    The index of the control.

    Return value

    CCoeControl *

    The component control with an index of aIndex.

    See also:


    SetBorder()

    virtual IMPORT_C void SetBorder(TGulBorder::TBorderType aBorderType);

    Description

    Sets the border type from enum. From MEikBorderedControl .

    Parameters

    TGulBorder::TBorderType aBorderType

    New value for the border type.

    See also:


    SetBorder()

    virtual IMPORT_C void SetBorder(TInt aBorderType);

    Description

    Sets the border type from value. From MEikBorderedControl .

    Parameters

    TInt aBorderType

    New value for the border type.

    See also:


    Border()

    virtual IMPORT_C TGulBorder Border() const;

    Description

    Gets the border type. From MEikBorderedControl .

    Return value

    TGulBorder

    The border type.

    See also:


    Draw()

    protected: virtual IMPORT_C void Draw(const TRect &aRect) const;

    Description

    Draws the border around the control. From CCoeControl .

    Parameters

    const TRect &aRect

    Optional. If supplied, the screen rectangle to be updated.

    See also:


    HandlePointerBufferReadyL()

    protected: virtual IMPORT_C void HandlePointerBufferReadyL();

    Description

    Handles pointer buffer ready events. From CCoeControl .

    See also:


    FocusChanged()

    protected: virtual IMPORT_C void FocusChanged(TDrawNow aDrawNow);

    Description

    Responds to a change in focus. From CCoeControl .

    Parameters

    TDrawNow aDrawNow

    Contains the value that was passed to it by SetFocus().

    See also:


    SizeChanged()

    protected: virtual IMPORT_C void SizeChanged();

    Description

    Responds to changes to the size and position of the contents of this control. From CCoeControl .

    See also:


    PositionChanged()

    protected: virtual IMPORT_C void PositionChanged();

    Description

    Responds to changes in the position of a control. From CCoeControl .

    See also:


    HandleControlArrayEventL()

    protected: virtual IMPORT_C void HandleControlArrayEventL(CCoeControlArray::TEvent aEvent, const CCoeControlArray *aArray, CCoeControl *aControl, TInt aControlId);

    Description

    Handles events generated by the CCoeControlArray. From CCoeControl .

    Parameters

    CCoeControlArray::TEvent aEvent

    The type of the event

    const CCoeControlArray *aArray

    The array that generated the event

    CCoeControl *aControl

    The control affected by the event

    TInt aControlId

    The id of the control affected by the event

    See also:

    [Top]


    Member enumerations


    Enum TState

    TState

    Description

    Possible logical states for a button.

    TState values represent the logical state of a button. Derived button classes may draw themselves differently to indicate different states. See also State() and SetState() .The state of a non-latching button is, in general, of no interest to applications. What is of interest is the fact that it has been pressed.

    EClear

    The clear state; often drawn as button-up.

    ESet

    The set state; often drawn as button-down.

    EIndeterminate

    An indeterminate state; often used for an animation stage between the two other buttons, and may be used for derived tri-state buttons.


    Enum TDrawState

    protected: TDrawState

    Description

    Possible states for the draw stateThe TDrawState values affecting a button are stored in iButFlags .

    All draw state flag bits must be maskable by 0x001f ; the ones which describe a pressed button must be maskable by 0x0010 .

    EDrawClear

    EDrawSet

    Button is clear.

    EDrawIndeterminate

    Button is set.

    EDrawClearPressed

    Button is between set and clear.

    EDrawSetPressed

    Button is clear, and the user is pressing it.

    EDrawIndeterminatePressed

    Button is set, and the user is pressing it.

    [Top]


    Member data


    iButFlags

    protected: TInt iButFlags;

    Description