⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socketsappview.h

📁 Symbian 手机网络通信程序 sockets-vc
💻 H
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */


#ifndef __SOCKETSAPPVIEW_H__
#define __SOCKETSAPPVIEW_H__

// INCLUDES
#include <coecntrl.h>
#include "UINotifier.h"

// CONSTANTS
const TInt KLabelPositionX = 10;
const TInt KLabelPositionY = 10;
const TInt KLabelWidth = 150;
const TInt KLabelHeight = 20;
const TInt KOutputPositionX = 10;
const TInt KOutputPositionY = 35;
const TInt KOutputWidth = 150;
const TInt KOutputHeight = 100;

// FORWARD DECLARATIONS
class CEikRichTextEditor;
class CEikLabel;

// CLASS DECLARATION
/**
* CSocketsAppView
*  An instance of the Application View object for the Sockets
*  example application.
*/
class CSocketsAppView : public CCoeControl, public MUINotifier
    {
    public: // Constructors and destructors

        /**
        * NewL.
        * Two-phased constructor.
        * Creates a CSocketsAppView object, which will draw itself to aRect.
        * @param aRect The rectangle this view will be drawn to.
        * @return A pointer to the created instance of CSocketsAppView.
        */
        static CSocketsAppView* NewL( const TRect& aRect );

        /**
        * NewLC.
        * Two-phased constructor.
        * Creates a CSocketsAppView object, which will draw itself to aRect.
        * @param aRect The rectangle this view will be drawn to.
        * @return A pointer to the created instance of CSocketsAppView.
        */
        static CSocketsAppView* NewLC( const TRect& aRect );

        /**
        * ~CSocketsAppView.
        * Destructor.
        * Destroys the object and release all memory objects.
        */
        virtual ~CSocketsAppView();

    public: // New functions

        /**
        * ClearText.
        * Clear contents of editor window.
        */
        void ClearTextL();

    public: // Functions from base classes

        /**
        * From CCoeControl, Draw.
        * Draws this CSocketsAppView to the screen.
        * @param aRect The rectangle of this view that needs updating.
        */
        void Draw( const TRect& aRect ) const;

        /**
        * From CCoeControl, CountComponentControls.
        * Determines number of component controls.
        * @return The number of component controls.
        */
        TInt CountComponentControls() const;

        /**
        * From CCoeControl, ComponentControl.
        * Gets handle to a component control.
        * @param aIndex Index number of the control.
        * @return Handle of the control.
        */
        CCoeControl* ComponentControl( TInt aIndex ) const;

        /**
        * From CCoeControl, KeyEventL.
        * Handles a key event.
        * @param aCode A keycode.
        */
        void KeyEventL( TInt aCode );

        /**
        * From MUINotifier, PrintNotify.
        * Displays text on console.
        * @param aDes Text to display.
        * @param aFontStyle Style ( italic/bold/etc ) for this text.
        */
        void PrintNotify( const TDesC& aDes, TUint aFontStyle = 0 );

        /**
        * From MUINotifier, PrintNotify.
        * Displays text on console.
        * @param aDes Text to display.
        * @param aFontStyle Style ( italic/bold/etc ) for this text.
        */
        void PrintNotify( const TDesC8& aDes, TUint aFontStyle = 0 );

        /**
        * From MUINotifier, ErrorNotify.
        * Notifies user of an error.
        * @param aErrMessage Message associated with error.
        * @param aErrCode Error code.
        */
        void ErrorNotify( const TDesC& aErrMessage, TInt aErrCode );

        /**
        * From MUINotifier, SetStatus.
        * Changes 'status' display.
        * @param aStatus New status text to display.
        */
        void SetStatus( const TDesC& aStatus );

    private: // Constructors and destructors

        /**
        * CSocketsAppView.
        * C++ default constructor.
        * Performs the first phase of two phase construction.
        */
        CSocketsAppView();

        /**
        * ConstructL.
        * Performs the second phase construction of a CSocketsAppView object.
        * @param aRect The rectangle this view will be drawn to.
        */
        void ConstructL( const TRect& aRect );

    private: // New functions

        /**
        * SetFontStyle.
        * Changes font style for subsequent text.
        * @param aFontStyle New font style.
        */
        void SetFontStyle( TUint aFontStyle );

        /**
        * UpdateFontAttribute.
        * Set or clear an individual font attribute if necessary,
        * so that it matches the required style.
        * @param aFontStyle Required font style.
        * @param aAttribute The individual attribute to correct.
        */
        void UpdateFontAttribute( TUint aFontStyle, TInt aAttribute );

    private: // Data

        /**
        * iOutputWindow, object for use as our output window.
        * Owned by CCSAsyncAppView object.
        */
        CEikRichTextEditor* iOutputWindow;

        /**
        * iStatusWindow, single line of text to display connection status.
        * Owned by CCSAsyncAppView object.
        */
        CEikLabel* iStatusWindow;

        /**
        * iFontStyle, current style in use by output window.
        */
        TUint iFontStyle;
    };


#endif // __SOCKETSAPPVIEW_H__

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -