epoc32/include/mw/eikbutb.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Base class for legacy Uikon buttons
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined(__EIKBUTB_H__)
williamr@2
    20
#define __EIKBUTB_H__
williamr@2
    21
williamr@2
    22
#if !defined(__EIKBCTRL_H__)
williamr@2
    23
#include <eikbctrl.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
#if !defined(__UIKON_HRH__)
williamr@2
    27
#include <uikon.hrh>
williamr@2
    28
#endif
williamr@2
    29
williamr@2
    30
#include <eikon.hrh>
williamr@2
    31
williamr@2
    32
#include <lafpublc.h>
williamr@2
    33
williamr@2
    34
class TEikButtonCoordinator;
williamr@2
    35
williamr@2
    36
/**
williamr@2
    37
* Possible button behaviours 
williamr@2
    38
*/
williamr@2
    39
enum TButtonBehavior
williamr@2
    40
	{
williamr@2
    41
	EEikButtonStaysClear=EEikButStaysClear,
williamr@2
    42
	EEikButtonStaysSet=EEikButStaysSet,
williamr@2
    43
	EEikButtonLatches=EEikButLatches,
williamr@2
    44
	EEikButtonReportsOnPointerDown=EEikButReportOnPointerDown
williamr@2
    45
	};
williamr@2
    46
	
williamr@2
    47
/**
williamr@2
    48
 *  Base class for button controls
williamr@2
    49
 *
williamr@2
    50
 *  This class defines behavior available to all button classes.
williamr@2
    51
 *
williamr@2
    52
 *  @lib eikcoctl
williamr@2
    53
 *  @since S60 1.0
williamr@2
    54
 */
williamr@2
    55
class CEikButtonBase : public CEikBorderedControl
williamr@2
    56
	{
williamr@2
    57
public:
williamr@2
    58
    /**
williamr@2
    59
     * C++ constructor
williamr@2
    60
     */
williamr@2
    61
    IMPORT_C CEikButtonBase();
williamr@2
    62
    
williamr@2
    63
    /**
williamr@2
    64
     * C++ destructor
williamr@2
    65
     */     
williamr@2
    66
    IMPORT_C ~CEikButtonBase();
williamr@2
    67
    
williamr@2
    68
public:
williamr@2
    69
williamr@2
    70
    /**
williamr@2
    71
     * States that the button can be in.
williamr@2
    72
     */     
williamr@2
    73
    enum TState
williamr@2
    74
        {
williamr@2
    75
        EClear		  	=0,
williamr@2
    76
        ESet			=1,
williamr@2
    77
        EIndeterminate  =2
williamr@2
    78
        };
williamr@2
    79
		
williamr@2
    80
public: // new functions
williamr@2
    81
    /**
williamr@2
    82
     * Access the state
williamr@2
    83
     *
williamr@2
    84
     * @return The state of the button
williamr@2
    85
     */     
williamr@2
    86
    IMPORT_C TState State() const;
williamr@2
    87
    
williamr@2
    88
    /**
williamr@2
    89
     * Set the state of the button.
williamr@2
    90
     *
williamr@2
    91
     * @param aState The state the button is to be set to.
williamr@2
    92
     */     
williamr@2
    93
    IMPORT_C void SetState(TState aState);
williamr@2
    94
    
williamr@2
    95
    /**
williamr@2
    96
     * Cause the button to animate. The appearance changes to the "pressed in" state. Subsequent 
williamr@2
    97
     *  behaviour depends upon the SetBehavior setting
williamr@2
    98
     */     
williamr@2
    99
    IMPORT_C virtual void Animate();
williamr@2
   100
    
williamr@2
   101
    /**
williamr@2
   102
     * Sets the coordinator for the button.
williamr@2
   103
     *
williamr@2
   104
     * @param aButCoord The coordinator to set for these button
williamr@2
   105
     */     
williamr@2
   106
    IMPORT_C void SetCoordinator(TEikButtonCoordinator* aButCoord);
williamr@2
   107
    
williamr@2
   108
    /**
williamr@2
   109
     * Sets the button’s behaviour. A button can be made to stay set or stay clear. It can also be made a latching button.
williamr@2
   110
     *
williamr@2
   111
     * @param aBehavior Behaviour to use
williamr@2
   112
     */     
williamr@2
   113
    IMPORT_C void SetBehavior(TButtonBehavior aBehavior);
williamr@2
   114
    
williamr@2
   115
    /**
williamr@2
   116
     * Sets the control to ignore the next pointer up event
williamr@2
   117
     */     
williamr@2
   118
    IMPORT_C void SetIgnoreNextPointerUp();
williamr@2
   119
    
williamr@2
   120
protected:
williamr@2
   121
    /**
williamr@2
   122
    * The draw state of the button.
williamr@2
   123
    */
williamr@2
   124
    enum TDrawState
williamr@2
   125
        {
williamr@2
   126
        EDrawClear					=SLafButtonBase::EDrawClear,
williamr@2
   127
        EDrawSet					=SLafButtonBase::EDrawSet,
williamr@2
   128
        EDrawIndeterminate			=SLafButtonBase::EDrawIndeterminate,
williamr@2
   129
        EDrawClearPressed			=SLafButtonBase::EDrawClearPressed,
williamr@2
   130
        EDrawSetPressed				=SLafButtonBase::EDrawSetPressed,
williamr@2
   131
        EDrawIndeterminatePressed	=SLafButtonBase::EDrawIndeterminatePressed
williamr@2
   132
        };
williamr@2
   133
williamr@2
   134
protected: // new functions
williamr@2
   135
    /**
williamr@2
   136
     * Set whether the control should report on pointer down
williamr@2
   137
     */     
williamr@2
   138
    IMPORT_C void SetReportOnPointerDown();
williamr@2
   139
    
williamr@2
   140
    /**
williamr@2
   141
     *  Access the draw state defined in SLafButtonBase
williamr@2
   142
     *
williamr@2
   143
     * @return The draw state of the control
williamr@2
   144
     */     
williamr@2
   145
    IMPORT_C TDrawState DrawState() const;
williamr@2
   146
    
williamr@2
   147
    /**
williamr@2
   148
     * Returns whether the button is currently pressed.
williamr@2
   149
     *
williamr@2
   150
     * @return EFalse if the button is not pressed
williamr@2
   151
     */     
williamr@2
   152
    IMPORT_C TBool IsPressed() const;
williamr@2
   153
    
williamr@2
   154
    /**
williamr@2
   155
     * Sets the button to be tri-state
williamr@2
   156
     */     
williamr@2
   157
    IMPORT_C void SetAllowTristate();
williamr@2
   158
    
williamr@2
   159
    /**
williamr@2
   160
     * Transfers the draw state to the referenced button
williamr@2
   161
     *
williamr@2
   162
     * @param aTargetButton button to transfer the 
williamr@2
   163
     */     
williamr@2
   164
    IMPORT_C void CopyDrawStateTo(CEikButtonBase* aTargetButton) const;
williamr@2
   165
    
williamr@2
   166
public:	// from CCoeControl
williamr@2
   167
    /**
williamr@2
   168
     *  From CCoeControl
williamr@2
   169
     * 
williamr@2
   170
     * Obtain the color use list for this control
williamr@2
   171
     *
williamr@2
   172
     * @param aColorUseList Output; upon non-leaving return, constains the color use list
williamr@2
   173
     */     
williamr@2
   174
    IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
williamr@2
   175
    
williamr@2
   176
    /**
williamr@2
   177
     *  From CCoeControl
williamr@2
   178
     * 
williamr@2
   179
     *  Perform necessary operations when resource changes.  This includes layout switches, or other events
williamr@2
   180
     *  that affect appearance.
williamr@2
   181
     *
williamr@2
   182
     * @param aType Type of resouce changed
williamr@2
   183
     */     
williamr@2
   184
    IMPORT_C virtual void HandleResourceChange(TInt aType);			// not available before Release 005u
williamr@2
   185
    
williamr@2
   186
    /**
williamr@2
   187
     *  From CCoeControl
williamr@2
   188
     * 
williamr@2
   189
     *  Serialize the control's state. For testing
williamr@2
   190
     *
williamr@2
   191
     * @param aWriteStream  Stream to write to.
williamr@2
   192
     */     
williamr@2
   193
    IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   194
    
williamr@2
   195
private: // from CCoeControl
williamr@2
   196
    IMPORT_C void Reserved_2();
williamr@2
   197
williamr@2
   198
private: // new functions
williamr@2
   199
    /**
williamr@2
   200
    * Called but button framework when the state of the control has changed
williamr@2
   201
    */
williamr@2
   202
    IMPORT_C virtual void StateChanged();
williamr@2
   203
    IMPORT_C virtual void Reserved_3();
williamr@2
   204
williamr@2
   205
public:
williamr@2
   206
    /**
williamr@2
   207
     *  From CCoeControl
williamr@2
   208
     * 
williamr@2
   209
     * A pointer event is being routed to this control for handling
williamr@2
   210
     *
williamr@2
   211
     * @param aPointerEvent Wserv pointer event
williamr@2
   212
     */     
williamr@2
   213
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   214
    
williamr@2
   215
    /**
williamr@2
   216
     *  From CCoeControl
williamr@2
   217
     * 
williamr@2
   218
     * A key event is being being given to the control for handling
williamr@2
   219
     *
williamr@2
   220
     * @param aKeyEvent     Key event code
williamr@2
   221
     * @param aType            Type of event (i.e.. EEventKey, EEventKeyUp, EEventKeyDown)
williamr@2
   222
     * @return EKeyWasConsumed or EKeyWasNotConsumed
williamr@2
   223
     */     
williamr@2
   224
    IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
williamr@2
   225
williamr@2
   226
    /**
williamr@2
   227
     *  From CCoeControl
williamr@2
   228
     * 
williamr@2
   229
     * Interface used by the FEP or others to determine what type of input the control requires.
williamr@2
   230
     *
williamr@2
   231
     * @return A value indicating what input is required.
williamr@2
   232
     */     
williamr@2
   233
    IMPORT_C TCoeInputCapabilities InputCapabilities() const; 
williamr@2
   234
    
williamr@2
   235
private:
williamr@2
   236
    /**
williamr@2
   237
    * From CAknControl
williamr@2
   238
    * 
williamr@2
   239
    * Interface for extending virtual functionality of CAknControl
williamr@2
   240
    */
williamr@2
   241
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   242
    
williamr@2
   243
private: // internal use only
williamr@2
   244
    TBool ClickCompleted();
williamr@2
   245
williamr@2
   246
private:
williamr@2
   247
    enum { EIgnoreNextPointerUp=0x1000 };
williamr@2
   248
williamr@2
   249
protected:
williamr@2
   250
    /**
williamr@2
   251
    * Flags for the button class hierarchy
williamr@2
   252
    */ 
williamr@2
   253
    TInt iButFlags;
williamr@2
   254
    
williamr@2
   255
private:
williamr@2
   256
    /**
williamr@2
   257
    * Button co-ordinator associated with this button
williamr@2
   258
    */ 
williamr@2
   259
    TEikButtonCoordinator* iButCoord;
williamr@2
   260
    
williamr@2
   261
    TInt iSpare[2];
williamr@2
   262
    };
williamr@2
   263
williamr@2
   264
/**
williamr@2
   265
 *  Button coordinator class
williamr@2
   266
 * 
williamr@2
   267
 * This class performs simple coordination functions on a set of buttons. It ensures that only
williamr@2
   268
 * one button of those sharing a coordinator is set at once.
williamr@2
   269
 *
williamr@2
   270
 *  @lib eikcoctl
williamr@2
   271
 *  @since S60 1.0
williamr@2
   272
 */
williamr@2
   273
class TEikButtonCoordinator
williamr@2
   274
	{
williamr@2
   275
public:
williamr@2
   276
    /**
williamr@2
   277
    * Constructor
williamr@2
   278
    */
williamr@2
   279
    IMPORT_C TEikButtonCoordinator();
williamr@2
   280
    
williamr@2
   281
    /**
williamr@2
   282
    * Set the current chosen button to the passed-in object. 
williamr@2
   283
    * Any previously selected button is set to the Clear state and re-drawn.
williamr@2
   284
    *
williamr@2
   285
    * @param aChosenButton Button to set as the new chosen button.
williamr@2
   286
    */
williamr@2
   287
    IMPORT_C void SetChosenButton(CEikButtonBase* aChosenButton);		
williamr@2
   288
williamr@2
   289
private:
williamr@2
   290
    /**
williamr@2
   291
    * Records the currently chosen button associated with this co-ordinator object.
williamr@2
   292
    */
williamr@2
   293
    CEikButtonBase* iChosenButton;
williamr@2
   294
    };		 
williamr@2
   295
williamr@2
   296
#endif // __EIKBUTB_H__