sysperfana/heapanalyser/Libraries/UI/HeapCtrlLib/Factories/FactoryRenderers.cs
changeset 8 15296fd0af4a
equal deleted inserted replaced
7:8e12a575a9b5 8:15296fd0af4a
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * Redistribution and use in source and binary forms, with or without
       
     6 * modification, are permitted provided that the following conditions are met:
       
     7 *
       
     8 * - Redistributions of source code must retain the above copyright notice,
       
     9 *   this list of conditions and the following disclaimer.
       
    10 * - Redistributions in binary form must reproduce the above copyright notice,
       
    11 *   this list of conditions and the following disclaimer in the documentation
       
    12 *   and/or other materials provided with the distribution.
       
    13 * - Neither the name of Nokia Corporation nor the names of its contributors
       
    14 *   may be used to endorse or promote products derived from this software
       
    15 *   without specific prior written permission.
       
    16 *
       
    17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
       
    18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
       
    21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
       
    22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
       
    23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
       
    24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
       
    25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
       
    26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
       
    27 * POSSIBILITY OF SUCH DAMAGE.
       
    28 * 
       
    29 * Initial Contributors:
       
    30 * Nokia Corporation - initial contribution.
       
    31 *
       
    32 * Contributors:
       
    33 *
       
    34 * Description: 
       
    35 *
       
    36 */
       
    37 
       
    38 using System;
       
    39 using System.Drawing;
       
    40 using HeapCtrlLib.Interfaces;
       
    41 using HeapCtrlLib.Types;
       
    42 using HeapCtrlLib.Utilities;
       
    43 using HeapLib.Cells;
       
    44 using HeapLib.Array;
       
    45 using HeapLib.Reconstructor;
       
    46 using HeapCtrlLib.Renderers;
       
    47 
       
    48 namespace HeapCtrlLib.Factories
       
    49 {
       
    50     internal class FactoryRenderers
       
    51     {
       
    52         #region Constructors
       
    53         public FactoryRenderers()
       
    54         {
       
    55         }
       
    56         #endregion
       
    57 
       
    58         #region API
       
    59         public void Initialise( HeapCellArray aCells, HeapReconstructor aReconstructor, HeapDataRenderer aRenderer )
       
    60         {
       
    61             SelectionBorder.Initialise( aCells, aReconstructor, aRenderer );
       
    62             Header.Initialise( aCells, aReconstructor, aRenderer );
       
    63             Content.Initialise( aCells, aReconstructor, aRenderer );
       
    64             ContentBorder.Initialise( aCells, aReconstructor, aRenderer );
       
    65         }
       
    66 
       
    67         public void PrepareToNavigate( HeapRenderingNavigator aNavigator )
       
    68         {
       
    69             SelectionBorder.PrepareToNavigate( aNavigator );
       
    70             Header.PrepareToNavigate( aNavigator );
       
    71             Content.PrepareToNavigate( aNavigator );
       
    72             ContentBorder.PrepareToNavigate( aNavigator );
       
    73         }
       
    74 
       
    75         public void RenderingComplete( Graphics aGraphics )
       
    76         {
       
    77             SelectionBorder.RenderingComplete( aGraphics );
       
    78             Header.RenderingComplete( aGraphics );
       
    79             Content.RenderingComplete( aGraphics );
       
    80             ContentBorder.RenderingComplete( aGraphics );
       
    81         }
       
    82 
       
    83         public void HeapCellRenderingComplete( Graphics aGraphics, HeapCell aCell, HeapCellMetaData aMetaData )
       
    84         {
       
    85             SelectionBorder.HeapCellRenderingComplete( aGraphics, aCell, aMetaData );
       
    86             Header.HeapCellRenderingComplete( aGraphics, aCell, aMetaData );
       
    87             Content.HeapCellRenderingComplete( aGraphics, aCell, aMetaData );
       
    88             ContentBorder.HeapCellRenderingComplete( aGraphics, aCell, aMetaData );
       
    89         }
       
    90         
       
    91         public bool CheckIfAnyItemsInvalid()
       
    92         {
       
    93             bool invalid = ( iHeader == null || iBorderContent == null || iBorderSelection == null || iContent == null );
       
    94             return invalid;
       
    95         }
       
    96         #endregion
       
    97 
       
    98         #region Properties
       
    99         public IHeapCellRendererRowHeader Header
       
   100         {
       
   101             get { return iHeader; }
       
   102             set { iHeader = value; }
       
   103         }
       
   104 
       
   105         public IHeapCellRendererSelectionBorder SelectionBorder
       
   106         {
       
   107             get { return iBorderSelection; }
       
   108             set { iBorderSelection = value; }
       
   109         }
       
   110 
       
   111         public IHeapCellRendererContent Content
       
   112         {
       
   113             get { return iContent; }
       
   114             set { iContent = value; }
       
   115         }
       
   116 
       
   117         public IHeapCellRendererContentBorder ContentBorder
       
   118         {
       
   119             get { return iBorderContent; }
       
   120             set { iBorderContent = value; }
       
   121         }
       
   122         #endregion
       
   123 
       
   124         #region Data members
       
   125         private IHeapCellRendererRowHeader iHeader;
       
   126         private IHeapCellRendererSelectionBorder iBorderSelection;
       
   127         private IHeapCellRendererContent iContent;
       
   128         private IHeapCellRendererContentBorder iBorderContent;
       
   129         #endregion
       
   130     }
       
   131 }