symhelp/helpmodel/tsrc/THelpView.h
changeset 0 1f04cf54edd8
equal deleted inserted replaced
-1:000000000000 0:1f04cf54edd8
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __THELPVIEW_H__
       
    17 #define __THELPVIEW_H__
       
    18 
       
    19 // System includes
       
    20 #include <coecntrl.h>
       
    21 #include <coecobs.h>
       
    22 #include <eikappui.h>
       
    23 #include <eikapp.h>
       
    24 #include <eikdoc.h>
       
    25 #include "hlpmodel.h"
       
    26 #include <techview/eikon.hrh>
       
    27 
       
    28 // Constants
       
    29 const TUid KUidHelpViewApp		= { 0x100068D3 };
       
    30 const TInt KNumberOfZoomStates	= 3;
       
    31 
       
    32 // Classes referenced
       
    33 class CHlpModel;
       
    34 class CEikRichTextEditor;
       
    35 class CEikChoiceList;
       
    36 class CHlpAppUi;
       
    37 // 
       
    38 class CHlpListBox;
       
    39 class CHlpSearchPrompt;
       
    40 
       
    41 
       
    42 //
       
    43 // ----> MZoomableControl (header)
       
    44 //
       
    45 class MZoomableControl
       
    46 	{
       
    47 //
       
    48 public: // ZOOM ENUM
       
    49 //
       
    50 	enum TZoomEvent
       
    51 		{
       
    52 		EEventZoomIn = EEikCmdZoomIn,
       
    53 		EEventZoomOut = EEikCmdZoomOut,
       
    54 		EEventZoomDefault
       
    55 		};
       
    56 
       
    57 //
       
    58 public:
       
    59 //
       
    60 	virtual void HandleZoomEventL(TZoomEvent aEvent) = 0;
       
    61 	};
       
    62 
       
    63 
       
    64 
       
    65 
       
    66 
       
    67 
       
    68 //
       
    69 // ----> CHlpView (header)
       
    70 //
       
    71 class CHlpView : public CCoeControl, public MCoeControlObserver, public MHlpModelObserver, public MZoomableControl
       
    72     {
       
    73 //
       
    74 public: // ZOOM ENUMERATION
       
    75 //
       
    76 	enum TZoomStates
       
    77 		{
       
    78 		EZoomStateOne		= 750,
       
    79 		EZoomStateTwo		= TZoomFactor::EZoomOneToOne,
       
    80 		EZoomStateThree		= 1250
       
    81 		};
       
    82 
       
    83 //
       
    84 public: // CONSTRUCT / DESTRUCT
       
    85 //
       
    86 	CHlpView(CHlpAppUi& aAppUi, CHlpModel& aModel);
       
    87 	~CHlpView();
       
    88 	void ConstructL();
       
    89 
       
    90 //
       
    91 public:	// NEW
       
    92 //
       
    93 	void PopulateCategoryListL();
       
    94 	void PopulateTopicListL(const TDesC& aTopic);
       
    95 	void UpdateEdwinL(const CHlpItem& aItem);
       
    96 
       
    97 //
       
    98 public: // FROM MZoomableControl
       
    99 //
       
   100 	void HandleZoomEventL(TZoomEvent aEvent);
       
   101 
       
   102 //
       
   103 public:	// FROM CCoeControl
       
   104 //
       
   105 	void SizeChanged();
       
   106 	TInt CountComponentControls() const;
       
   107 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   108 	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   109 
       
   110 //
       
   111 private: // FROM MCoeControlObserver
       
   112 //
       
   113 	void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
       
   114 
       
   115 //
       
   116 private: // FROM MHlpModelObserver
       
   117 //
       
   118 	void HandleModelEventL(TInt aEvent);
       
   119 
       
   120 //
       
   121 private: // FROM MPictureFactory
       
   122 //
       
   123 	void NewPictureL(TPictureHeader& aHdr,const CStreamStore& aDeferredPictureStore) const;
       
   124 
       
   125 //
       
   126 private: // FROM MRichTextStoreResolver
       
   127 //
       
   128 	const CStreamStore& StreamStoreL(TInt aPos) const;
       
   129 
       
   130 //
       
   131 private: // NEW INTERNAL
       
   132 //
       
   133 	static TInt ZoomForIndex(TInt aIndex);
       
   134 
       
   135 //
       
   136 private: // MEMBER DATA
       
   137 //
       
   138 	CCoeControl* iFocusedControl;
       
   139 
       
   140 	// Referenced
       
   141 	CHlpAppUi& iAppUi;
       
   142 	CHlpModel& iHelpModel;
       
   143 	
       
   144 	// Owned
       
   145 	TInt iLastResponseFromHelpModel;
       
   146 	TInt iCurrentZoom;
       
   147 	TZoomFactor iZoom;
       
   148 	CEikChoiceList* iHelpCategories;
       
   149 	CEikChoiceList* iHelpTopicsForCategory;
       
   150 	CEikRichTextEditor* iRichTextEditor;
       
   151 
       
   152 	CHlpList* iCurrentTopics;
       
   153 	CHlpTopic* iLastTopic;
       
   154     };
       
   155 
       
   156 
       
   157 
       
   158 
       
   159 
       
   160 
       
   161 
       
   162 
       
   163 
       
   164 //
       
   165 // ----> CHlpMainView (header)
       
   166 //
       
   167 class CHlpMainView : public CCoeControl, public MCoeControlObserver, public MHlpModelObserver
       
   168     {
       
   169 //
       
   170 public: // CONSTRUCT / DESTRUCT
       
   171 //
       
   172 	CHlpMainView(CHlpAppUi& aAppUi, CHlpModel& aModel);
       
   173 	~CHlpMainView();
       
   174 	void ConstructL();
       
   175 
       
   176 //
       
   177 public: // ACCESS
       
   178 //
       
   179 	TBool IsSearchPromptVisible() const;
       
   180 	TBool IsSearchResultVisible() const;
       
   181 
       
   182 	void ShowSearchPrompt(TBool aShow);
       
   183 	void MakeResultsVisible(TBool aVisible);
       
   184 
       
   185 //
       
   186 public:	// FROM CCoeControl
       
   187 //
       
   188 	void SizeChanged();
       
   189 	TInt CountComponentControls() const;
       
   190 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   191 	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   192 
       
   193 //
       
   194 public:	// FROM MCoeControlObserver
       
   195 //
       
   196 	void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
       
   197 
       
   198 //
       
   199 public:	// FROM MHlpModelObserver
       
   200 //
       
   201 	void HandleModelEventL(TInt aEvent);
       
   202 
       
   203 //
       
   204 public: // INTERNAL
       
   205 //
       
   206 	void DoSearchL();
       
   207 	
       
   208 //
       
   209 private: // MEMBER DATA
       
   210 //
       
   211 	// Referenced
       
   212 	CHlpAppUi& iAppUi;
       
   213 	CHlpModel& iModel;
       
   214 
       
   215 	// Owned
       
   216 	TInt iLastHelpModelResponse;
       
   217 	CHlpView* iView;
       
   218 	CHlpListBox* iSearchResults;
       
   219 	CHlpSearchPrompt* iSearchPrompt;
       
   220 	};
       
   221 
       
   222 
       
   223 
       
   224 
       
   225 
       
   226 
       
   227 
       
   228 
       
   229 
       
   230 //
       
   231 // ----> CHlpAppUi (header)
       
   232 //
       
   233 class CHlpDocument : public CEikDocument
       
   234 	{
       
   235 //
       
   236 public:
       
   237 //
       
   238 	CHlpDocument(CEikApplication& aApp);
       
   239 	~CHlpDocument();
       
   240 
       
   241 	void NewDocumentL();
       
   242 	inline CHlpModel& Model() const { return *iModel; }
       
   243 	inline CHlpAppUi& AppUi() const;
       
   244 
       
   245 //
       
   246 private: // FROM CEikDocument
       
   247 //
       
   248 	CEikAppUi* CreateAppUiL();
       
   249 
       
   250 //
       
   251 private: // MEMBER DATA
       
   252 //
       
   253 	CHlpModel* iModel;
       
   254 	};
       
   255 
       
   256 
       
   257 
       
   258 
       
   259 
       
   260 
       
   261 
       
   262 
       
   263 //
       
   264 // ----> CHlpApplication (header)
       
   265 //
       
   266 class CHlpApplication : public CEikApplication
       
   267 	{
       
   268 //
       
   269 private: // FROM CEikApplication - pure virutal
       
   270 //
       
   271 	CApaDocument* CreateDocumentL();
       
   272 	// FROM CApaApplication - pure virutal	
       
   273 	TUid AppDllUid() const;
       
   274 	};
       
   275 
       
   276 
       
   277 
       
   278 
       
   279 
       
   280 
       
   281 
       
   282 
       
   283 //
       
   284 // ----> CHlpAppUi (header)
       
   285 //
       
   286 class CHlpAppUi : public CEikAppUi
       
   287     {
       
   288 //
       
   289 public:
       
   290 //
       
   291 	~CHlpAppUi();
       
   292     void ConstructL();
       
   293 
       
   294 	inline CHlpDocument& Document() const	{ return *STATIC_CAST(CHlpDocument*, iDocument); }
       
   295 	inline CHlpMainView& View() const		{ return *iView; }
       
   296 	inline void SetZoomHandler(MZoomableControl* aZoomableControl) { iZoomHandler = aZoomableControl; }
       
   297 
       
   298 //
       
   299 private: // FROM CEikAppUi
       
   300 //
       
   301 	void HandleCommandL(TInt aCommand);
       
   302 	void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane);
       
   303 
       
   304 //
       
   305 private: // NEW
       
   306 //
       
   307 	void HandleZoomL(TInt aZoomEvent);
       
   308 
       
   309 //
       
   310 private: // MEMBER DATA
       
   311 //
       
   312 	CHlpMainView* iView;
       
   313 	MZoomableControl* iZoomHandler;
       
   314 	};
       
   315 
       
   316 
       
   317 
       
   318 
       
   319 inline CHlpAppUi& CHlpDocument::AppUi() const
       
   320 	{
       
   321 	return *STATIC_CAST(CHlpAppUi*, iAppUi); 
       
   322 	}
       
   323 
       
   324 
       
   325 #endif