www.pudn.com > wcore.rar > WebCoreWidget.h
/* * Copyright (c) 2005 Nokia Corporation, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Nokia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef MWEBCOREWIDGET_H_ #define MWEBCOREWIDGET_H_ // INCLUDES #include#include #include "WebCorePalette.h" // DATA TYPES typedef enum { EWebCoreScrollBarAuto, EWebCoreScrollBarAlwaysOff, EWebCoreScrollBarAlwaysOn } TWebCoreScrollBarMode; // FORWARD DECLARATIONS class MWebCoreScrollView; class QPainter; class CCoeControl; class MWebCoreInputWidget; class MWebCoreButtonWidget; class MWebCoreSelectWidget; class MWebCoreCheckBoxControl; class MWebCoreRadioButtonControl; class CWebCoreGraphicsContext; /** * interface, used by widget classes * @lib webcore.lib * @since 3.1 */ class MWebCoreWidget { public: virtual void Draw(CWebCoreGraphicsContext& /*aGc*/, const TRect& /*aRect*/) = 0; virtual TBool IsVisible() const = 0; virtual TRect Rect() const = 0; virtual TSize SizeHint() const = 0; virtual TBool IsFocused() const = 0; virtual void MakeVisible(TBool /*aVisible*/) = 0; virtual void SetFocus(TBool aFocus) = 0; virtual void SetRect(const TRect& aRect) = 0; virtual void Activate() = 0; virtual void SetParent( MWebCoreScrollView* aParent ) = 0; virtual void Close() = 0; virtual TBool IsScrollView() const { return EFalse; } virtual void SetPalette(TWebCorePalette) {} virtual void SetOutlineWidth(TUint8 ) {} virtual void SetWritingDirectionRtl(TBool) {} }; /** * interface, used by widget classes * @lib webcore.lib * @since 3.1 */ class MWebCoreScrollView: public MWebCoreWidget { public: TBool IsScrollView() const { return ETrue; } virtual TSize SizeHint() const { return TSize(); } virtual void Draw(CWebCoreGraphicsContext& /*aGc*/, const TRect& /*aRect*/) { } virtual void InvalidateRect(const TRect& /*aRect*/, TBool /*aDrawNow*/) = 0; virtual void ScrollTo(TPoint /*aPoint*/) = 0; virtual TRect VisibleRect() const = 0; virtual TSize ContentSize() const = 0; virtual void ResizeContent(TSize /*aSize*/) = 0; virtual void SetMayUseCopyScroll(TBool /*aCopy*/) = 0; virtual TPoint ConvertContentToView(TPoint /*aPoint*/) = 0; virtual TPoint ConvertViewToContent(TPoint /*aPoint*/) = 0; virtual TBool HasHorizontalScrollBar() const = 0; virtual TBool HasVerticalScrollBar() const = 0; virtual void SetHorizontalScrollingMode(TWebCoreScrollBarMode /*aScrollMode*/) = 0; virtual void SetVerticalScrollingMode(TWebCoreScrollBarMode /*aScrollMode*/) = 0; virtual void SetScrollingMode(TWebCoreScrollBarMode /*aScrollMode*/) = 0; virtual TWebCoreScrollBarMode HorizontalScrollingMode() = 0; virtual TWebCoreScrollBarMode VerticalScrollingMode() = 0; virtual void SetScrollBarsSuppressed(TBool /*aSuppressed*/, TBool /*aRepaintOnUnsuppress*/) = 0; virtual void AddChild(MWebCoreWidget* /*aChild*/, TInt /*aX*/ , TInt /*aY*/ ) = 0; virtual TInt ScalingFactor() const = 0; inline TPoint ToDocCoords(const TPoint& aFrom) const { TInt z = ScalingFactor(); return TPoint(aFrom.iX*100/z,aFrom.iY*100/z); } inline TSize ToDocCoords(const TSize& aFrom) const { TInt z = ScalingFactor(); return TSize(aFrom.iWidth*100/z,aFrom.iHeight*100/z); } inline TRect ToDocCoords(const TRect& aFrom) const { return TRect(ToDocCoords(aFrom.iTl),ToDocCoords(aFrom.iBr)); } inline TPoint ToViewCoords(const TPoint& aFrom) const { TInt z = ScalingFactor(); return TPoint(aFrom.iX*z/100,aFrom.iY*z/100); } inline TSize ToViewCoords(const TSize& aFrom) const { TInt z = ScalingFactor(); return TSize(aFrom.iWidth*z/100,aFrom.iHeight*z/100); } inline TRect ToViewCoords(const TRect& aFrom) const { return TRect(ToViewCoords(aFrom.iTl),ToViewCoords(aFrom.iBr)); } inline TBool IsScaled() const { return ScalingFactor()!=100; } }; /** * MWebCoreObjectWidget * The MWebCoreObjectWidget class represents the interface that the plugin widget * has to implement * * @lib webcore.dll */ class MWebCoreObjectWidget: public MWebCoreWidget { public: // Constructor and Deconstrutor virtual ~MWebCoreObjectWidget() {}; public: // Class Methods // Object/Embed related methods // Returns ETrue if the widget is active virtual TBool IsActive() const = 0; // Deactivates the plugin virtual void DeActivate() = 0; // Sets the font virtual void SetFont(CFont* aFont) = 0; // Soundstart related methods // Plays the content virtual void PlayPluginContent(const TDesC& aRequestUrl) = 0; // Stops playing the content virtual void StopPluginContent(const TDesC& aRequestUrl) = 0; // return ETrue if the plugin has resized virtual TBool HasResized() = 0; #ifdef RD_32_BROWSER // check if the plugin is able to accept focus event virtual TBool IsFocusable() const = 0; #endif }; #endif //MWEBCOREWIDGET_H_