sdkcreationmw/sdkruntimes/MIDP/DebugAgent/src/JavaDebugAgentLogScreen.h
changeset 0 b26acd06ea60
equal deleted inserted replaced
-1:000000000000 0:b26acd06ea60
       
     1 /*
       
     2 * Copyright (c) 2006 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 
       
    19 #ifndef __JAVA_DEBUG_AGENT_LOG_SCREEN_H_
       
    20 #define __JAVA_DEBUG_AGENT_LOG_SCREEN_H_
       
    21 
       
    22 #include <coecntrl.h>
       
    23 #include <txtglobl.h>
       
    24 #include <frmtview.h>
       
    25 #include <txtfmlyr.h>
       
    26 #include <txtrich.h>
       
    27 #include "JavaDebugAgentLog.h"
       
    28 
       
    29 class CAknsBasicBackgroundControlContext;
       
    30 class CJavaDebugAgentBasicLogView;
       
    31 class CJavaDebugAgentLogScreen :
       
    32     public CCoeControl, 
       
    33     public MJavaDebugAgentLog,
       
    34     TDesOverflow
       
    35 {
       
    36 private:
       
    37     RFs iFs;
       
    38     RFile iLogFile;
       
    39     HBufC* iLogFileName;
       
    40     CEikScrollBarFrame* iSBFrame;
       
    41     TRect iViewRect;
       
    42     TRect iTextRect;
       
    43     RRegion iTextClipRegion;
       
    44     CGlobalText* iGlobalText;
       
    45     CJavaDebugAgentBasicLogView* iView;
       
    46     TCharFormat iCharFormat;
       
    47     TCharFormatMask iCharFormatMask;
       
    48     CCharFormatLayer* iCharFormatLayer;
       
    49     CParaFormat iParaFormat;
       
    50     TParaFormatMask iParaFormatMask;
       
    51     CParaFormatLayer* iParaFormatLayer;
       
    52     TInt iDefaultFontHeightInTwips;
       
    53     TInt iFontSize;
       
    54     CTextLayout* iLayout;
       
    55     CTextView* iTextView;
       
    56     TInt iLineCounter;
       
    57     CAknsBasicBackgroundControlContext* iBgContext;
       
    58     CFbsBitmap* iBgBitmap;
       
    59     CFbsBitmap* iBgMask;
       
    60 
       
    61 public:
       
    62     static CJavaDebugAgentLogScreen* NewL(CJavaDebugAgentBasicLogView* aView,
       
    63         const TRect& aRect);
       
    64     virtual ~CJavaDebugAgentLogScreen();
       
    65 
       
    66 public:
       
    67     void ClearLog();
       
    68     void SetLogFile(const TDesC* aFileName);
       
    69     void SetFontSize(TInt aFontSize);
       
    70 
       
    71     // CCoeControl
       
    72     virtual void Draw(const TRect& aRect) const;
       
    73     virtual void SizeChanged();
       
    74     virtual TInt CountComponentControls() const;
       
    75     virtual CCoeControl* ComponentControl(TInt aIndex) const;
       
    76     virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
    77     virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
    78         TEventCode aType);
       
    79 
       
    80     // MJavaDebugAgentLog
       
    81     virtual void Log(const TText* aString);
       
    82     virtual void LogFormat(const TText* aFormat, ...);
       
    83 
       
    84 private:
       
    85 
       
    86     // TDesOverflow
       
    87     virtual void Overflow(TDes& aDes);
       
    88 
       
    89 private:
       
    90     CJavaDebugAgentLogScreen(CJavaDebugAgentBasicLogView* aView);
       
    91     void ConstructL(const TRect& aRect);
       
    92     void LogToScreenL(const TDesC& aPrefix, const TDesC& aText);
       
    93     void LogToFileL(const TDesC& aPrefix, const TDesC& aText);
       
    94     void LogL(const TDesC& aString);
       
    95     void LogFormatToScreen(const TText* aFormat, ...);
       
    96     void FormatPrefixL(TDes& aPrefix);
       
    97     void FormatAndScrollL();
       
    98     void SetLogFileL(const TDesC* aFileName);
       
    99     void SetFontSizeL(TInt aFontSize);
       
   100 
       
   101     static CFbsBitmap* CreateBackgroundBitmapLC(const TSize& aSize,
       
   102         TRgb aBgColor, TRgb aFillColor, TRgb aBorderColor, TRgb aShadowColor);
       
   103     static void DrawBackground(CBitmapContext* aGc, const TRect& aRect,
       
   104         TRgb aBgColor, TRgb aFillColor, TRgb aBorderColor, TRgb aShadowColor);
       
   105 
       
   106     TBool UpdateFontSizeL(TInt aFontSize);
       
   107     void UpdateSBModel(TEikScrollBarModel* aModel) const;
       
   108     void UpdateScrollBars(TBool aDrawNow);
       
   109     void SizeChangedL();
       
   110     void DoLayoutL();
       
   111     void CloseLogFile();
       
   112     void ClearL();
       
   113 };
       
   114 
       
   115 #endif // __JAVA_DEBUG_AGENT_LOG_SCREEN_H_
       
   116 
       
   117 /**
       
   118  * Local Variables:
       
   119  * mode: c++
       
   120  * c-basic-offset: 4
       
   121  * indent-tabs-mode: nil
       
   122  * End:
       
   123  */