DirectPrint/DirectPrintApp/ui/inc/directprintlistbox.h
changeset 19 2275db202402
parent 11 613a5ff70823
equal deleted inserted replaced
2:acc370d7f2f6 19:2275db202402
       
     1 /*
       
     2 * Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "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 * Kanrikogaku Kenkyusho, Ltd. - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * {Description of the file}
       
    16 *
       
    17 */
       
    18 
       
    19 // Protection against nested includes
       
    20 #ifndef __DIRECTPRINTLISTBOX_H__
       
    21 #define __DIRECTPRINTLISTBOX_H__
       
    22 
       
    23 // System includes
       
    24 #include <aknlists.h>
       
    25 
       
    26 // User includes
       
    27 #include "DirectPrintListObserver.h"
       
    28 
       
    29 // Class declaration
       
    30 /**
       
    31  *  Listbox class
       
    32  *  more_complete_description
       
    33  */
       
    34 class CDirectPrintListBox : public CCoeControl, public MEikListBoxObserver
       
    35 	{
       
    36 public:
       
    37 	// Data types
       
    38 	/** The index of controls */
       
    39 	enum TControls
       
    40 		{
       
    41 		EListBox = 0,
       
    42 		ELastControl
       
    43 		};
       
    44 
       
    45 public:
       
    46 	/** Constructors */
       
    47 	static CDirectPrintListBox* NewL(const TRect& aRect, CDesCArray* aItemArray);
       
    48 	static CDirectPrintListBox* NewLC(const TRect& aRect, CDesCArray* aItemArray);
       
    49 	/** Destructor */
       
    50 	virtual ~CDirectPrintListBox();
       
    51 
       
    52 public:
       
    53 	/**
       
    54 	 * From CCoeControl.
       
    55 	 * Get count of component controls.
       
    56 	 *
       
    57 	 * @return Count of component controls.
       
    58 	 */
       
    59 	TInt CountComponentControls() const;
       
    60 	/**
       
    61 	 * From CCoeControl.
       
    62 	 * Get component controls.
       
    63 	 *
       
    64 	 * @param aIndex The index of controls
       
    65 	 * @return Component control.
       
    66 	 */
       
    67 	CCoeControl* ComponentControl( TInt aIndex ) const;
       
    68 
       
    69 public:
       
    70 	/**
       
    71 	 * From MEikListBoxObserver.
       
    72 	 * Handles listbox events.
       
    73 	 *
       
    74 	 * @param aListBox Pointer to listbox control.
       
    75 	 * @param aEventType Event type.
       
    76 	 */
       
    77 	void HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType);
       
    78 
       
    79 public: // New Function
       
    80 	/**
       
    81 	 * Set listbox items.
       
    82 	 *
       
    83 	 * @param aItemArray Pointer to item array.
       
    84 	 */
       
    85 	void SetItemL(CDesCArray* aItemArray);
       
    86 	/**
       
    87 	 * Set list observer.
       
    88 	 *
       
    89 	 * @param aObserver Pointer to list observer.
       
    90 	 */
       
    91 	void SetListObserver(MDirectPrintListObserver* aObserver);
       
    92 	/**
       
    93 	 * Delete current item from listbox.
       
    94 	 *
       
    95 	 * @return Result value.
       
    96 	 */
       
    97 	TInt DeleteCurrentItemL();
       
    98 	/**
       
    99 	 * redraw listbox.
       
   100 	 */
       
   101 	void RedrawListL();
       
   102 	/**
       
   103 	 * Get the index of current item.
       
   104 	 *
       
   105 	 * @return The index of current listbox item.
       
   106 	 */
       
   107 	TInt CurrentIndex();
       
   108 	/**
       
   109 	 * Set focus.
       
   110 	 *
       
   111 	 * @param aIndex The index of listbox item
       
   112 	 */
       
   113 	void SetFocusL(TInt aIndex);
       
   114 
       
   115 private:
       
   116 	CDirectPrintListBox();
       
   117 	void ConstructL(const TRect& aRect, CDesCArray* aItemArray);
       
   118 
       
   119 	void InitializeControlsL();
       
   120 
       
   121 private:
       
   122 	/** Listbox control. */
       
   123 	CAknDoubleStyleListBox* iListBox;		// Owend Data
       
   124 	/** Pointer to list observer. */
       
   125 	MDirectPrintListObserver* iListObserver;
       
   126 	};
       
   127 
       
   128 #endif // __DIRECTPRINTLISTBOX_H__