|
||
BackedUp
: backed-up windows
Note: This example is designed to work properly only with techview, there is no guarantee that it will work properly with other interfaces
Found in: examples\Graphics\WS\BackedUp\
These are the main files contained in the examples. Some extra files may be needed to run the examples, and these will be found in the appropriate examples directory.
// AppHolder.cpp
//
// Copyright (c) 2005 Symbian Softwares Ltd. All rights reserved.
//
#include "AppHolder.h"
#include "BackedUp.h"
#include <EikStart.h>
//
// EXPORTed functions
//
EXPORT_C CApaApplication* NewApplication()
{
return new CAppholderApplication;
}
// updated for 9.1. not conditional as not expected to be used pre 9.1.
GLDEF_C TInt E32Main()
{
return EikStart::RunApplication(NewApplication);
}
////////////////////////////////////////////////////////////////
//
// Application class, CAppholderApplication
//
////////////////////////////////////////////////////////////////
TUid CAppholderApplication::AppDllUid() const
{
return KUidAppholder;
}
CApaDocument* CAppholderApplication::CreateDocumentL()
{
// Construct the document using its NewL() function, rather
// than using new(ELeave), because it requires two-phase
// construction.
return new (ELeave) CAppholderDocument(*this);
}
////////////////////////////////////////////////////////////////
//
// Document class, CAppholderDocument
//
////////////////////////////////////////////////////////////////
// C++ constructor
CAppholderDocument::CAppholderDocument(CEikApplication& aApp)
: CEikDocument(aApp)
{
}
CEikAppUi* CAppholderDocument::CreateAppUiL()
{
return new(ELeave) CAppholderAppUi;
}
CAppholderDocument::~CAppholderDocument()
{
}
////////////////////////////////////////////////////////////////
//
// App UI class, CAppholderAppUi
//
////////////////////////////////////////////////////////////////
void CAppholderAppUi::ConstructL()
{
BaseConstructL();
iClient=CExampleWsClient::NewL(ClientRect());
}
CAppholderAppUi::~CAppholderAppUi()
{
delete iClient;
}
void CAppholderAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case EEikCmdExit:
Exit();
break;
}
}
// BackedUp.CPP
//
// Copyright (c) 2005 Symbian Softwares Ltd. All rights reserved.
//
#include <w32std.h>
#include "Base.h"
#include "BackedUp.h"
_LIT(KString1,"1");
_LIT(KString2,"2");
_LIT(KString3,"3");
_LIT(KString4,"4");
_LIT(KString5,"5");
enum TBackedUpPanic
{
EConnectPanicRedrawToBackedUpWindow,
};
//////////////////////////////////////////////////////////////////////////////
// CNumberedWindow implementation
//////////////////////////////////////////////////////////////////////////////
/****************************************************************************\
| Function: Constructor/Destructor for CNumberedWindow
| Input: aClient Client application that owns the window
\****************************************************************************/
CNumberedWindow::CNumberedWindow (CWsClient* aClient)
: CWindow (aClient), iOldPos(0,0)
{
// iNumber is displayed on front of window.
iNumber = iCount;
iCount++;
}
CNumberedWindow::~CNumberedWindow ()
{
}
/****************************************************************************\
| Function: CNumberedWindow::Draw
| Purpose: Redraws the contents of CNumberedWindow within a given
| rectangle. CNumberedWindow displays a number in the window.
| Input: aRect Rectangle that needs redrawing
| Output: None
\****************************************************************************/
void CNumberedWindow::Draw(const TRect& aRect)
{
const TBufC<1> strings[5] = { *&KString1,
*&KString2,
*&KString3,
*&KString4,
*&KString5
};
CWindowGc* gc=SystemGc(); // get a graphics context
gc->SetClippingRect(aRect); // clip outside the redraw area
gc->Clear(aRect); // clear the redraw area
TSize size=iWindow.Size();
TInt height=size.iHeight; // Need window height to calculate vertical text offset
TInt ascent = Font()->AscentInPixels();
TInt descent = Font()->DescentInPixels();
TInt offset = (height + (ascent + descent)) / 2; // Calculate vertical text offset
gc->SetPenColor(TRgb(0,0,0)); // Set pen to black
gc->UseFont(Font());
gc->DrawText(strings[iNumber], TRect(TPoint(0,0), size), offset, CGraphicsContext::ECenter);
gc->DiscardFont();
}
/****************************************************************************\
| Function: CNumberedWindow::HandlePointerEvent
| Purpose: Handles pointer events for CNumberedWindow.
| Input: aPointerEvent The pointer event
| Output: None
\****************************************************************************/
void CNumberedWindow::HandlePointerEvent (TPointerEvent& aPointerEvent)
{
switch (aPointerEvent.iType)
{
case TPointerEvent::EDrag:
{
TPoint point = aPointerEvent.iParentPosition;
TPoint distToMove = point - iOldPos;
TPoint position = Window().Position();
Window().SetPosition (position + distToMove);
iOldPos = point;
break;
}
case TPointerEvent::EButton1Down:
{
// Request drag events
Window().PointerFilter (EPointerFilterDrag, 0);
Window().SetOrdinalPosition (0);
iOldPos = aPointerEvent.iParentPosition;
break;
}
case TPointerEvent::EButton1Up:
{
// Cancel the request for drag events.
Window().PointerFilter (EPointerFilterDrag, EPointerFilterDrag);
break;
}
default:
break;
}
}
//////////////////////////////////////////////////////////////////////////////
// CMainWindow implementation
//////////////////////////////////////////////////////////////////////////////
/****************************************************************************\
| Function: Constructor/Destructor for CMainWindow
| Input: aClient Client application that owns the window
\****************************************************************************/
CMainWindow::CMainWindow (CWsClient* aClient)
: CBackedUpWindow (aClient)
{
}
CMainWindow::~CMainWindow ()
{
iWindow.Close();
}
/****************************************************************************\
| Function: CMainWindow::Draw
| Purpose: Redraws the contents of CMainWindow within a given
| rectangle.
| Input: aRect Rectangle that needs redrawing
| Output: None
\****************************************************************************/
void CMainWindow::Draw(const TRect& /*aRect*/)
{
_LIT(KPanicMsg,"BACKEDUP");
User::Panic(KPanicMsg,EConnectPanicRedrawToBackedUpWindow);
}
void CMainWindow::HandlePointerMoveBufferReady ()
{
TPoint pnts[KPointerMoveBufferSize];
TPtr8 ptr((TUint8 *)&pnts,sizeof(pnts));
TInt numPnts=Window().RetrievePointerMoveBuffer(ptr);
CWindowGc* gc=SystemGc();
gc->Activate(Window());
for(TInt index=0;index<numPnts;index++) gc->DrawLineTo(pnts[index]);
gc->Deactivate();
}
/****************************************************************************\
| Function: CMainWindow::HandlePointerEvent
| Purpose: Handles pointer events for CMainWindow.
| Input: aPointerEvent The pointer event!
| Output: None
\****************************************************************************/
void CMainWindow::HandlePointerEvent (TPointerEvent& aPointerEvent)
{
switch (aPointerEvent.iType)
{
case TPointerEvent::EButton1Down:
{
Window().SetShadowDisabled(EFalse);
Window().EnablePointerMoveBuffer();
CWindowGc* gc = SystemGc();
gc->Activate(Window());
gc->MoveTo(aPointerEvent.iPosition);
gc->Deactivate();
}
default:
break;
}
}
//////////////////////////////////////////////////////////////////////////////
// CExampleWsClient implementation
//////////////////////////////////////////////////////////////////////////////
CExampleWsClient* CExampleWsClient::NewL(const TRect& aRect)
{
// make new client
CExampleWsClient* client=new (ELeave) CExampleWsClient(aRect);
CleanupStack::PushL(client); // push, just in case
client->ConstructL(); // construct and run
CleanupStack::Pop();
return client;
}
/****************************************************************************\
| Function: Constructor/Destructor for CExampleWsClient
| Destructor deletes everything that was allocated by
| ConstructMainWindowL()
\****************************************************************************/
CExampleWsClient::CExampleWsClient(const TRect& aRect)
:iRect(aRect)
{
}
CExampleWsClient::~CExampleWsClient ()
{
delete iMainWindow;
delete iWindow1;
}
/****************************************************************************\
| Function: CExampleWsClient::ConstructMainWindowL()
| Called by base class's ConstructL
| Purpose: Allocates and creates all the windows owned by this client
| (See list of windows in CExampleWsCLient declaration).
\****************************************************************************/
void CExampleWsClient::ConstructMainWindowL()
{
// Resources allocated in this function are freed in the CExampleWsClient destructor
iMainWindow=new (ELeave) CMainWindow(this);
iMainWindow->ConstructL(iRect);
iWindow1 = new (ELeave) CNumberedWindow (this);
iWindow1->ConstructL (TRect (TPoint (100, 100), TSize (100, 100)), TRgb (100, 100, 100),
iMainWindow);
}
/****************************************************************************\
| Function: CExampleWsClient::RunL()
| Called by active scheduler when an even occurs
| Purpose: Processes events according to their type
| For key events: calls HandleKeyEventL() (global to client)
| For pointer event: calls HandlePointerEvent() for window
| event occurred in.
\****************************************************************************/
void CExampleWsClient::RunL()
{
// get the event
iWs.GetEvent(iWsEvent);
TInt eventType=iWsEvent.Type();
// take action on it
switch (eventType)
{
// events global within window group
case EEventNull:
break;
case EEventKey:
{
TKeyEvent& keyEvent=*iWsEvent.Key(); // get key event
HandleKeyEventL (keyEvent);
break;
}
case EEventKeyUp:
case EEventModifiersChanged:
case EEventKeyDown:
case EEventFocusLost:
case EEventFocusGained:
case EEventSwitchOn:
case EEventPassword:
case EEventWindowGroupsChanged:
case EEventErrorMessage:
break;
// events local to specific windows
case EEventPointer:
{
CWindow* window=(CWindow*)(iWsEvent.Handle()); // get window
TPointerEvent& pointerEvent=*iWsEvent.Pointer();
window->HandlePointerEvent (pointerEvent);
break;
}
case EEventPointerExit:
case EEventPointerEnter:
case EEventPointerBufferReady:
{
CWindow* window=(CWindow*)(iWsEvent.Handle()); // get window
window->HandlePointerMoveBufferReady ();
break;
}
case EEventDragDrop:
break;
default:
break;
}
IssueRequest(); // maintain outstanding request
}
/****************************************************************************\
| Function: CExampleWsClient::HandleKeyEventL()
| Purpose: Processes key events for CExampleWsClient
\****************************************************************************/
void CExampleWsClient::HandleKeyEventL (TKeyEvent& /*aKeyEvent*/)
{
}
// Base.CPP
//
// Copyright (c) 2005 Symbian Softwares Ltd. All rights reserved.
//
#include <w32std.h>
#include "Base.h"
///////////////////////////////////////////////////////////////////////////////
// CWindow implementation
///////////////////////////////////////////////////////////////////////////////
CWindow::CWindow(CWsClient* aClient)
: iClient(aClient)
{
}
void CWindow::ConstructL (const TRect& aRect, const TRgb& aColor, CBackedUpWindow* aParent)
{
_LIT(KFontName,"Swiss");
// If a parent window was specified, use it; if not, use the window group
// (aParent defaults to 0).
RWindowTreeNode* parent= aParent ? (RWindowTreeNode*) &(aParent->Window()) : &(iClient->iGroup);
// Allocate and construct the window
iWindow=RWindow(iClient->iWs);
User::LeaveIfError(iWindow.Construct(*parent, (TUint32)this));
// Store the window's extent
iRect = aRect;
// Set up the new window's extent
User::LeaveIfError(iWindow.SetExtentErr(iRect.iTl, iRect.Size()));
// Set its background color
iWindow.SetBackgroundColor (aColor);
// Set pointer grab to enable drag and drop
iWindow.SetPointerGrab (ETrue);
// Set up font for displaying text
TFontSpec fontSpec(KFontName,200);
User::LeaveIfError(iClient->iScreen->GetNearestFontInTwips(iFont,fontSpec));
// Activate the window
iWindow.Activate();
}
CWindow::~CWindow()
{
iWindow.FreePointerMoveBuffer();
iWindow.Close();
iClient->iScreen->ReleaseFont(iFont);
}
RWindow& CWindow::Window()
{
return iWindow;
}
CWindowGc* CWindow::SystemGc()
{
return iClient->iGc;
}
CWsScreenDevice* CWindow::Screen()
{
return iClient->iScreen;
}
CFont* CWindow::Font()
{
return iFont;
}
/////////////////////////////////////////////////////////////////////////
CBackedUpWindow::CBackedUpWindow(CWsClient* aClient)
: iClient(aClient)
{
}
void CBackedUpWindow::ConstructL (const TRect& aRect, CWindow* aParent)
{
_LIT(KFontName,"Swiss");
// If a parent window was specified, use it; if not, use the window group
// (aParent defaults to 0).
RWindowTreeNode* parent= aParent ? (RWindowTreeNode*) &(aParent->Window()) : &(iClient->iGroup);
// Allocate and construct the window
iWindow=RBackedUpWindow(iClient->iWs);
User::LeaveIfError(iWindow.Construct(*parent, EGray4, (TUint32)this));
// Store the window's extent
iRect = aRect;
// Set up the new window's extent
User::LeaveIfError(iWindow.SetExtentErr(iRect.iTl, iRect.Size()));
// Set its background color
iWindow.AllocPointerMoveBuffer(KPointerMoveBufferSize, 0);
iWindow.DisablePointerMoveBuffer();
iWindow.PointerFilter(EPointerFilterDrag, 0);
// Set pointer grab to enable drag and drop
iWindow.SetPointerGrab (ETrue);
// Set up font for displaying text
TFontSpec fontSpec(KFontName,200);
User::LeaveIfError(iClient->iScreen->GetNearestFontInTwips(iFont,fontSpec));
// Activate the window
iWindow.Activate();
}
CBackedUpWindow::~CBackedUpWindow()
{
iWindow.Close();
iClient->iScreen->ReleaseFont(iFont);
}
RBackedUpWindow& CBackedUpWindow::Window()
{
return iWindow;
}
CWindowGc* CBackedUpWindow::SystemGc()
{
return iClient->iGc;
}
CWsScreenDevice* CBackedUpWindow::Screen()
{
return iClient->iScreen;
}
CFont* CBackedUpWindow::Font()
{
return iFont;
}
///////////////////////////////////////////////////////////////////////////////
// CWsRedrawer implementation
///////////////////////////////////////////////////////////////////////////////
CWsRedrawer::CWsRedrawer()
: CActive(CActive::EPriorityLow)
{
}
void CWsRedrawer::ConstructL(CWsClient* aClient)
{
iClient=aClient; // remember WsClient that owns us
CActiveScheduler::Add(this); // add ourselves to the scheduler
IssueRequest(); // issue request to draw
}
CWsRedrawer::~CWsRedrawer()
{
Cancel();
}
void CWsRedrawer::IssueRequest()
{
iClient->iWs.RedrawReady(&iStatus);
SetActive();
}
void CWsRedrawer::DoCancel()
{
iClient->iWs.RedrawReadyCancel();
}
void CWsRedrawer::RunL()
{
// find out what needs to be done in response to the event
TWsRedrawEvent redrawEvent;
iClient->iWs.GetRedraw(redrawEvent); // get event
CWindow* window=(CWindow*)(redrawEvent.Handle()); // get window
if (window)
{
TRect rect=redrawEvent.Rect(); // and rectangle that needs redrawing
// now do drawing
iClient->iGc->Activate(window->Window());
window->Window().BeginRedraw(rect);
window->Draw(rect);
window->Window().EndRedraw();
iClient->iGc->Deactivate();
}
// maintain outstanding request
IssueRequest();
}
/////////////////////////////////////////////////////////////////////////////////////
// CWsClient implementation
/////////////////////////////////////////////////////////////////////////////////////
CWsClient::CWsClient()
: CActive(CActive::EPriorityStandard)
{
}
void CWsClient::ConstructL()
{
// add ourselves to active scheduler
CActiveScheduler::Add(this);
// get a session going
User::LeaveIfError(iWs.Connect());
// construct our one and only window group
iGroup=RWindowGroup(iWs);
User::LeaveIfError(iGroup.Construct(2,ETrue)); // '2' is a meaningless handle
// construct screen device and graphics context
iScreen=new (ELeave) CWsScreenDevice(iWs); // make device for this session
User::LeaveIfError(iScreen->Construct()); // and complete its construction
User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context
// construct redrawer
iRedrawer=new (ELeave) CWsRedrawer;
iRedrawer->ConstructL(this);
// construct main window
ConstructMainWindowL();
// request first event and start scheduler
IssueRequest();
}
CWsClient::~CWsClient()
{
// neutralize us as an active object
Deque(); // cancels and removes from scheduler
// get rid of everything we allocated
delete iGc;
delete iScreen;
delete iRedrawer;
// destroy window group
iGroup.Close(); // what's the difference between this and destroy?
// finish with window server
iWs.Close();
}
void CWsClient::IssueRequest()
{
iWs.EventReady(&iStatus); // request an event
SetActive(); // so we're now active
}
void CWsClient::DoCancel()
{
iWs.EventReadyCancel(); // cancel event request
}
void CWsClient::ConstructMainWindowL()
{
}
// AppHolder.h
//
#ifndef __APPHOLDER_H
#define __APPHOLDER_H
#include <coeccntx.h>
#include <eikenv.h>
#include <eikappui.h>
#include <eikapp.h>
#include <eikdoc.h>
#include <eikmenup.h>
#include <eikon.hrh>
const TUid KUidAppholder = { 0x100098e5 };
class CWsClient;
//
// CAppholderAppUi
//
class CAppholderAppUi : public CEikAppUi
{
public:
void ConstructL();
~CAppholderAppUi();
private: // from CEikAppUi
void HandleCommandL(TInt aCommand);
private:
CWsClient* iClient;
};
//
// CAppholderDocument
//
class CAppholderDocument : public CEikDocument
{
public:
// construct/destruct
CAppholderDocument(CEikApplication& aApp);
~CAppholderDocument();
private: // from CEikDocument
CEikAppUi* CreateAppUiL();
};
//
// CAppholderApplication
//
class CAppholderApplication : public CEikApplication
{
private: // from CApaApplication
CApaDocument* CreateDocumentL();
TUid AppDllUid() const;
};
#endif
// BackedUp.H
//
// Copyright (c) 2005 Symbian Softwares Ltd. All rights reserved.
//
#if !defined(__WSBACKD1_H__)
#define __WSBACKD1_H__
#include "Base.h"
//////////////////////////////////////////////////////////////////////////
// Derived window classes
//////////////////////////////////////////////////////////////////////////
// CNumberedWindow displays a number in its center and supports drag and drop
class CNumberedWindow : public CWindow
{
public:
CNumberedWindow (CWsClient* aClient);
~CNumberedWindow ();
void Draw (const TRect& aRect);
void HandlePointerEvent (TPointerEvent& aPointerEvent);
void HandlePointerMoveBufferReady () {}
private:
TInt iCount;
TInt iNumber; // Number displayed in window
TPoint iOldPos; // Position is required for drag and drop
};
class CMainWindow : public CBackedUpWindow
{
public:
CMainWindow (CWsClient* aClient);
~CMainWindow ();
void Draw (const TRect& aRect);
void HandlePointerEvent (TPointerEvent& aPointerEvent);
void HandlePointerMoveBufferReady ();
};
//////////////////////////////////////////////////////////////////////////
// Derived client class
//////////////////////////////////////////////////////////////////////////
class CExampleWsClient : public CWsClient
{
public:
static CExampleWsClient* NewL(const TRect& aRect);
private:
CExampleWsClient (const TRect& aRect);
void ConstructMainWindowL();
~CExampleWsClient ();
void RunL ();
void HandleKeyEventL (TKeyEvent& aKeyEvent);
private:
CMainWindow* iMainWindow;
CNumberedWindow* iWindow1;
const TRect& iRect;
};
#endif
// Base.H
//
// Copyright (c) 2005 Symbian Softwares Ltd. All rights reserved.
//
#if !defined(__WSBACKED_H__)
#define __WSBACKED_H__
// Forward declarations
class CWsRedrawer;
class CWindow;
/////////////////////////////////////////////////////////////////////////
// Declaration of CWsClient
/////////////////////////////////////////////////////////////////////////
class CWsClient : public CActive
{
protected:
//construct
CWsClient();
CWsScreenDevice* iScreen;
CWsRedrawer* iRedrawer;
RWsSession iWs;
TWsEvent iWsEvent;
public:
void ConstructL();
// destruct
~CWsClient();
// main window
virtual void ConstructMainWindowL();
// terminate cleanly
void Exit();
// active object protocol
void IssueRequest(); // request an event
void DoCancel(); // cancel the request
virtual void RunL() = 0; // handle completed request
virtual void HandleKeyEventL (TKeyEvent& aKeyEvent) = 0;
private:
RWindowGroup iGroup;
CWindowGc* iGc;
friend class CWsRedrawer; // needs to get at session
friend class CWindow; // needs to get at session
friend class CBackedUpWindow;
};
////////////////////////////////////////////////////////////////////////////
// CWsRedrawer declaration
////////////////////////////////////////////////////////////////////////////
class CWsRedrawer : public CActive
{
public:
// construct/destruct
CWsRedrawer();
void ConstructL(CWsClient* aClient);
~CWsRedrawer();
// drawing
void IssueRequest();
void DoCancel();
void RunL();
protected:
CWsClient* iClient;
};
//////////////////////////////////////////////////////////////////////////////
// CWindow declaration
//////////////////////////////////////////////////////////////////////////////
class CWindow : public CBase
{
public:
enum {KPointerMoveBufferSize=32};
CWindow(CWsClient* aClient);
void ConstructL (const TRect& aRect, const TRgb& aColor, CBackedUpWindow* aParent=0);
~CWindow();
// access
RWindow& Window(); // our own window
CWindowGc* SystemGc(); // system graphics context
CWsScreenDevice* Screen();
CFont* Font();
// drawing
virtual void Draw(const TRect& aRect) = 0;
virtual void HandlePointerEvent (TPointerEvent& aPointerEvent) = 0;
virtual void HandlePointerMoveBufferReady () = 0;
protected:
RWindow iWindow; // window server window
TRect iRect; // window's extent
private:
CWsClient* iClient; // client including session and group
CFont* iFont;
};
class CBackedUpWindow : public CBase
{
public:
enum {KPointerMoveBufferSize=32};
CBackedUpWindow(CWsClient* aClient);
void ConstructL (const TRect& aRect, CWindow* aParent=0);
~CBackedUpWindow();
// access
RBackedUpWindow& Window(); // our own window
CWindowGc* SystemGc(); // system graphics context
CWsScreenDevice* Screen();
CFont* Font();
// drawing
virtual void Draw(const TRect& aRect) = 0;
virtual void HandlePointerEvent (TPointerEvent& aPointerEvent) = 0;
virtual void HandlePointerMoveBufferReady () = 0;
protected:
RBackedUpWindow iWindow; // window server window
TRect iRect; // window's extent
private:
CWsClient* iClient; // client including session and group
CFont* iFont;
};
#endif
// BackedUp.rss
//
NAME MEAD
#include <eikon.rh>
#include <eikcore.rsg>
RESOURCE RSS_SIGNATURE { }
RESOURCE TBUF
{
buf = "";
}
RESOURCE EIK_APP_INFO
{
menubar = r_appholder_menubar;
hotkeys = r_appholder_hotkeys;
}
RESOURCE HOTKEYS r_appholder_hotkeys
{
control =
{
HOTKEY
{
command = EEikCmdExit;
key = 'e';
}
};
}
RESOURCE MENU_BAR r_appholder_menubar
{
titles =
{
MENU_TITLE
{
menu_pane = r_appholder_file_menu;
txt = "File";
}
};
}
RESOURCE MENU_PANE r_appholder_file_menu
{
items =
{
MENU_ITEM
{
command = EEikCmdExit;
txt = "Close";
}
};
}
#include <appinfo.rh>
RESOURCE LOCALISABLE_APP_INFO
{
short_caption = "BackedUp";
caption_and_icon =
{
CAPTION_AND_ICON_INFO
{
caption = "BackedUp";
number_of_icons = 0; // each icon must be a bitmap/mask pair
}
};
}
// BackedUp.RSS
//
// Copyright (c) 2005 Symbian Software Ltd. All rights reserved.
//
#include <appinfo.rh>
UID2 KUidAppRegistrationResourceFile
UID3 0x100098E5
RESOURCE APP_REGISTRATION_INFO
{
app_file = BackedUp;
localisable_resource_file="\\resource\\apps\\BackedUp_loc.rss";
hidden=KAppNotHidden;
embeddability=KAppNotEmbeddable;
newfile=KAppDoesNotSupportNewFile;
launch=KAppLaunchInForeground;
}
This example demonstrates how to implement a backed up window.
It implements freehand drawing in a similar way to the
PtBuffer
example, using the pointer move buffer. However, in this
example, the window which may be drawn to is an RBackedUpWindow
rather than an RWindow
. This means that any drawing is redrawn
automatically if it becomes covered up and then uncovered: the backed-up window
receives no redraw events. The example includes a small window which can be
dragged around the screen to illustrate this.
Drag the mouse with left mouse button down for freehand drawing. You do
not need to press the Shift
key.
Draw using the pointer. You do not need to press the
Shift
key.
RBackedUpWindow
: Backed-up window
CWsScreenDevice
: Screen device