epoc32/include/coelayoutman.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/coelayoutman.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,171 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// CoeLayoutManager.H
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __COELAYOUTMANAGER_H__
    1.22 +#define __COELAYOUTMANAGER_H__
    1.23 +
    1.24 +#include <e32base.h>
    1.25 +
    1.26 +class CCoeControl;
    1.27 +
    1.28 +
    1.29 +/**
    1.30 +Base class for layout managers.
    1.31 +
    1.32 +A layout manager can be attached to one, or many (depending on the concrete layout
    1.33 +manager), compound controls. The layout manager handles the layout of the components
    1.34 +of the attached compound controls, and calculates the attached compound controls' 
    1.35 +minimum size. 
    1.36 +
    1.37 +@publishedAll
    1.38 +@released
    1.39 +*/
    1.40 +class MCoeLayoutManager
    1.41 +	{
    1.42 +protected:
    1.43 +	IMPORT_C MCoeLayoutManager();
    1.44 +	
    1.45 +public:
    1.46 +
    1.47 +	/** Determines if it is possible to attach another control to the layout manager.
    1.48 +	@return <code>ETrue</code> if possible, otherwise <code>EFalse</code>
    1.49 +	*/
    1.50 +	virtual TBool CanAttach() const = 0;
    1.51 +
    1.52 +	/** Attaches <code>aCompoundControl</code> to the layout manager.
    1.53 +	Is normally not called manually since <code>CCoeControl::SetLayoutManagerL()</code>
    1.54 +	calls this function.
    1.55 +	Once a compound control is attached to a layout manager, the layout manager owns itself.
    1.56 +	@see Detach()
    1.57 +	@see CCoeControl::SetLayoutManagerL()
    1.58 +	@param aCompoundControl The compound control.
    1.59 +	*/
    1.60 +	virtual void AttachL(CCoeControl& aCompoundControl) = 0;
    1.61 +
    1.62 +	/** Detaches <code>aCompoundControl</code> from the layout manager.
    1.63 +	Is normally not called manually since <code>CCoeControl::SetLayoutManagerL()</code>
    1.64 +	calls this function when you switch layout managers on a control. It is also called
    1.65 +	from <code>CCoeControl::~CCoeControl</code>
    1.66 +	When the last attached compound control detaches, the layout manager deletes itself.
    1.67 +	@see CCoeControl::SetLayoutManagerL()
    1.68 +	@param aCompoundControl The compound control.
    1.69 +	*/
    1.70 +	virtual void Detach(CCoeControl& aCompoundControl) = 0;
    1.71 +
    1.72 +	/** Calculates the minimum size of <code>aCompoundControl</code>
    1.73 +	Is normally not called manually since <code>CCoeControl::MinimumSize()</code>
    1.74 +	calls this function in the default implementation on controls with layout managers.
    1.75 +
    1.76 +	To calculate the minimum size is almost as time consuming as performing an actual layout
    1.77 +	and should be used with caution. The minimum size depends on <code>aCompoundControl</code>'s
    1.78 +	maximum width.
    1.79 +	@see CCoeControl::MaximumWidth()
    1.80 +	@param aCompoundControl The compound control
    1.81 +	@return The minimum size
    1.82 +	*/
    1.83 +	virtual TSize CalcMinimumSize(const CCoeControl& aCompoundControl) const = 0;
    1.84 +
    1.85 +	/** Performs the layout of the attached controls
    1.86 +	Is normally not called manually since <code>CCoeControl::SizeChanged()</code>
    1.87 +	calls this function in the default implementation on controls with layout managers.
    1.88 +
    1.89 +	The layout is generally performed by calling the component controls'
    1.90 +	<code>SetMaximumWidth()</code>, followed by <code>MinimumSize()</code>, and then the
    1.91 +	layout manager tries to place the component controls according to their minimum
    1.92 +	sizes and the settings.
    1.93 +
    1.94 +	@see CCoeControl::SetMaximumWidth()
    1.95 +	@see CCoeControl::MinimumSize()
    1.96 +	*/
    1.97 +	virtual void PerformLayout() = 0;
    1.98 +
    1.99 +	/** Gets the offset to the first text baseline relative to the top of the control.
   1.100 +	
   1.101 +	@param aCompoundControl The control
   1.102 +	@param aSize The size of the control
   1.103 +	@return The baseline
   1.104 +	@see CCoeControl::TextBaselineOffset()
   1.105 +	*/
   1.106 +	virtual TInt CalcTextBaselineOffset(const CCoeControl& aCompoundControl, const TSize& aSize) const = 0;
   1.107 +
   1.108 +	/** Sets the spacing between text baselines.
   1.109 +
   1.110 +	@param aBaselineSpacing The new value for the baseline
   1.111 +	@see CCoeControl::SetTextBaseLineSpacing()
   1.112 +	*/
   1.113 +	virtual void SetTextBaselineSpacing(TInt aBaselineSpacing) = 0;
   1.114 +	
   1.115 +	/** Returns the baseline spacing.
   1.116 +	@return The baseline value.
   1.117 +	*/
   1.118 +	virtual TInt TextBaselineSpacing() const = 0;
   1.119 +
   1.120 +	/** Handles when a component control is added to an attached compound control
   1.121 +	Is normally not called manually since <code>CCoeControlArray::InsertLC()</code>
   1.122 +	calls this function for controls with layout managers.
   1.123 +	Is used by layout managers to prepare to layout one more component control.
   1.124 +	@see CCoeControlArray::InsertLC()
   1.125 +	@param aCompoundControl The compound control.
   1.126 +	@param aAddedControl The added control
   1.127 +	*/
   1.128 +	virtual void HandleAddedControlL(const CCoeControl& aCompoundControl, const CCoeControl& aAddedControl) = 0;
   1.129 +	
   1.130 +	/** Handles when a component control is removed from an attached compound control
   1.131 +	Is normally not called manually since <code>CCoeControlArray::Remove()</code>
   1.132 +	calls this function for controls with layout managers.
   1.133 +	Is used by layout managers to remove all settings and similar that are specific for
   1.134 +	<code>aRemovedControl</code>.
   1.135 +	@see CCoeControlArray::Remove()
   1.136 +	@param aCompoundControl The compound control.
   1.137 +	@param aRemovedControl The removed control
   1.138 +	*/
   1.139 +	virtual void HandleRemovedControl(const CCoeControl& aCompoundControl, const CCoeControl& aRemovedControl) = 0;
   1.140 +
   1.141 +	/** Handles when a component control is replaced by another component control
   1.142 +	in an attached compound control
   1.143 +	
   1.144 +	Is not called by <code>CCoeControl</code>.
   1.145 +	Is used by layout managers to move settings and similar that are specified for 
   1.146 +	<code>aOldControl</code> to <code>aNewControl</code>
   1.147 +	If this function is called, neither <code>HandleAddedControlL</code> nor 
   1.148 +	<code>HandleRemovedControl</code> is allowed to be called.
   1.149 +	@param aOldControl The old component control
   1.150 +	@param aNewControl The new component control
   1.151 +	@return <code>KErrNone</code> if no error. <code>KErrNotFound</code> if the
   1.152 +	layout manager cannot find <code>aOldControl</code>
   1.153 +	*/
   1.154 +	virtual TInt HandleControlReplaced(const CCoeControl& aOldControl, const CCoeControl& aNewControl) = 0;
   1.155 +
   1.156 +	
   1.157 +private:
   1.158 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_1();
   1.159 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_2();
   1.160 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_3();
   1.161 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_4();
   1.162 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_5();
   1.163 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_6();
   1.164 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_7();
   1.165 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_8();
   1.166 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_9();
   1.167 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_10();
   1.168 +	IMPORT_C virtual void Reserved_MCoeLayoutManager_11();
   1.169 +private:
   1.170 +	TInt iMCoeLayoutManager_Reserved1;
   1.171 +	};
   1.172 +
   1.173 +
   1.174 +#endif	// __COELAYOUTMANAGER_H__