williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // CoeLayoutManager.H williamr@2: // williamr@2: // williamr@2: williamr@2: #ifndef __COELAYOUTMANAGER_H__ williamr@2: #define __COELAYOUTMANAGER_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: class CCoeControl; williamr@2: williamr@2: williamr@2: /** williamr@2: Base class for layout managers. williamr@2: williamr@2: A layout manager can be attached to one, or many (depending on the concrete layout williamr@2: manager), compound controls. The layout manager handles the layout of the components williamr@2: of the attached compound controls, and calculates the attached compound controls' williamr@2: minimum size. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class MCoeLayoutManager williamr@2: { williamr@2: protected: williamr@2: IMPORT_C MCoeLayoutManager(); williamr@2: williamr@2: public: williamr@2: williamr@2: /** Determines if it is possible to attach another control to the layout manager. williamr@2: @return ETrue if possible, otherwise EFalse williamr@2: */ williamr@2: virtual TBool CanAttach() const = 0; williamr@2: williamr@2: /** Attaches aCompoundControl to the layout manager. williamr@2: Is normally not called manually since CCoeControl::SetLayoutManagerL() williamr@2: calls this function. williamr@2: Once a compound control is attached to a layout manager, the layout manager owns itself. williamr@2: @see Detach() williamr@2: @see CCoeControl::SetLayoutManagerL() williamr@2: @param aCompoundControl The compound control. williamr@2: */ williamr@2: virtual void AttachL(CCoeControl& aCompoundControl) = 0; williamr@2: williamr@2: /** Detaches aCompoundControl from the layout manager. williamr@2: Is normally not called manually since CCoeControl::SetLayoutManagerL() williamr@2: calls this function when you switch layout managers on a control. It is also called williamr@2: from CCoeControl::~CCoeControl williamr@2: When the last attached compound control detaches, the layout manager deletes itself. williamr@2: @see CCoeControl::SetLayoutManagerL() williamr@2: @param aCompoundControl The compound control. williamr@2: */ williamr@2: virtual void Detach(CCoeControl& aCompoundControl) = 0; williamr@2: williamr@2: /** Calculates the minimum size of aCompoundControl williamr@2: Is normally not called manually since CCoeControl::MinimumSize() williamr@2: calls this function in the default implementation on controls with layout managers. williamr@2: williamr@2: To calculate the minimum size is almost as time consuming as performing an actual layout williamr@2: and should be used with caution. The minimum size depends on aCompoundControl's williamr@2: maximum width. williamr@2: @see CCoeControl::MaximumWidth() williamr@2: @param aCompoundControl The compound control williamr@2: @return The minimum size williamr@2: */ williamr@2: virtual TSize CalcMinimumSize(const CCoeControl& aCompoundControl) const = 0; williamr@2: williamr@2: /** Performs the layout of the attached controls williamr@2: Is normally not called manually since CCoeControl::SizeChanged() williamr@2: calls this function in the default implementation on controls with layout managers. williamr@2: williamr@2: The layout is generally performed by calling the component controls' williamr@2: SetMaximumWidth(), followed by MinimumSize(), and then the williamr@2: layout manager tries to place the component controls according to their minimum williamr@2: sizes and the settings. williamr@2: williamr@2: @see CCoeControl::SetMaximumWidth() williamr@2: @see CCoeControl::MinimumSize() williamr@2: */ williamr@2: virtual void PerformLayout() = 0; williamr@2: williamr@2: /** Gets the offset to the first text baseline relative to the top of the control. williamr@2: williamr@2: @param aCompoundControl The control williamr@2: @param aSize The size of the control williamr@2: @return The baseline williamr@2: @see CCoeControl::TextBaselineOffset() williamr@2: */ williamr@2: virtual TInt CalcTextBaselineOffset(const CCoeControl& aCompoundControl, const TSize& aSize) const = 0; williamr@2: williamr@2: /** Sets the spacing between text baselines. williamr@2: williamr@2: @param aBaselineSpacing The new value for the baseline williamr@2: @see CCoeControl::SetTextBaseLineSpacing() williamr@2: */ williamr@2: virtual void SetTextBaselineSpacing(TInt aBaselineSpacing) = 0; williamr@2: williamr@2: /** Returns the baseline spacing. williamr@2: @return The baseline value. williamr@2: */ williamr@2: virtual TInt TextBaselineSpacing() const = 0; williamr@2: williamr@2: /** Handles when a component control is added to an attached compound control williamr@2: Is normally not called manually since CCoeControlArray::InsertLC() williamr@2: calls this function for controls with layout managers. williamr@2: Is used by layout managers to prepare to layout one more component control. williamr@2: @see CCoeControlArray::InsertLC() williamr@2: @param aCompoundControl The compound control. williamr@2: @param aAddedControl The added control williamr@2: */ williamr@2: virtual void HandleAddedControlL(const CCoeControl& aCompoundControl, const CCoeControl& aAddedControl) = 0; williamr@2: williamr@2: /** Handles when a component control is removed from an attached compound control williamr@2: Is normally not called manually since CCoeControlArray::Remove() williamr@2: calls this function for controls with layout managers. williamr@2: Is used by layout managers to remove all settings and similar that are specific for williamr@2: aRemovedControl. williamr@2: @see CCoeControlArray::Remove() williamr@2: @param aCompoundControl The compound control. williamr@2: @param aRemovedControl The removed control williamr@2: */ williamr@2: virtual void HandleRemovedControl(const CCoeControl& aCompoundControl, const CCoeControl& aRemovedControl) = 0; williamr@2: williamr@2: /** Handles when a component control is replaced by another component control williamr@2: in an attached compound control williamr@2: williamr@2: Is not called by CCoeControl. williamr@2: Is used by layout managers to move settings and similar that are specified for williamr@2: aOldControl to aNewControl williamr@2: If this function is called, neither HandleAddedControlL nor williamr@2: HandleRemovedControl is allowed to be called. williamr@2: @param aOldControl The old component control williamr@2: @param aNewControl The new component control williamr@2: @return KErrNone if no error. KErrNotFound if the williamr@2: layout manager cannot find aOldControl williamr@2: */ williamr@2: virtual TInt HandleControlReplaced(const CCoeControl& aOldControl, const CCoeControl& aNewControl) = 0; williamr@2: williamr@2: williamr@2: private: williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_1(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_2(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_3(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_4(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_5(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_6(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_7(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_8(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_9(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_10(); williamr@2: IMPORT_C virtual void Reserved_MCoeLayoutManager_11(); williamr@2: private: williamr@2: TInt iMCoeLayoutManager_Reserved1; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // __COELAYOUTMANAGER_H__