1.1 --- a/epoc32/include/mw/eikbutb.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eikbutb.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,296 @@
1.4 -eikbutb.h
1.5 +/*
1.6 +* Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Base class for legacy Uikon buttons
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#if !defined(__EIKBUTB_H__)
1.24 +#define __EIKBUTB_H__
1.25 +
1.26 +#if !defined(__EIKBCTRL_H__)
1.27 +#include <eikbctrl.h>
1.28 +#endif
1.29 +
1.30 +#if !defined(__UIKON_HRH__)
1.31 +#include <uikon.hrh>
1.32 +#endif
1.33 +
1.34 +#include <eikon.hrh>
1.35 +
1.36 +#include <lafpublc.h>
1.37 +
1.38 +class TEikButtonCoordinator;
1.39 +
1.40 +/**
1.41 +* Possible button behaviours
1.42 +*/
1.43 +enum TButtonBehavior
1.44 + {
1.45 + EEikButtonStaysClear=EEikButStaysClear,
1.46 + EEikButtonStaysSet=EEikButStaysSet,
1.47 + EEikButtonLatches=EEikButLatches,
1.48 + EEikButtonReportsOnPointerDown=EEikButReportOnPointerDown
1.49 + };
1.50 +
1.51 +/**
1.52 + * Base class for button controls
1.53 + *
1.54 + * This class defines behavior available to all button classes.
1.55 + *
1.56 + * @lib eikcoctl
1.57 + * @since S60 1.0
1.58 + */
1.59 +class CEikButtonBase : public CEikBorderedControl
1.60 + {
1.61 +public:
1.62 + /**
1.63 + * C++ constructor
1.64 + */
1.65 + IMPORT_C CEikButtonBase();
1.66 +
1.67 + /**
1.68 + * C++ destructor
1.69 + */
1.70 + IMPORT_C ~CEikButtonBase();
1.71 +
1.72 +public:
1.73 +
1.74 + /**
1.75 + * States that the button can be in.
1.76 + */
1.77 + enum TState
1.78 + {
1.79 + EClear =0,
1.80 + ESet =1,
1.81 + EIndeterminate =2
1.82 + };
1.83 +
1.84 +public: // new functions
1.85 + /**
1.86 + * Access the state
1.87 + *
1.88 + * @return The state of the button
1.89 + */
1.90 + IMPORT_C TState State() const;
1.91 +
1.92 + /**
1.93 + * Set the state of the button.
1.94 + *
1.95 + * @param aState The state the button is to be set to.
1.96 + */
1.97 + IMPORT_C void SetState(TState aState);
1.98 +
1.99 + /**
1.100 + * Cause the button to animate. The appearance changes to the "pressed in" state. Subsequent
1.101 + * behaviour depends upon the SetBehavior setting
1.102 + */
1.103 + IMPORT_C virtual void Animate();
1.104 +
1.105 + /**
1.106 + * Sets the coordinator for the button.
1.107 + *
1.108 + * @param aButCoord The coordinator to set for these button
1.109 + */
1.110 + IMPORT_C void SetCoordinator(TEikButtonCoordinator* aButCoord);
1.111 +
1.112 + /**
1.113 + * Sets the button’s behaviour. A button can be made to stay set or stay clear. It can also be made a latching button.
1.114 + *
1.115 + * @param aBehavior Behaviour to use
1.116 + */
1.117 + IMPORT_C void SetBehavior(TButtonBehavior aBehavior);
1.118 +
1.119 + /**
1.120 + * Sets the control to ignore the next pointer up event
1.121 + */
1.122 + IMPORT_C void SetIgnoreNextPointerUp();
1.123 +
1.124 +protected:
1.125 + /**
1.126 + * The draw state of the button.
1.127 + */
1.128 + enum TDrawState
1.129 + {
1.130 + EDrawClear =SLafButtonBase::EDrawClear,
1.131 + EDrawSet =SLafButtonBase::EDrawSet,
1.132 + EDrawIndeterminate =SLafButtonBase::EDrawIndeterminate,
1.133 + EDrawClearPressed =SLafButtonBase::EDrawClearPressed,
1.134 + EDrawSetPressed =SLafButtonBase::EDrawSetPressed,
1.135 + EDrawIndeterminatePressed =SLafButtonBase::EDrawIndeterminatePressed
1.136 + };
1.137 +
1.138 +protected: // new functions
1.139 + /**
1.140 + * Set whether the control should report on pointer down
1.141 + */
1.142 + IMPORT_C void SetReportOnPointerDown();
1.143 +
1.144 + /**
1.145 + * Access the draw state defined in SLafButtonBase
1.146 + *
1.147 + * @return The draw state of the control
1.148 + */
1.149 + IMPORT_C TDrawState DrawState() const;
1.150 +
1.151 + /**
1.152 + * Returns whether the button is currently pressed.
1.153 + *
1.154 + * @return EFalse if the button is not pressed
1.155 + */
1.156 + IMPORT_C TBool IsPressed() const;
1.157 +
1.158 + /**
1.159 + * Sets the button to be tri-state
1.160 + */
1.161 + IMPORT_C void SetAllowTristate();
1.162 +
1.163 + /**
1.164 + * Transfers the draw state to the referenced button
1.165 + *
1.166 + * @param aTargetButton button to transfer the
1.167 + */
1.168 + IMPORT_C void CopyDrawStateTo(CEikButtonBase* aTargetButton) const;
1.169 +
1.170 +public: // from CCoeControl
1.171 + /**
1.172 + * From CCoeControl
1.173 + *
1.174 + * Obtain the color use list for this control
1.175 + *
1.176 + * @param aColorUseList Output; upon non-leaving return, constains the color use list
1.177 + */
1.178 + IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
1.179 +
1.180 + /**
1.181 + * From CCoeControl
1.182 + *
1.183 + * Perform necessary operations when resource changes. This includes layout switches, or other events
1.184 + * that affect appearance.
1.185 + *
1.186 + * @param aType Type of resouce changed
1.187 + */
1.188 + IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u
1.189 +
1.190 + /**
1.191 + * From CCoeControl
1.192 + *
1.193 + * Serialize the control's state. For testing
1.194 + *
1.195 + * @param aWriteStream Stream to write to.
1.196 + */
1.197 + IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
1.198 +
1.199 +private: // from CCoeControl
1.200 + IMPORT_C void Reserved_2();
1.201 +
1.202 +private: // new functions
1.203 + /**
1.204 + * Called but button framework when the state of the control has changed
1.205 + */
1.206 + IMPORT_C virtual void StateChanged();
1.207 + IMPORT_C virtual void Reserved_3();
1.208 +
1.209 +public:
1.210 + /**
1.211 + * From CCoeControl
1.212 + *
1.213 + * A pointer event is being routed to this control for handling
1.214 + *
1.215 + * @param aPointerEvent Wserv pointer event
1.216 + */
1.217 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.218 +
1.219 + /**
1.220 + * From CCoeControl
1.221 + *
1.222 + * A key event is being being given to the control for handling
1.223 + *
1.224 + * @param aKeyEvent Key event code
1.225 + * @param aType Type of event (i.e.. EEventKey, EEventKeyUp, EEventKeyDown)
1.226 + * @return EKeyWasConsumed or EKeyWasNotConsumed
1.227 + */
1.228 + IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
1.229 +
1.230 + /**
1.231 + * From CCoeControl
1.232 + *
1.233 + * Interface used by the FEP or others to determine what type of input the control requires.
1.234 + *
1.235 + * @return A value indicating what input is required.
1.236 + */
1.237 + IMPORT_C TCoeInputCapabilities InputCapabilities() const;
1.238 +
1.239 +private:
1.240 + /**
1.241 + * From CAknControl
1.242 + *
1.243 + * Interface for extending virtual functionality of CAknControl
1.244 + */
1.245 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.246 +
1.247 +private: // internal use only
1.248 + TBool ClickCompleted();
1.249 +
1.250 +private:
1.251 + enum { EIgnoreNextPointerUp=0x1000 };
1.252 +
1.253 +protected:
1.254 + /**
1.255 + * Flags for the button class hierarchy
1.256 + */
1.257 + TInt iButFlags;
1.258 +
1.259 +private:
1.260 + /**
1.261 + * Button co-ordinator associated with this button
1.262 + */
1.263 + TEikButtonCoordinator* iButCoord;
1.264 +
1.265 + TInt iSpare[2];
1.266 + };
1.267 +
1.268 +/**
1.269 + * Button coordinator class
1.270 + *
1.271 + * This class performs simple coordination functions on a set of buttons. It ensures that only
1.272 + * one button of those sharing a coordinator is set at once.
1.273 + *
1.274 + * @lib eikcoctl
1.275 + * @since S60 1.0
1.276 + */
1.277 +class TEikButtonCoordinator
1.278 + {
1.279 +public:
1.280 + /**
1.281 + * Constructor
1.282 + */
1.283 + IMPORT_C TEikButtonCoordinator();
1.284 +
1.285 + /**
1.286 + * Set the current chosen button to the passed-in object.
1.287 + * Any previously selected button is set to the Clear state and re-drawn.
1.288 + *
1.289 + * @param aChosenButton Button to set as the new chosen button.
1.290 + */
1.291 + IMPORT_C void SetChosenButton(CEikButtonBase* aChosenButton);
1.292 +
1.293 +private:
1.294 + /**
1.295 + * Records the currently chosen button associated with this co-ordinator object.
1.296 + */
1.297 + CEikButtonBase* iChosenButton;
1.298 + };
1.299 +
1.300 +#endif // __EIKBUTB_H__