uifw/uiklaf/inc/LAFMENUP.H
changeset 0 2f259fa3e83a
child 3 8ca85d2f0db7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __LAFMENUP_H__
       
    20 #define __LAFMENUP_H__
       
    21 
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <gulbordr.h>
       
    25 #include <coecntrl.h>
       
    26 #include <uiklaf/private/lafenv.h>
       
    27 #include <lafmain.h>
       
    28 #include <lafpublc.h>
       
    29 #include "lafsbfrm.h"
       
    30 
       
    31 class CGulIcon;
       
    32 class TMargins8;
       
    33 
       
    34 //
       
    35 // class LafMenuPane
       
    36 //
       
    37 
       
    38 class LafMenuPane
       
    39 	{
       
    40 public:
       
    41 	enum TInternalFlags
       
    42         {
       
    43         EMenuHasIcon			= 0x1,
       
    44         EMenuHasHotkey			= 0x2,
       
    45         EMenuHasLeftAdornment	= 0x4,
       
    46         EMenuHasRightAdornment	= 0x8,
       
    47         EMenuIsLeftAdornment	= 0x10,
       
    48         EMenuIsRightAdornment	= 0x20
       
    49         };
       
    50 public:
       
    51 	class TItemAttributes
       
    52 		{
       
    53 	public:
       
    54 		IMPORT_C TItemAttributes();
       
    55 	public:
       
    56 		TInt iBaseLine;
       
    57 		TInt iFlags;
       
    58 		TInt iInternalFlags;
       
    59 		TInt iHeight;
       
    60 		SLafMenuPane::THighlightType iHighlightType;
       
    61 		TInt iHPosition;
       
    62 		};
       
    63 public:
       
    64 	IMPORT_C static TBool FadeBehind();
       
    65 	IMPORT_C static void GetDefaultBorder(TGulBorder& aBorder);
       
    66 	IMPORT_C static void GetBorderColors(TGulBorder::TColors& aBorderColors,const MLafEnv& aLafEnv,const CCoeControl& aMatchedControl);
       
    67 	IMPORT_C static const TMargins8 CascadeMargins();
       
    68 	IMPORT_C static const TMargins8 Margins();
       
    69 	IMPORT_C static const TMargins8 ScrollBarMargins();
       
    70 	IMPORT_C static TBool ShowHotKeys();
       
    71 	IMPORT_C static void GetDefaultScrollBarAttributes(TInt aOrientation, LafScrollBarFrame::TScrollBarAttributes& aAttributes);
       
    72 	IMPORT_C static TInt DefaultScrollBarFlags(TInt aOrientation);
       
    73 	IMPORT_C static TInt AdornmentSpace(const TItemAttributes& aItemAttributes);
       
    74 	IMPORT_C static TInt InputCapabilities();
       
    75 	IMPORT_C static TBool SelectFirstItemOnConstruction();
       
    76 	IMPORT_C static TInt DefaultCbaResId();
       
    77 	IMPORT_C static void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList);
       
    78 	IMPORT_C static TUint MapKeyCode(const TKeyEvent& aKeyEvent,TEventCode aType);
       
    79 // Drawing
       
    80 	IMPORT_C static void DrawVisualFeedback(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect);
       
    81 	IMPORT_C static void DrawHotKeyText(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect, const TDesC& aHotKeysText, const TItemAttributes& aItemAttributes);
       
    82 	IMPORT_C static void DrawLeftAdornment(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes);
       
    83 	IMPORT_C static void DrawRightAdornment(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes);
       
    84 	IMPORT_C static void DrawSeperator(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes);
       
    85 	IMPORT_C static void DrawText(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect, const TDesC& aText, const TItemAttributes& aItemAttributes);
       
    86 	IMPORT_C static void DrawTitlePaneJoint(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const CCoeControl* aMenuPaneTitle, const TRect& aInnerRect);
       
    87 	IMPORT_C static void PrepareGcForDrawingItems(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc);
       
    88 	IMPORT_C static void PrepareGcForHighlight(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TItemAttributes& aItemAttributes);
       
    89 public:
       
    90 // Constants
       
    91 	inline static TInt ExtraBaselineOffset();
       
    92 	inline static TInt MenuCascadeOverlap();
       
    93 	inline static TInt MenuPaneTextTopSpace();
       
    94 	inline static TInt MenuPaneTextBottomSpace();
       
    95 	inline static TInt MenuPaneSeparatorAfterSpace();
       
    96 	inline static TInt MenuPaneSeparatorMargin();
       
    97 	inline static TInt MenuSeparatorYOffset();
       
    98 	inline static TInt OffsetBetweenMenuPaneAndMenuPaneTitle();
       
    99 	inline static TInt PostIconSpace();
       
   100 	inline static TInt PostRightAdornmentSpace();
       
   101 	inline static TInt PreIconSpace();
       
   102 	inline static TInt ShadowHeight();
       
   103 	inline static TInt SpaceBetweenTextAndHotkey();
       
   104 	inline static TInt NumberOfItemsInView();
       
   105 // Fonts
       
   106 	inline static const CFont* AnnotationFont(const MLafEnv& aLafEnv);
       
   107 	inline static const CFont* NormalFont(const MLafEnv& aLafEnv);
       
   108 	inline static const CFont* SymbolFont(const MLafEnv& aLafEnv);
       
   109 private:
       
   110 	enum TConstantType
       
   111 		{
       
   112 		EPostRightAdornmentSpace,
       
   113 		EMenuPaneTextTopSpace,
       
   114 		EMenuPaneTextBottomSpace,
       
   115 		ESpaceBetweenTextAndHotkey,
       
   116 		EOffsetBetweenMenuPaneAndMenuPaneTitle,
       
   117 		EMenuPaneSeparatorMargin,
       
   118 		EShadowHeight,
       
   119 		EPreIconSpace,
       
   120 		EPostIconSpace,
       
   121 		EExtraBaselineOffset,
       
   122 		EMenuPaneSeparatorAfterSpace,
       
   123 		EMenuCascadeOverlap,
       
   124 		EMenuSeparatorYOffset,
       
   125 		ENumberOfItemsInView
       
   126 		};
       
   127 	enum TFontType
       
   128 		{
       
   129 		EAnnotation,
       
   130 		ENormal,
       
   131 		ESymbol
       
   132 		};
       
   133 private:
       
   134 	IMPORT_C static TInt Constant(TConstantType aConstantType);
       
   135 	IMPORT_C static const CFont* Font(const MLafEnv& aLafEnv, TFontType aFontType);
       
   136 	};
       
   137 
       
   138 //
       
   139 // class LafMenuPaneItem
       
   140 //
       
   141 
       
   142 class LafMenuPaneItem
       
   143 	{
       
   144 public:
       
   145 	IMPORT_C static void DrawIcon(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect, const CGulIcon* aIcon, SLafMenuPane::THighlightType aHighlightType);
       
   146 	};
       
   147 
       
   148 
       
   149 //
       
   150 // Inlines
       
   151 //
       
   152 
       
   153 /**
       
   154  * Returns the post right adornment space.
       
   155  */
       
   156 inline TInt LafMenuPane::PostRightAdornmentSpace()
       
   157 	{//static	
       
   158 	return Constant(EPostRightAdornmentSpace);	
       
   159 	};
       
   160 
       
   161 /**
       
   162  * Returns an extra space which will be added to the height of item font.
       
   163  */
       
   164 inline TInt LafMenuPane::MenuPaneTextTopSpace()
       
   165 	{//static	
       
   166 	return Constant(EMenuPaneTextTopSpace);	
       
   167 	}
       
   168 
       
   169 /**
       
   170  * Returns an extra space which will be added to the height of item font.
       
   171  */
       
   172 inline TInt LafMenuPane::MenuPaneTextBottomSpace()
       
   173 	{//static	
       
   174 	return Constant(EMenuPaneTextBottomSpace);	
       
   175 	}
       
   176 
       
   177 /**
       
   178  * Returns the space between the item text and the hotkey.
       
   179  */
       
   180 inline TInt LafMenuPane::SpaceBetweenTextAndHotkey()
       
   181 	{//static	
       
   182 	return Constant(ESpaceBetweenTextAndHotkey);	
       
   183 	}
       
   184 
       
   185 inline TInt LafMenuPane::OffsetBetweenMenuPaneAndMenuPaneTitle()
       
   186 	{//static	
       
   187 	return Constant(EOffsetBetweenMenuPaneAndMenuPaneTitle);	
       
   188 	}
       
   189 
       
   190 /**
       
   191  * Returns the shadow height for the menu pane.
       
   192  */
       
   193 inline TInt LafMenuPane::ShadowHeight()
       
   194 	{//static	
       
   195 	return Constant(EShadowHeight);	
       
   196 	}
       
   197 
       
   198 inline TInt LafMenuPane::MenuPaneSeparatorMargin()
       
   199 	{//static	
       
   200 	return Constant(EMenuPaneSeparatorMargin);	
       
   201 	}
       
   202 
       
   203 inline TInt LafMenuPane::PreIconSpace()
       
   204 	{//static	
       
   205 	return Constant(EPreIconSpace);
       
   206 	}
       
   207 
       
   208 inline TInt LafMenuPane::PostIconSpace()
       
   209 	{//static	
       
   210 	return Constant(EPostIconSpace);	
       
   211 	}
       
   212 
       
   213 inline TInt LafMenuPane::ExtraBaselineOffset()
       
   214 	{//static	
       
   215 	return Constant(EExtraBaselineOffset);	
       
   216 	}
       
   217 
       
   218 inline TInt LafMenuPane::MenuPaneSeparatorAfterSpace()
       
   219 	{//static	
       
   220 	return Constant(EMenuPaneSeparatorAfterSpace);	
       
   221 	}
       
   222 
       
   223 inline TInt LafMenuPane::MenuCascadeOverlap()
       
   224 	{//static	
       
   225 	return Constant(EMenuCascadeOverlap);	
       
   226 	}
       
   227 
       
   228 inline TInt LafMenuPane::MenuSeparatorYOffset()
       
   229 	{//static	
       
   230 	return Constant(EMenuSeparatorYOffset);	
       
   231 	}
       
   232 
       
   233 inline TInt LafMenuPane::NumberOfItemsInView()
       
   234 	{//static	
       
   235 	return Constant(ENumberOfItemsInView);	
       
   236 	}
       
   237 
       
   238 // Fonts
       
   239 /**
       
   240  * Returns the menu pane annotation font.
       
   241  */
       
   242 inline const CFont* LafMenuPane::AnnotationFont(const MLafEnv& aLafEnv)
       
   243 	{//static	
       
   244 	return Font(aLafEnv, EAnnotation);	
       
   245 	}
       
   246 
       
   247 /**
       
   248  * Returns the menu pane normal font.
       
   249  */
       
   250 inline const CFont* LafMenuPane::NormalFont(const MLafEnv& aLafEnv)
       
   251 	{//static	
       
   252 	return Font(aLafEnv, ENormal);	
       
   253 	}
       
   254 
       
   255 /**
       
   256  * Returns the menu pane symbol font.
       
   257  */
       
   258 inline const CFont* LafMenuPane::SymbolFont(const MLafEnv& aLafEnv)
       
   259 	{//static	
       
   260 	return Font(aLafEnv, ESymbol);	
       
   261 	}
       
   262 
       
   263 
       
   264 
       
   265 #endif //__LAFMENUP_H__