textrendering/textformatting/inc/FRMFRAME.H
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 1997-2009 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 __FRMFRAME_H__
       
    20 #define __FRMFRAME_H__
       
    21 
       
    22 #include <w32std.h>
       
    23 
       
    24 /** A rectangular frame surrounding a picture with eight smaller, square areas
       
    25 (referred to as blobs) for moving and resizing the picture. A blob is located
       
    26 on each corner and at the centre of each side.
       
    27 
       
    28 Each blob has a visible width and an active width. The active width allows
       
    29 easier manipulation of picture frames because the blobs may be small and difficult
       
    30 to manipulate with a pen. The active width should be set to be at least as
       
    31 large as the visible width.
       
    32 
       
    33 A picture frame also has a set of flags which are used when drawing the frame.
       
    34 These control the frame border visibility, whether blobs should be drawn inside
       
    35 or outside the frame and whether the blobs should be filled using a solid
       
    36 brush style or using a NULL brush style, causing them to appear dimmed. For
       
    37 more information on brush styles. see CGraphicsContext::TBrushStyle.
       
    38 @publishedAll
       
    39 @released
       
    40 */
       
    41 class TFrameOverlay
       
    42 
       
    43     {
       
    44 public:
       
    45 /** This enumeration is used by CTextView::SetXyPosL() and by TFrameOverlay::XyPosToEdges()
       
    46 to identify which active region of the picture frame a pixel position is in. */
       
    47 enum TEdges
       
    48 	{
       
    49 	/** Not in an active region. */
       
    50 	ENoEdges=0x00,
       
    51 	/** In active region around left edge. */
       
    52 	EEdgeLeft=0x01,
       
    53 	/** In active region around right edge. */
       
    54 	EEdgeRight=0x02,
       
    55 	/** In active region around top edge. */
       
    56 	EEdgeTop=0x04,
       
    57 	/** In active region around bottom edge. */
       
    58 	EEdgeBottom=0x08
       
    59 	};
       
    60 
       
    61 /** Frame appearance flags. */
       
    62 enum TFrameOverlayFlags
       
    63 	{
       
    64 	/** Controls whether blobs are drawn inside or outside the frame border. */
       
    65 	EFrameOverlayFlagBlobsInternal=0x01,
       
    66 	/** Controls whether the frame border is drawn or not. */
       
    67 	EFrameOverlayFlagShowBorder=0x02,
       
    68 	/** Controls whether the three blobs at the top of the frame are drawn dimmed. */
       
    69 	EFrameOverlayFlagTopBlobsDimmed=0x04,
       
    70 	/** Controls whether the three blobs at the bottom of the frame are drawn dimmed. */
       
    71 	EFrameOverlayFlagBottomBlobsDimmed=0x08,
       
    72 	/** Controls whether the three blobs on the left hand side of the frame are drawn
       
    73 	dimmed. */
       
    74 	EFrameOverlayFlagLeftBlobsDimmed=0x10,
       
    75 	/** Controls whether the three blobs on the right hand side of the frame are drawn
       
    76 	dimmed. */
       
    77 	EFrameOverlayFlagRightBlobsDimmed=0x20
       
    78 	};
       
    79 public:
       
    80 	IMPORT_C TFrameOverlay();
       
    81     IMPORT_C void SetBlobWidthInPixels(const TInt aWidth); //sets visible and active blob width
       
    82     IMPORT_C void SetVisibleBlobWidthInPixels(const TInt aWidth); //default zero
       
    83     IMPORT_C void SetActiveBlobWidthInPixels(const TInt aWidth); // default zero
       
    84 	IMPORT_C void SetFlags(TInt aFlag);
       
    85     IMPORT_C void ClearFlags(TInt aFlag);
       
    86     IMPORT_C void SetRect(const TRect& aRect);
       
    87     IMPORT_C void XorDraw(CGraphicsContext& aGc) const;
       
    88     IMPORT_C TInt XyPosToEdges(const TPoint& aPos) const;
       
    89     inline TRect Rect() const;		// deprecated
       
    90     inline const TRect& RefRect() const;
       
    91     inline TInt Flags() const;
       
    92 private:
       
    93 	TInt VisibleBlobWidth() const;
       
    94 	TInt ActiveMarginWidth() const;
       
    95 	TBool DrawLeftAndRight() const;
       
    96 	TBool DrawTopAndBottom() const;
       
    97 	void DrawDottedRectangle(CGraphicsContext& aGc,const TRect& aRect) const;
       
    98 private:
       
    99     TInt iFlags;
       
   100     TInt iVisibleBlobWidth;
       
   101 	TInt iActiveBlobWidth;
       
   102 	TRect iRect;
       
   103     };
       
   104 
       
   105 /** @deprecated */	
       
   106 inline TRect TFrameOverlay::Rect() const
       
   107 	{
       
   108 	return(iRect);
       
   109 	}
       
   110 
       
   111 inline const TRect& TFrameOverlay::RefRect() const
       
   112 	{
       
   113 	return(iRect);
       
   114 	}
       
   115 
       
   116 TInt TFrameOverlay::Flags() const
       
   117 	{
       
   118 	return(iFlags);
       
   119 	}
       
   120 
       
   121 #endif