S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CLandmarksContainerBase Class Reference

#include <LandmarksContainerBase.h>

Inheritance diagram for CLandmarksContainerBase:

MLandmarksDbObserver MLandmarksOperationObserver CLandmarksCategoriesContainer CLandmarksContainer List of all members.

Public Member Functions

 ~CLandmarksContainerBase ()
TBool IsItemSelected ()
TInt CountComponentControls () const
CCoeControl * ComponentControl (TInt aIndex) const
void SizeChanged ()
void HandleResourceChange (TInt aType)
void NotifyDbEventL (TPosLmEvent &aEvent, TInt aErrorCode)=0
void NotifyOperationProgressL (TOperation aOperation, TInt aProgress, TInt aErrorCode)=0

Protected Member Functions

 CLandmarksContainerBase (CAknView &aView, CLandmarksApplicationEngine &aEngine)
void ConstructL (const TRect &aRect)

Protected Attributes

CLandmarksListBox * iListBox
 the control used to display icons and descriptors.
CAknSearchField * iFindBox
 the control used to display a search field.
CAknView & iView
 parent view
CLandmarksApplicationEngine & iEngine
 the application engine used for accessing landmarks
HBufC * iOldFilter
 a buffer containing the last descriptor in the find box.

Private Member Functions

void CreateFindBoxL ()
void CreateListBoxL ()

Detailed Description

CLandmarksContainerBase is an abstrct class that contains functions and data common for all view containers in this application.

Definition at line 36 of file LandmarksContainerBase.h.


Constructor & Destructor Documentation

CLandmarksContainerBase::~CLandmarksContainerBase (   ) 
 

Destructor

Definition at line 59 of file LandmarksContainerBase.cpp.

References iFindBox, iListBox, and iOldFilter.

00060     {
00061     delete iListBox;
00062     delete iFindBox;
00063     delete iOldFilter;
00064     }

CLandmarksContainerBase::CLandmarksContainerBase (  CAknView &  aView,
CLandmarksApplicationEngine &  aEngine
)  [protected]
 

C++ default constructor.

Parameters:
aView The parent view.
aEngine The application engine.

Definition at line 35 of file LandmarksContainerBase.cpp.

00038 :   iView(aView), iEngine(aEngine)
00039     {
00040     }


Member Function Documentation

TBool CLandmarksContainerBase::IsItemSelected (   ) 
 

Indicates whether a listbox item is selected or not.

Definition at line 72 of file LandmarksContainerBase.cpp.

References iListBox.

00073     {
00074     return (iListBox->CurrentItemIndex() >= 0);
00075     }

TInt CLandmarksContainerBase::CountComponentControls (   )  const
 

Gets the number of controls contained in a compound control

Returns:
Number of component controls

Definition at line 83 of file LandmarksContainerBase.cpp.

References iFindBox, and iListBox.

00084     {
00085     TInt count = 0;
00086     if (iListBox)
00087         {
00088         count++;
00089         }
00090     if (iFindBox)
00091         {
00092         count++;
00093         }
00094 
00095     return count; // Return the number of controls inside this container.
00096     }

CCoeControl * CLandmarksContainerBase::ComponentControl (  TInt  aIndex  )  const
 

Gets the specified component

Parameters:
aIndex specification for component pointer
Returns:
Pointer to component control

Definition at line 104 of file LandmarksContainerBase.cpp.

References iFindBox, and iListBox.

00105     {
00106     switch (aIndex)
00107         {
00108         case 0:
00109             return iListBox; // Returns the pointer to listbox object.
00110         case 1:
00111             return iFindBox; // Returns the pointer to findbox object.
00112         default:
00113             return NULL; // Exception : Returns NULL.
00114         }
00115     }

void CLandmarksContainerBase::SizeChanged (   ) 
 

Called by framework when the view size is changed.

Definition at line 167 of file LandmarksContainerBase.cpp.

References iFindBox, and iListBox.

00168     {
00169         // Set list box size.
00170         //iListBox->SetRect(Rect());
00171         iListBox->SizeChanged();
00172 
00173     // Set find box size.
00174     AknFind::HandleFixedFindSizeChanged(this, iListBox, iFindBox);
00175     }

void CLandmarksContainerBase::HandleResourceChange (  TInt  aType  ) 
 

Reacts to screen size change

Definition at line 183 of file LandmarksContainerBase.cpp.

References iView.

00184     {
00185     CCoeControl::HandleResourceChange(aType);
00186     if ( aType == KEikDynamicLayoutVariantSwitch )
00187         {
00188         SetRect(iView.ClientRect());
00189         }
00190     }

void CLandmarksContainerBase::NotifyDbEventL (  TPosLmEvent &  aEvent,
TInt  aErrorCode
)  [pure virtual]
 

Notifies that an event has occurred in the default landmark database.

Parameters:
aEvent contains info about the event.
aErrorCode possible error codes if reporting the event was not successful.

Implements MLandmarksDbObserver.

Implemented in CLandmarksCategoriesContainer, and CLandmarksContainer.

void CLandmarksContainerBase::NotifyOperationProgressL (  TOperation  aOperation,
TInt  aProgress,
TInt  aErrorCode
)  [pure virtual]
 

Notifies the progress and status of an asynchronous operation.

Parameters:
aOperation the type of operation that is reported.
aProgress the progress of the operation.
aErrorCode the status of the operation.

Implements MLandmarksOperationObserver.

Implemented in CLandmarksCategoriesContainer, and CLandmarksContainer.

void CLandmarksContainerBase::ConstructL (  const TRect &  aRect  )  [protected]
 

Performs the second phase construction of a CLandmarksContainerBase object. Should be called by subclasses.

Parameters:
aRect Frame rectangle for container.

Reimplemented in CLandmarksCategoriesContainer, and CLandmarksContainer.

Definition at line 47 of file LandmarksContainerBase.cpp.

References CreateFindBoxL(), and CreateListBoxL().

00048     {
00049     CreateWindowL();
00050 
00051     CreateListBoxL();
00052     CreateFindBoxL();
00053 
00054     SetRect(aRect);
00055     ActivateL();
00056     }

void CLandmarksContainerBase::CreateFindBoxL (   )  [private]
 

Creates the find box.

Definition at line 123 of file LandmarksContainerBase.cpp.

References iFindBox, iListBox, iOldFilter, and CLandmarksListBox::Model().

00124     {
00125     // Sets style of findbox.
00126     CAknSearchField::TSearchFieldStyle style(CAknSearchField::ESearch);
00127 
00128     // Creates FindBox.
00129     CGulIcon* defaultIcon = NULL;
00130     iFindBox = CAknSearchField::NewL(
00131         *this, style, defaultIcon, KPosLmMaxTextFieldLength);
00132 
00133     // Creates a filter (CAknListBoxFilterItems instance). This filter is not 
00134     // used in this app but the CAknSearchField class MUST have a filter 
00135     // anyway. The filter is bypassed by the CLandmarksListBoxModel class.
00136     iListBox->Model()->CreateFilterL(iListBox, iFindBox);
00137 
00138     // Initialize filter buffer
00139     iOldFilter = HBufC::NewL(0);
00140     }

void CLandmarksContainerBase::CreateListBoxL (   )  [private]
 

Creates the listbox.

Definition at line 148 of file LandmarksContainerBase.cpp.

References CLandmarksListBox::ConstructL(), and iListBox.

00149     {
00150     // Create a control to display a list of descriptors
00151     iListBox = new (ELeave) CLandmarksListBox();
00152     iListBox->SetContainerWindowL(*this);
00153     iListBox->ConstructL(this, CEikListBox::ELoopScrolling);
00154 
00155     // Create scrollbars
00156     CEikScrollBarFrame* scrollBar = iListBox->CreateScrollBarFrameL(ETrue);
00157     scrollBar->SetScrollBarVisibilityL(
00158                 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
00159     }


© Nokia 2006

Back to top