epoc32/include/mw/coelayoutman.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// CoeLayoutManager.H
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
#ifndef __COELAYOUTMANAGER_H__
williamr@2
    19
#define __COELAYOUTMANAGER_H__
williamr@2
    20
williamr@2
    21
#include <e32base.h>
williamr@2
    22
williamr@2
    23
class CCoeControl;
williamr@2
    24
williamr@2
    25
williamr@2
    26
/**
williamr@2
    27
Base class for layout managers.
williamr@2
    28
williamr@2
    29
A layout manager can be attached to one, or many (depending on the concrete layout
williamr@2
    30
manager), compound controls. The layout manager handles the layout of the components
williamr@2
    31
of the attached compound controls, and calculates the attached compound controls' 
williamr@2
    32
minimum size. 
williamr@2
    33
williamr@2
    34
@publishedAll
williamr@2
    35
@released
williamr@2
    36
*/
williamr@2
    37
class MCoeLayoutManager
williamr@2
    38
	{
williamr@2
    39
protected:
williamr@2
    40
	IMPORT_C MCoeLayoutManager();
williamr@2
    41
	
williamr@2
    42
public:
williamr@2
    43
williamr@2
    44
	/** Determines if it is possible to attach another control to the layout manager.
williamr@2
    45
	@return <code>ETrue</code> if possible, otherwise <code>EFalse</code>
williamr@2
    46
	*/
williamr@2
    47
	virtual TBool CanAttach() const = 0;
williamr@2
    48
williamr@2
    49
	/** Attaches <code>aCompoundControl</code> to the layout manager.
williamr@2
    50
	Is normally not called manually since <code>CCoeControl::SetLayoutManagerL()</code>
williamr@2
    51
	calls this function.
williamr@2
    52
	Once a compound control is attached to a layout manager, the layout manager owns itself.
williamr@2
    53
	@see Detach()
williamr@2
    54
	@see CCoeControl::SetLayoutManagerL()
williamr@2
    55
	@param aCompoundControl The compound control.
williamr@2
    56
	*/
williamr@2
    57
	virtual void AttachL(CCoeControl& aCompoundControl) = 0;
williamr@2
    58
williamr@2
    59
	/** Detaches <code>aCompoundControl</code> from the layout manager.
williamr@2
    60
	Is normally not called manually since <code>CCoeControl::SetLayoutManagerL()</code>
williamr@2
    61
	calls this function when you switch layout managers on a control. It is also called
williamr@2
    62
	from <code>CCoeControl::~CCoeControl</code>
williamr@2
    63
	When the last attached compound control detaches, the layout manager deletes itself.
williamr@2
    64
	@see CCoeControl::SetLayoutManagerL()
williamr@2
    65
	@param aCompoundControl The compound control.
williamr@2
    66
	*/
williamr@2
    67
	virtual void Detach(CCoeControl& aCompoundControl) = 0;
williamr@2
    68
williamr@2
    69
	/** Calculates the minimum size of <code>aCompoundControl</code>
williamr@2
    70
	Is normally not called manually since <code>CCoeControl::MinimumSize()</code>
williamr@2
    71
	calls this function in the default implementation on controls with layout managers.
williamr@2
    72
williamr@2
    73
	To calculate the minimum size is almost as time consuming as performing an actual layout
williamr@2
    74
	and should be used with caution. The minimum size depends on <code>aCompoundControl</code>'s
williamr@2
    75
	maximum width.
williamr@2
    76
	@see CCoeControl::MaximumWidth()
williamr@2
    77
	@param aCompoundControl The compound control
williamr@2
    78
	@return The minimum size
williamr@2
    79
	*/
williamr@2
    80
	virtual TSize CalcMinimumSize(const CCoeControl& aCompoundControl) const = 0;
williamr@2
    81
williamr@2
    82
	/** Performs the layout of the attached controls
williamr@2
    83
	Is normally not called manually since <code>CCoeControl::SizeChanged()</code>
williamr@2
    84
	calls this function in the default implementation on controls with layout managers.
williamr@2
    85
williamr@2
    86
	The layout is generally performed by calling the component controls'
williamr@2
    87
	<code>SetMaximumWidth()</code>, followed by <code>MinimumSize()</code>, and then the
williamr@2
    88
	layout manager tries to place the component controls according to their minimum
williamr@2
    89
	sizes and the settings.
williamr@2
    90
williamr@2
    91
	@see CCoeControl::SetMaximumWidth()
williamr@2
    92
	@see CCoeControl::MinimumSize()
williamr@2
    93
	*/
williamr@2
    94
	virtual void PerformLayout() = 0;
williamr@2
    95
williamr@2
    96
	/** Gets the offset to the first text baseline relative to the top of the control.
williamr@2
    97
	
williamr@2
    98
	@param aCompoundControl The control
williamr@2
    99
	@param aSize The size of the control
williamr@2
   100
	@return The baseline
williamr@2
   101
	@see CCoeControl::TextBaselineOffset()
williamr@2
   102
	*/
williamr@2
   103
	virtual TInt CalcTextBaselineOffset(const CCoeControl& aCompoundControl, const TSize& aSize) const = 0;
williamr@2
   104
williamr@2
   105
	/** Sets the spacing between text baselines.
williamr@2
   106
williamr@2
   107
	@param aBaselineSpacing The new value for the baseline
williamr@2
   108
	@see CCoeControl::SetTextBaseLineSpacing()
williamr@2
   109
	*/
williamr@2
   110
	virtual void SetTextBaselineSpacing(TInt aBaselineSpacing) = 0;
williamr@2
   111
	
williamr@2
   112
	/** Returns the baseline spacing.
williamr@2
   113
	@return The baseline value.
williamr@2
   114
	*/
williamr@2
   115
	virtual TInt TextBaselineSpacing() const = 0;
williamr@2
   116
williamr@2
   117
	/** Handles when a component control is added to an attached compound control
williamr@2
   118
	Is normally not called manually since <code>CCoeControlArray::InsertLC()</code>
williamr@2
   119
	calls this function for controls with layout managers.
williamr@2
   120
	Is used by layout managers to prepare to layout one more component control.
williamr@2
   121
	@see CCoeControlArray::InsertLC()
williamr@2
   122
	@param aCompoundControl The compound control.
williamr@2
   123
	@param aAddedControl The added control
williamr@2
   124
	*/
williamr@2
   125
	virtual void HandleAddedControlL(const CCoeControl& aCompoundControl, const CCoeControl& aAddedControl) = 0;
williamr@2
   126
	
williamr@2
   127
	/** Handles when a component control is removed from an attached compound control
williamr@2
   128
	Is normally not called manually since <code>CCoeControlArray::Remove()</code>
williamr@2
   129
	calls this function for controls with layout managers.
williamr@2
   130
	Is used by layout managers to remove all settings and similar that are specific for
williamr@2
   131
	<code>aRemovedControl</code>.
williamr@2
   132
	@see CCoeControlArray::Remove()
williamr@2
   133
	@param aCompoundControl The compound control.
williamr@2
   134
	@param aRemovedControl The removed control
williamr@2
   135
	*/
williamr@2
   136
	virtual void HandleRemovedControl(const CCoeControl& aCompoundControl, const CCoeControl& aRemovedControl) = 0;
williamr@2
   137
williamr@2
   138
	/** Handles when a component control is replaced by another component control
williamr@2
   139
	in an attached compound control
williamr@2
   140
	
williamr@2
   141
	Is not called by <code>CCoeControl</code>.
williamr@2
   142
	Is used by layout managers to move settings and similar that are specified for 
williamr@2
   143
	<code>aOldControl</code> to <code>aNewControl</code>
williamr@2
   144
	If this function is called, neither <code>HandleAddedControlL</code> nor 
williamr@2
   145
	<code>HandleRemovedControl</code> is allowed to be called.
williamr@2
   146
	@param aOldControl The old component control
williamr@2
   147
	@param aNewControl The new component control
williamr@2
   148
	@return <code>KErrNone</code> if no error. <code>KErrNotFound</code> if the
williamr@2
   149
	layout manager cannot find <code>aOldControl</code>
williamr@2
   150
	*/
williamr@2
   151
	virtual TInt HandleControlReplaced(const CCoeControl& aOldControl, const CCoeControl& aNewControl) = 0;
williamr@2
   152
williamr@2
   153
	
williamr@2
   154
private:
williamr@2
   155
	IMPORT_C virtual void Reserved_MCoeLayoutManager_1();
williamr@2
   156
	IMPORT_C virtual void Reserved_MCoeLayoutManager_2();
williamr@2
   157
	IMPORT_C virtual void Reserved_MCoeLayoutManager_3();
williamr@2
   158
	IMPORT_C virtual void Reserved_MCoeLayoutManager_4();
williamr@2
   159
	IMPORT_C virtual void Reserved_MCoeLayoutManager_5();
williamr@2
   160
	IMPORT_C virtual void Reserved_MCoeLayoutManager_6();
williamr@2
   161
	IMPORT_C virtual void Reserved_MCoeLayoutManager_7();
williamr@2
   162
	IMPORT_C virtual void Reserved_MCoeLayoutManager_8();
williamr@2
   163
	IMPORT_C virtual void Reserved_MCoeLayoutManager_9();
williamr@2
   164
	IMPORT_C virtual void Reserved_MCoeLayoutManager_10();
williamr@2
   165
	IMPORT_C virtual void Reserved_MCoeLayoutManager_11();
williamr@2
   166
private:
williamr@2
   167
	TInt iMCoeLayoutManager_Reserved1;
williamr@2
   168
	};
williamr@2
   169
williamr@2
   170
williamr@2
   171
#endif	// __COELAYOUTMANAGER_H__