00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __EIKBTGPC_H__
00021 #define __EIKBTGPC_H__
00022
00023 #include <coecntrl.h>
00024 #include <eikbtgrp.h>
00025 #include <eikcmobs.h>
00026 #include <lafpublc.h>
00027 #include <uikon.hrh>
00028
00029 #include <akncontrol.h>
00030
00031 class MEikCommandObserver;
00032 class CEikButtonGroupStack;
00033 class CEikCommandButton;
00034 class CEikListBox;
00035
00043 NONSHARABLE_CLASS(CEikButtonGroupContainer) : public CAknControl, public MEikCommandObserver
00044 {
00045 public:
00050 DECLARE_TYPE_ID(0x101F4107)
00051
00052
00058 enum TUse
00059 {
00060 EView = SLafButtonGroupContainer::EView,
00061 EDialog = SLafButtonGroupContainer::EDialog,
00062 EToolbar = SLafButtonGroupContainer::EToolbar,
00063 ECba = SLafButtonGroupContainer::ECba,
00064 EDialogButtons = SLafButtonGroupContainer::EDialogButtons
00065 };
00066
00070 enum TOrientation
00071 {
00072 EVertical = SLafButtonGroupContainer::EVertical,
00073 EHorizontal = SLafButtonGroupContainer::EHorizontal
00074 };
00075
00079 enum TLocation
00080 {
00082 EInternal = SLafButtonGroupContainer::EInternal,
00083
00085 EExternal = SLafButtonGroupContainer::EExternal
00086 };
00087
00091 enum THotKeyFlags
00092 {
00093 EShowHotKey = 0x01,
00094 EPlainHotKey = 0x02
00095 };
00096
00100 enum TFlags
00101 {
00102 EAddToStack = 0x01,
00103 EDelayActivation = 0x02,
00104 EUseMaxSize = 0x04
00105 };
00106
00110 enum TCommandPosition
00111 {
00112 ELeftSoftkeyPosition = 0,
00113 ERightSoftkeyPosition = 2,
00114 EMiddleSoftkeyPosition = 3
00115 };
00116
00117 public:
00132 IMPORT_C static CEikButtonGroupContainer* NewL(
00133 TUse aUse,
00134 TOrientation aOrientation,
00135 MEikCommandObserver* aCommandObserver,
00136 TInt aResourceId,
00137 TUint aFlags = EAddToStack);
00138
00154 IMPORT_C static CEikButtonGroupContainer* NewL(
00155 TUse aUse,
00156 TOrientation aOrientation,
00157 MEikCommandObserver* aCommandObserver,
00158 TInt aResourceId,
00159 const CCoeControl& aParent,
00160 TUint aFlags = EAddToStack);
00161
00177 IMPORT_C static CEikButtonGroupContainer* NewL(
00178 TUse aUse,
00179 TOrientation aOrientation,
00180 MEikCommandObserver* aCommandObserver,
00181 TInt aResourceId,
00182 RWindowGroup& aParentWg,
00183 TUint aFlags = EAddToStack);
00184
00188 IMPORT_C ~CEikButtonGroupContainer();
00189
00198 IMPORT_C static CEikButtonGroupContainer* Current();
00199
00200 public:
00209 inline void SetCommandL(
00210 TInt aPosition,
00211 TInt aCommandId,
00212 const TDesC& aText);
00213
00223 inline void SetCommandL(
00224 TInt aPosition,
00225 TInt aCommandId,
00226 const CFbsBitmap& aBitmap,
00227 const CFbsBitmap& aMask);
00228
00239 inline void SetCommandL(
00240 TInt aPosition,
00241 TInt aCommandId,
00242 const TDesC& aText,
00243 const CFbsBitmap& aBitmap,
00244 const CFbsBitmap& aMask);
00245
00257 inline void SetCommandL(
00258 TInt aPosition,
00259 TInt aCommandId,
00260 const TDesC& aFile,
00261 TInt aBitmapId,
00262 TInt aMaskId);
00263
00276 inline void SetCommandL(
00277 TInt aPosition,
00278 TInt aCommandId,
00279 const TDesC& aText,
00280 const TDesC& aFile,
00281 TInt aBitmapId,
00282 TInt aMaskId);
00283
00292 inline void SetCommandL(
00293 TInt aPosition,
00294 TInt aResourceId);
00295
00303 inline void SetCommandL(
00304 TInt aCommandId,
00305 const TDesC& aText);
00306
00316 inline void SetCommandL(
00317 TInt aCommandId,
00318 const CFbsBitmap& aBitmap,
00319 const CFbsBitmap& aMask);
00320
00330 inline void SetCommandL(
00331 TInt aCommandId,
00332 const TDesC& aText,
00333 const CFbsBitmap& aBitmap,
00334 const CFbsBitmap& aMask);
00335
00345 inline void SetCommandL(
00346 TInt aCommandId,
00347 const TDesC& aFile,
00348 TInt aBitmapId,
00349 TInt aMaskId);
00350
00361 inline void SetCommandL(
00362 TInt aCommandId,
00363 const TDesC& aText,
00364 const TDesC& aFile,
00365 TInt aBitmapId,
00366 TInt aMaskId);
00367
00373 IMPORT_C void SetCommandSetL(
00374 TInt aResourceId);
00375
00383 inline void AddCommandL(
00384 TInt aPosition,
00385 TInt aCommandId,
00386 const TDesC& aText);
00387
00396 inline void AddCommandL(
00397 TInt aPosition,
00398 TInt aCommandId,
00399 const CFbsBitmap& aBitmap,
00400 const CFbsBitmap& aMask);
00401
00412 inline void AddCommandL(
00413 TInt aPosition,
00414 TInt aCommandId,
00415 const TDesC& aText,
00416 const CFbsBitmap& aBitmap,
00417 const CFbsBitmap& aMask);
00418
00428 inline void AddCommandL(
00429 TInt aPosition,
00430 TInt aCommandId,
00431 const TDesC& aFile,
00432 TInt aBitmapId,
00433 TInt aMaskId);
00434
00446 inline void AddCommandL(
00447 TInt aPosition,
00448 TInt aCommandId,
00449 const TDesC& aText,
00450 const TDesC& aFile,
00451 TInt aBitmapId,
00452 TInt aMaskId);
00453
00463 inline void AddCommandToStackL(
00464 TInt aPosition,
00465 TInt aCommandId,
00466 const TDesC& aText);
00467
00478 inline void AddCommandToStackL(
00479 TInt aPosition,
00480 TInt aCommandId,
00481 const CFbsBitmap& aBitmap,
00482 const CFbsBitmap& aMask);
00483
00495 inline void AddCommandToStackL(
00496 TInt aPosition,
00497 TInt aCommandId,
00498 const TDesC& aText,
00499 const CFbsBitmap& aBitmap,
00500 const CFbsBitmap& aMask);
00501
00514 inline void AddCommandToStackL(
00515 TInt aPosition,
00516 TInt aCommandId,
00517 const TDesC& aFile,
00518 TInt aBitmapId,
00519 TInt aMaskId);
00520
00534 inline void AddCommandToStackL(
00535 TInt aPosition,
00536 TInt aCommandId,
00537 const TDesC& aText,
00538 const TDesC& aFile,
00539 TInt aBitmapId,
00540 TInt aMaskId);
00541
00551 inline void AddCommandToStackL(
00552 TInt aPosition,
00553 TInt aResourceId);
00554
00561 IMPORT_C void AddCommandSetToStackL(
00562 TInt aResourceId);
00563
00573 IMPORT_C void RemoveCommandFromStack(TInt aPosition, TInt aCommandId);
00574
00580 IMPORT_C void SetDefaultCommand(TInt aCommandId);
00581
00589 IMPORT_C TSize CalcMinimumSizeL(TInt aResourceId) const;
00590
00601 IMPORT_C void CleanupCommandPushL(TInt aPosition);
00602
00606 inline void CleanupCommandPop();
00607
00613 IMPORT_C void CleanupCommandPop(TInt aCount);
00614
00620 inline void CleanupCommandPopAndDestroy();
00621
00629 inline void CleanupCommandPopAndDestroy(TInt aCount);
00630
00636 IMPORT_C TInt MaxCommands() const;
00637
00643 IMPORT_C TInt ButtonCount() const;
00644
00652 IMPORT_C void DimCommand(TInt aCommandId, TBool aDimmed);
00653
00661 IMPORT_C TBool IsCommandDimmed(TInt aCommandId) const;
00662
00670 IMPORT_C void MakeCommandVisible(TInt aCommandId, TBool aVisible);
00671
00679 IMPORT_C TBool IsCommandVisible(TInt aCommandId) const;
00680
00688 IMPORT_C void AnimateCommand(TInt aCommandId);
00689
00697 IMPORT_C void DimCommandByPosition(TCommandPosition aPosition, TBool aDimmed);
00698
00706 IMPORT_C TBool IsCommandDimmedByPosition(TCommandPosition aPosition) const;
00707
00715 IMPORT_C void MakeCommandVisibleByPosition(TCommandPosition aPosition, TBool aVisible);
00716
00724 IMPORT_C TBool IsCommandVisibleByPosition(TCommandPosition aPosition) const;
00725
00732 IMPORT_C void AnimateCommandByPosition(TCommandPosition aPosition);
00733
00741 IMPORT_C TLocation Location() const;
00742
00750 IMPORT_C CEikCommandButton* CommandButtonOrNull(TInt aCommandId) const;
00751
00759 IMPORT_C void SetBoundingRect(const TRect& aRect);
00760
00768 IMPORT_C void ReduceRect(TRect& aBoundingRect) const;
00769
00778 IMPORT_C CCoeControl* ControlOrNull(TInt aCommandId) const;
00779
00786 IMPORT_C CEikCommandButton* ButtonById(TInt aCommandId) const;
00787
00795 IMPORT_C TInt PositionById(TInt aCommandId) const;
00796
00805 IMPORT_C void UpdateHotKey(TInt aCommandId, THotKeyFlags aFlags, TInt aKeyId);
00806
00815 IMPORT_C void UpdateCommandObserverL(TInt aPos, MEikCommandObserver& aCommandObserver);
00816
00823 IMPORT_C void RemoveCommandObserver(TInt aPos);
00824
00832 IMPORT_C TBool UpdatedCommandObserverExists(TCommandPosition aPosition) const;
00833
00842 IMPORT_C TBool DelayActivation() const;
00843
00849 inline MEikButtonGroup* ButtonGroup();
00850
00856 inline TUse ButtonGroupType();
00857
00867 void UpdateMSKCommandObserver(
00868 CEikListBox* aMSKObserverOwner,
00869 MEikCommandObserver* aCommandObserver);
00870
00871 public:
00878 IMPORT_C TSize MinimumSize();
00879
00888 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
00889
00896 void MakeVisible(TBool aVisible);
00897
00905 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00906
00907 public:
00911 IMPORT_C virtual void Reserved_MtsmPosition();
00912
00916 IMPORT_C virtual void Reserved_MtsmObject();
00917
00918 public:
00925 IMPORT_C void OfferCommandListL(const RArray<TInt>& aCommandList);
00926
00933 IMPORT_C void OfferCommandListL(const TInt aResourceId);
00934
00942 IMPORT_C TBool IsCommandInGroup(const TInt aCommandId) const;
00943
00951 IMPORT_C void ReplaceCommand(const TInt aCommandId, const TInt aResourceId);
00952
00953 private:
00954 enum TCommandOp {ESet, EAdd, EPush};
00955
00956 private:
00957 class TCmdPos
00958 {
00959 public:
00960 inline TCmdPos();
00961 inline TCmdPos(TInt aPos, TInt aCmd);
00962 public:
00963 TInt iPos;
00964 TInt iCmd;
00965 };
00966
00967 class TCmdObserver
00968 {
00969 public:
00970 inline TCmdObserver(TInt aPos, MEikCommandObserver& aObserver);
00971 public:
00972 TInt iPos;
00973 MEikCommandObserver& iObserver;
00974 };
00975
00976 class CCmdObserverArray : public CArrayFixFlat<TCmdObserver>
00977 {
00978 public:
00979 inline CCmdObserverArray();
00980 TInt FindIndex(TInt aPos);
00981 };
00982
00983 private:
00984 CEikButtonGroupContainer(TUse aUse);
00985
00986 void ConstructL(
00987 TOrientation aOrientation,
00988 MEikCommandObserver* aCommandObserver,
00989 TInt aResourceId,
00990 RWindowGroup* aParentWg,
00991 TUint aFlags);
00992
00993 IMPORT_C void DoSetCommandL(
00994 TInt aPosition,
00995 TInt aCommandId,
00996 const TDesC* aText,
00997 const CFbsBitmap* aBitmap,
00998 const CFbsBitmap* aMask,
00999 TCommandOp aOp);
01000
01001 IMPORT_C void DoSetCommandL(
01002 TInt aPosition,
01003 TInt aCommandId,
01004 const TDesC* aText,
01005 const TDesC& aFile,
01006 TInt aBitmapId,
01007 TInt aMaskId,
01008 TCommandOp aOp);
01009
01010 IMPORT_C void DoSetCommandL(
01011 TInt aCommandId,
01012 const TDesC* aText,
01013 const CFbsBitmap* aBitmap,
01014 const CFbsBitmap* aMask,
01015 TCommandOp aOp);
01016
01017 IMPORT_C void DoSetCommandL(
01018 TInt aCommandId,
01019 const TDesC* aText,
01020 const TDesC& aFile,
01021 TInt aBitmapId,
01022 TInt aMaskId,
01023 TCommandOp aOp);
01024
01025 IMPORT_C void DoSetCommandL(
01026 TInt aPosition,
01027 TInt aResourceId,
01028 TCommandOp aOp);
01029
01030 inline CCoeControl* ButtonGroupAsControl() const;
01031 void UpdateRect();
01032 static void CleanupCommandDestroy(TAny* aPtr);
01033 TCmdPos DoCleanupCommandPop();
01034 void DoCleanupCommandPopAndDestroy();
01035
01036 private:
01037 TInt CountComponentControls() const;
01038 CCoeControl* ComponentControl(TInt aIndex) const;
01039 void SizeChanged();
01040
01041 private:
01042 void ProcessCommandL(TInt aCommandId);
01043 CCoeControl* CreateCustomCommandControlL(TInt aControlType);
01044
01045 private:
01046 MEikButtonGroup* iButtonGroup;
01047 TUse iUse;
01048 CArrayFix<TCmdPos>* iCommandsCleanup;
01049 MEikCommandObserver* iCommandObserver;
01050 CCmdObserverArray* iObserverArray;
01051 TDblQueLink iBtLink;
01052 CEikListBox* iMSKObserverOwner;
01053 TInt iSpare;
01054
01055 private:
01056 friend class CCmdObserverArray;
01057 friend class CEikButtonGroupStack;
01058 };
01059
01060
01061
01062
01063 inline void CEikButtonGroupContainer::SetCommandL(
01064 TInt aPosition,
01065 TInt aCommandId,
01066 const TDesC& aText)
01067 {
01068 DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, ESet);
01069 }
01070
01071 inline void CEikButtonGroupContainer::SetCommandL(
01072 TInt aPosition,
01073 TInt aCommandId,
01074 const CFbsBitmap& aBitmap,
01075 const CFbsBitmap& aMask)
01076 {
01077 DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, ESet);
01078 }
01079
01080 inline void CEikButtonGroupContainer::SetCommandL(
01081 TInt aPosition,
01082 TInt aCommandId,
01083 const TDesC& aText,
01084 const CFbsBitmap& aBitmap,
01085 const CFbsBitmap& aMask)
01086 {
01087 DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, ESet);
01088 }
01089
01090 inline void CEikButtonGroupContainer::SetCommandL(
01091 TInt aPosition,
01092 TInt aCommandId,
01093 const TDesC& aFile,
01094 TInt aBitmapId,
01095 TInt aMaskId)
01096 {
01097 DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, ESet);
01098 }
01099
01100 inline void CEikButtonGroupContainer::SetCommandL(
01101 TInt aPosition,
01102 TInt aCommandId,
01103 const TDesC& aText,
01104 const TDesC& aFile,
01105 TInt aBitmapId,
01106 TInt aMaskId)
01107 {
01108 DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, ESet);
01109 }
01110
01111 inline void CEikButtonGroupContainer::SetCommandL(
01112 TInt aPosition,
01113 TInt aResourceId)
01114 {
01115 DoSetCommandL(aPosition, aResourceId, ESet);
01116 }
01117
01118 inline void CEikButtonGroupContainer::SetCommandL(
01119 TInt aCommandId,
01120 const TDesC& aText)
01121 {
01122 DoSetCommandL(aCommandId, &aText, NULL, NULL, ESet);
01123 }
01124
01125 inline void CEikButtonGroupContainer::SetCommandL(
01126 TInt aCommandId,
01127 const CFbsBitmap& aBitmap,
01128 const CFbsBitmap& aMask)
01129 {
01130 DoSetCommandL(aCommandId, NULL, &aBitmap, &aMask, ESet);
01131 }
01132
01133 inline void CEikButtonGroupContainer::SetCommandL(
01134 TInt aCommandId,
01135 const TDesC& aText,
01136 const CFbsBitmap& aBitmap,
01137 const CFbsBitmap& aMask)
01138 {
01139 DoSetCommandL(aCommandId, &aText, &aBitmap, &aMask, ESet);
01140 }
01141
01142 inline void CEikButtonGroupContainer::SetCommandL(
01143 TInt aCommandId,
01144 const TDesC& aFile,
01145 TInt aBitmapId,
01146 TInt aMaskId)
01147 {
01148 DoSetCommandL(aCommandId, NULL, aFile, aBitmapId, aMaskId, ESet);
01149 }
01150
01151 inline void CEikButtonGroupContainer::SetCommandL(
01152 TInt aCommandId,
01153 const TDesC& aText,
01154 const TDesC& aFile,
01155 TInt aBitmapId,
01156 TInt aMaskId)
01157 {
01158 DoSetCommandL(aCommandId, &aText, aFile, aBitmapId, aMaskId, ESet);
01159 }
01160
01161 inline void CEikButtonGroupContainer::AddCommandL(
01162 TInt aPosition,
01163 TInt aCommandId,
01164 const TDesC& aText)
01165 {
01166 DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, EAdd);
01167 }
01168
01169 inline void CEikButtonGroupContainer::AddCommandL(
01170 TInt aPosition,
01171 TInt aCommandId,
01172 const CFbsBitmap& aBitmap,
01173 const CFbsBitmap& aMask)
01174 {
01175 DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, EAdd);
01176 }
01177
01178 inline void CEikButtonGroupContainer::AddCommandL(
01179 TInt aPosition,
01180 TInt aCommandId,
01181 const TDesC& aText,
01182 const CFbsBitmap& aBitmap,
01183 const CFbsBitmap& aMask)
01184 {
01185 DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, EAdd);
01186 }
01187
01188 inline void CEikButtonGroupContainer::AddCommandL(
01189 TInt aPosition,
01190 TInt aCommandId,
01191 const TDesC& aFile,
01192 TInt aBitmapId,
01193 TInt aMaskId)
01194 {
01195 DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, EAdd);
01196 }
01197
01198 inline void CEikButtonGroupContainer::AddCommandL(
01199 TInt aPosition,
01200 TInt aCommandId,
01201 const TDesC& aText,
01202 const TDesC& aFile,
01203 TInt aBitmapId,
01204 TInt aMaskId)
01205 {
01206 DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, EAdd);
01207 }
01208
01209 inline void CEikButtonGroupContainer::AddCommandToStackL(
01210 TInt aPosition,
01211 TInt aCommandId,
01212 const TDesC& aText)
01213 {
01214 DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, EPush);
01215 }
01216
01217 inline void CEikButtonGroupContainer::AddCommandToStackL(
01218 TInt aPosition,
01219 TInt aCommandId,
01220 const CFbsBitmap& aBitmap,
01221 const CFbsBitmap& aMask)
01222 {
01223 DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, EPush);
01224 }
01225
01226 inline void CEikButtonGroupContainer::AddCommandToStackL(
01227 TInt aPosition,
01228 TInt aCommandId,
01229 const TDesC& aText,
01230 const CFbsBitmap& aBitmap,
01231 const CFbsBitmap& aMask)
01232 {
01233 DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, EPush);
01234 }
01235
01236 inline void CEikButtonGroupContainer::AddCommandToStackL(
01237 TInt aPosition,
01238 TInt aCommandId,
01239 const TDesC& aFile,
01240 TInt aBitmapId,
01241 TInt aMaskId)
01242 {
01243 DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, EPush);
01244 }
01245
01246 inline void CEikButtonGroupContainer::AddCommandToStackL(
01247 TInt aPosition,
01248 TInt aCommandId,
01249 const TDesC& aText,
01250 const TDesC& aFile,
01251 TInt aBitmapId,
01252 TInt aMaskId)
01253 {
01254 DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, EPush);
01255 }
01256
01257 inline void CEikButtonGroupContainer::AddCommandToStackL(
01258 TInt aPosition,
01259 TInt aResourceId)
01260 {
01261 DoSetCommandL(aPosition, aResourceId, EPush);
01262 }
01263
01264 inline void CEikButtonGroupContainer::CleanupCommandPop()
01265 {
01266 CleanupCommandPop(1);
01267 }
01268
01269 inline void CEikButtonGroupContainer::CleanupCommandPopAndDestroy()
01270 {
01271 CleanupStack::PopAndDestroy();
01272 }
01273
01274 inline void CEikButtonGroupContainer::CleanupCommandPopAndDestroy(TInt aCount)
01275 {
01276 CleanupStack::PopAndDestroy(aCount);
01277 }
01278
01279 inline MEikButtonGroup* CEikButtonGroupContainer::ButtonGroup()
01280 {
01281 return iButtonGroup;
01282 }
01283
01284 inline CEikButtonGroupContainer::TUse CEikButtonGroupContainer::ButtonGroupType()
01285 {
01286 return iUse;
01287 }
01288
01289
01290 #endif