diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/txtexamp_8h-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/txtexamp_8h-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ - -
-00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). -00002 // All rights reserved. -00003 // This component and the accompanying materials are made available -00004 // under the terms of "Eclipse Public License v1.0" -00005 // which accompanies this distribution, and is available -00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". -00007 // -00008 // Initial Contributors: -00009 // Nokia Corporation - initial contribution. -00010 // -00011 // Contributors: -00012 // -00013 // Description: -00014 // -00015 -00016 #ifndef __TXTEXAMP_H -00017 #define __TXTEXAMP_H -00018 -00019 #include <coemain.h> -00020 #include <coecntrl.h> -00021 #include <s32file.h> -00022 #include <txtglobl.h> -00023 #include <frmtview.h> -00024 #include <txtfmlyr.h> -00025 -00026 // -00027 // class MGraphicsExampleObserver -00028 // -00029 -00030 class MGraphicsExampleObserver -00031 // Defines an interface that controls can call to inform the shell -00032 // that they have finished, or that the status message display needs -00033 // updating. It is implemented by CExampleShellContainer -00034 { -00035 public: -00036 // Notify user that example has finished -00037 virtual void NotifyGraphicExampleFinished()=0; -00038 // Notify user of the current status of the example -00039 virtual void NotifyStatus(const TDesC& aMessage)=0; -00040 }; -00041 -00042 // -00043 // class CGraphicExampleControl -00044 // -00045 -00046 /* -00047 Usage -00048 -00049 This class is used as a base class for graphics and text -00050 examples. It uses CONE's facilities to provide an initialized -00051 graphics environment. -00052 -00053 It creates a 600x200 window in which drawing can be done. -00054 -00055 It supports multiple phases, so different drawings can be -00056 done from one phase to another. Tap the spacebar or click the -00057 mouse (anywhere) to advance a phase. -00058 -00059 Quit the program by pressing the exit button. -00060 -00061 Writing derived classes -00062 -00063 A minimal derived class should have a Draw() function -00064 which puts a drawing onto the screen. -00065 -00066 If you are using multiple phases, code a constructor which -00067 calls SetMaxPhases() specifying the number of phases. Have -00068 Draw() honour the phase number, available using Phase(). -00069 */ -00070 -00071 #pragma warning(disable : 4100) -00072 // disable "parameter not used" warning on HandleKey() -00073 -00074 class CGraphicExampleControl : public CCoeControl -00075 { -00076 public: -00077 // construct/destruct -00078 void ConstructL(const TRect& aRect, MGraphicsExampleObserver* aObserver, const CCoeControl& aParent); -00079 // second-phase construction -00080 ~CGraphicExampleControl(); -00081 // public so container can offer keys -00082 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); -00083 // intercepts space; offers other keys to derived classes -00084 protected: -00085 // derived classes must provide the next 2 functions -00086 virtual void UpdateModelL() =0; // empty update model function -00087 virtual void Draw(const TRect& /* aRect */) const {}; // empty draw function -00088 // use Phase() in Draw() to tell what phase we're in -00089 TInt Phase() const { return iPhase; }; // get phase number -00090 void SetMaxPhases(TInt aMaxPhases) { iMaxPhases=aMaxPhases; }; -00091 // use this from derived-class constructor to set number of phases -00092 CFont* iMessageFont; // font for messages -00093 private: -00094 // functions provided for CCoeControl protocol -00095 void HandlePointerEventL(const TPointerEvent& aPointerEvent); -00096 // advances phase on pointer-down -00097 void Quit(); // does termination -00098 void NextPhaseL(); // advances phase: quits if all phases done -00099 // phase control for graphics examples -00100 TInt iPhase; // phase number -00101 TInt iMaxPhases; // maximum phases -00102 protected: -00103 MGraphicsExampleObserver* iFormObserver; -00104 TBool iUpdateModelDoesRedraw; // whether UpdateModelL() does a redraw for us -00105 }; -00106 -00107 // sundry derived classes -00108 -00109 class CGlobalText; -00110 class CRichText; -00111 class CParaFormatLayer; -00112 class CCharFormatLayer; -00113 class CTextLayout; -00114 class CTextView; -00115 class CStyleList; -00116 class CParagraphStyle; -00117 -00118 -00119 class CGlobalControl : public CGraphicExampleControl -00120 { -00121 // Demonstrates the use of global text -00122 public: -00123 CGlobalControl() { SetMaxPhases(16); }; -00124 void UpdateModelL(); -00125 void Draw(const TRect& aRect) const; -00126 ~CGlobalControl(); -00127 private: -00128 CGlobalText* iGlobalText; // global text object -00129 CParaFormatLayer* iParaFormatLayer; -00130 CCharFormatLayer* iCharFormatLayer; -00131 TStreamId iStreamId; // required when storing and restoring global text -00132 // text layout and view stuff -00133 CTextLayout* iLayout; // text layout -00134 CTextView* iTextView; // text view -00135 TRect iViewRect; // rectangle through which to view text -00136 TCharFormat iCharFormat; -00137 TCharFormatMask iCharFormatMask; -00138 }; -00139 -00140 class CRichControl : public CGraphicExampleControl -00141 { -00142 // Demonstrates the use of rich text -00143 public: -00144 CRichControl() { SetMaxPhases(14);}; -00145 ~CRichControl(); // destructor -00146 void UpdateModelL(); -00147 void Draw(const TRect& aRect) const; -00148 private: -00149 CRichText* iRichText; // global text object -00150 CParaFormatLayer* iParaFormatLayer; -00151 CCharFormatLayer* iCharFormatLayer; -00152 TStreamId iStreamId; // required when storing and restoring global text -00153 // text layout and view stuff -00154 CTextLayout* iLayout; // text layout -00155 CTextView* iTextView; // text view -00156 TRect iViewRect; // rectangle through which to view text -00157 TCharFormat iCharFormat; -00158 TCharFormatMask iCharFormatMask; -00159 }; -00160 -00161 class CStyleControl : public CGraphicExampleControl -00162 { -00163 // Demonstrates the use of styles in rich text -00164 public: -00165 CStyleControl() { SetMaxPhases(9);}; -00166 ~CStyleControl(); // destructor -00167 void UpdateModelL(); -00168 void Draw(const TRect& aRect) const; -00169 private: -00170 void CreateNormalL(); // Create Normal style (the global layers) -00171 void CreateStylesL(); // Create some paragraph styles -00172 private: -00173 CRichText* iRichText; // rich text object -00174 CParaFormatLayer* iNormalParaFormatLayer; -00175 CCharFormatLayer* iNormalCharFormatLayer; -00176 TStreamId iStreamId; // required when storing and restoring global text -00177 // text layout and view stuff -00178 CTextLayout* iLayout; // text layout -00179 CTextView* iTextView; // text view -00180 TRect iViewRect; // rectangle through which to view text -00181 CStyleList* iStyleList; // Style list holds the two styles -00182 CParagraphStyle* iStyleOne; -00183 CParagraphStyle* iStyleTwo; -00184 TCharFormat iCharFormat; -00185 TCharFormatMask iCharFormatMask; -00186 }; -00187 -00188 class CViewControl : public CGraphicExampleControl -00189 { -00190 // Demonstrates the use of the text view and text layout classes -00191 public: -00192 CViewControl() { SetMaxPhases(14);}; -00193 ~CViewControl(); -00194 void UpdateModelL(); -00195 void Draw(const TRect& aRect) const; -00196 private: -00197 CRichText* iRichText; // rich text object -00198 CParaFormatLayer* iParaFormatLayer; -00199 CCharFormatLayer* iCharFormatLayer; -00200 // text layout and view stuff -00201 CTextLayout* iLayout; // text layout -00202 CTextView* iTextView; // text view -00203 TRect iViewRect; // rectangle through which to view text -00204 CFbsBitmap* iBitmap; // line cursor bitmap -00205 TCharFormat iCharFormat; -00206 TCharFormatMask iCharFormatMask; -00207 }; -00208 -00209 #endif -00210 -