crashanalysercmd/UI/Graphical/Menu/CAMenuItem.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 using System;
       
    19 using System.Text;
       
    20 using System.IO;
       
    21 using System.Collections.Generic;
       
    22 using System.Windows.Forms;
       
    23 using CrashAnalyserEngine.Interfaces;
       
    24 using SymbianUtils.Settings;
       
    25 
       
    26 namespace CrashAnalyser.Menu
       
    27 {
       
    28 	internal class CAMenuItem
       
    29 	{
       
    30 		#region Constructors
       
    31         public CAMenuItem( CAMenuManager aManager, string aCaption, UIMenuItemClickHandler aClickHandler, object aTag )
       
    32 		{
       
    33             iManager = aManager;
       
    34             iClickHandler = aClickHandler;
       
    35             iTag = aTag;
       
    36             //
       
    37             iItem = new ToolStripMenuItem( aCaption );
       
    38             iItem.Click += new EventHandler( Item_Click );
       
    39 		}
       
    40 		#endregion
       
    41 
       
    42 		#region API
       
    43         public void Activate()
       
    44         {
       
    45             iItem.Visible = true;
       
    46         }
       
    47 
       
    48         public void Deactivate()
       
    49         {
       
    50             iItem.Visible = false;
       
    51         }
       
    52         #endregion
       
    53 
       
    54 		#region Properties
       
    55 		#endregion
       
    56 
       
    57         #region Operators
       
    58         public static implicit operator ToolStripMenuItem( CAMenuItem aItem )
       
    59         {
       
    60             return aItem.iItem;
       
    61         }
       
    62         #endregion
       
    63 
       
    64         #region Event handlers
       
    65         private void Item_Click( object sender, EventArgs e )
       
    66         {
       
    67             if ( iClickHandler != null )
       
    68             {
       
    69                 iClickHandler( iTag, iItem.Text );
       
    70             }
       
    71         }
       
    72         #endregion
       
    73 
       
    74         #region Data members
       
    75         private readonly CAMenuManager iManager;
       
    76         private readonly object iTag;
       
    77         private readonly ToolStripMenuItem iItem;
       
    78         private readonly UIMenuItemClickHandler iClickHandler;
       
    79 		#endregion
       
    80     }
       
    81 }