BlankTool Class Reference

A template tool class. More...

#include <blnktool.h>

Inheritance diagram for BlankTool:

Tool_v1 List of all members.

Public Member Functions

 BlankTool ()
 Default Constructor. Other initialisation is done in BlankTool::Init which is called by the Tool Manager.
 ~BlankTool ()
 Destructor (Virtual). Does nothing.
BOOL Init ()
 Used to check if the Tool was properly constructed.
void Describe (void *InfoPtr)
 Allows the tool manager to extract information about the tool.
UINT32 GetID ()
void SelectChange (BOOL isSelected)
 Starts up and closes down the blank tool.
void OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 To handle a Mouse Click event for the Blank Tool.
void OnMouseMove (DocCoord PointerPos, Spread *pSpread, ClickModifiers ClickMods)
 To handle a Mouse Move event for the Blank Tool.
void RenderToolBlobs (Spread *pSpread, DocRect *pDocRect)
 Handles the RenderToolBlobs method. Renders the tool's blobs into the selected doc view.
BOOL GetStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 Returns the current status line help string.

Static Public Member Functions

static BlankInfoBarOpGetBlankInfoBarOp ()
static BOOL IsCurrentTool ()

Private Member Functions

 CC_DECLARE_MEMDUMP (BlankTool)
void DisplayStatusBarHelp (DocCoord DocPos, Spread *pSpread, ClickModifiers ClickMods)
 Displays status help string for the given position in the status bar.
void GetCurrentStatusText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 Selects a suitable string for the status line based on the current location (as input via the parameters).
BOOL CreateCursors ()
 Creates all the blank tool cursors.
void DestroyCursors ()
 Destroys all the blank tool cursors.

Private Attributes

Cursorm_pcNormalBlankCursor
Cursorm_pcCurrentCursor
INT32 m_CurrentCursorID

Static Private Attributes

static BOOL s_bCurrentTool = FALSE
static BlankInfoBarOps_pBlankInfoBarOp = NULL
static LPTSTR FamilyName = _T("Blank Tools")
static LPTSTR ToolName = _T("Blank Tool")
static LPTSTR Purpose = _T("Blank manipulation")
static LPTSTR Author = _T("Buster")

Detailed Description

A template tool class.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94

Definition at line 122 of file blnktool.h.


Constructor & Destructor Documentation

BlankTool::BlankTool  ) 
 

Default Constructor. Other initialisation is done in BlankTool::Init which is called by the Tool Manager.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
See also:
BlankTool::Init

Definition at line 145 of file blnktool.cpp.

00146 {
00147     m_pcCurrentCursor = NULL;
00148     m_pcNormalBlankCursor = NULL;
00149 }

BlankTool::~BlankTool  ) 
 

Destructor (Virtual). Does nothing.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94

Definition at line 161 of file blnktool.cpp.

00162 {
00163 }


Member Function Documentation

BlankTool::CC_DECLARE_MEMDUMP BlankTool   )  [private]
 

BOOL BlankTool::CreateCursors  )  [private]
 

Creates all the blank tool cursors.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if all the blank tool cursors have been successfully created
See also:
-

Definition at line 307 of file blnktool.cpp.

00308 {
00309     // This tool has just been selected.  Create the cursors.
00310     m_pcNormalBlankCursor = new Cursor(this, _R(IDCSR_BLANKTOOLDEFAULT));
00311 
00312     if ( m_pcNormalBlankCursor==NULL || !m_pcNormalBlankCursor->IsValid())
00313     {
00314         DestroyCursors();
00315         return FALSE;
00316     }
00317     else
00318         return TRUE;
00319 }

void BlankTool::Describe void *  InfoPtr  )  [virtual]
 

Allows the tool manager to extract information about the tool.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
InfoPtr - A pointer to a tool info block. It is passed cast to void* as [INPUTS] the version of the tool is unknown at this point. Later versions of the Tool class may have more items in this block, that this tool will not use
InfoPtr - The structure pointed to by InfoPtr will have had all the info [OUTPUTS] that this version of the Tool knows about

Reimplemented from Tool_v1.

Definition at line 213 of file blnktool.cpp.

00214 {
00215     // Cast structure into the latest one we understand.
00216     ToolInfo_v1* Info = (ToolInfo_v1*) InfoPtr;
00217 
00218     Info->InfoVersion = 1;
00219     
00220     Info->InterfaceVersion = GetToolInterfaceVersion();  // You should always have this line.
00221         
00222     // These are all arbitrary at present.
00223     Info->Version = 1;
00224     Info->ID      = GetID();
00225     Info->TextID  = _R(IDS_BLANK_TOOL);
00226 
00227     Info->Family  = FamilyName;
00228     Info->Name    = ToolName;
00229     Info->Purpose = Purpose;
00230     Info->Author  = Author;
00231 
00232     Info->BubbleID = _R(IDBBL_BLANK_TOOLBOX);
00233 }

void BlankTool::DestroyCursors  )  [private]
 

Destroys all the blank tool cursors.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 335 of file blnktool.cpp.

00336 {
00337     if (m_pcNormalBlankCursor != NULL) delete m_pcNormalBlankCursor;
00338 }

void BlankTool::DisplayStatusBarHelp DocCoord  DocPos,
Spread pSpread,
ClickModifiers  ClickMods
[private]
 

Displays status help string for the given position in the status bar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
DocPos - the document coordinate of the point to display help on [INPUTS] pSpread - pointer to the spread containing DocPos ClickMods - the current click modifiers
- [OUTPUTS]
Returns:
-
See also:
BlankTool::GetCurrentStatusText

Definition at line 441 of file blnktool.cpp.

00442 {
00443     String_256 StatusMsg(_T(""));
00444 
00445     // Get a string from the underlying help function and display it.
00446     GetCurrentStatusText(&StatusMsg, pSpread, DocPos, ClickMods);
00447     GetApplication()->UpdateStatusBarText(&StatusMsg);                           
00448 }

static BlankInfoBarOp* BlankTool::GetBlankInfoBarOp  )  [inline, static]
 

Definition at line 144 of file blnktool.h.

00144 { return s_pBlankInfoBarOp; }

void BlankTool::GetCurrentStatusText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[private]
 

Selects a suitable string for the status line based on the current location (as input via the parameters).

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
pSpread points to a spread [INPUTS] DocPos points to a point in a document ClickMods are the current click modifiers
Updates the string in ptext [OUTPUTS]
Returns:
-
See also:
BlankTool::GetStatusLineText, BlankTool::DisplayStatusBarHelp

Definition at line 491 of file blnktool.cpp.

00492 {
00493     // You must use the Spread, DocCoord and ClickModifiers to select a suitable string to be 
00494     // displaied in the status bar.  This is usually done via some sort of switch statement.
00495     // Having selected a suitable string you should do a statement like 
00496     //  ptext->Load(<#Insert your string ID here #>);
00497 
00498     // Delete this line when you display useful strings!
00499     ptext->Empty(); 
00500 }

UINT32 BlankTool::GetID void   )  [inline, virtual]
 

Reimplemented from Tool_v1.

Definition at line 134 of file blnktool.h.

00134 { return TOOLID_BLANK; };   // <****** CHANGE THIS TO YOUR TOOL'S ID!!! (defined in kernel\tool.h)

BOOL BlankTool::GetStatusLineText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[virtual]
 

Returns the current status line help string.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
ptest - pointer to a string [INPUTS] pSpread points to a spread DocPos points to a point in a document ClickMods are the current click modifiers
Updates the string in ptext [OUTPUTS]
Returns:
TRUE if the string was updates (FALSE if not updated)
See also:
BlankTool::GetCurrentStatusText, Tool_v1::GetStatusLineText

Reimplemented from Tool_v1.

Definition at line 467 of file blnktool.cpp.

00468 {
00469     // We can call the underlying help function to get a string and return the result.
00470     GetCurrentStatusText(ptext, pSpread, DocPos, ClickMods);
00471     return TRUE;
00472 }

BOOL BlankTool::Init void   )  [virtual]
 

Used to check if the Tool was properly constructed.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Returns:
FALSE if it does not want to be created, TRUE otherwise
See also:
BlankTool::BlankTool

Reimplemented from Tool_v1.

Definition at line 178 of file blnktool.cpp.

00179 {
00180     // Declare all your ops here and only succeed if all declarations succeed
00181 
00182     BOOL ok = TRUE;
00183 
00184     // This section reads in the infobar definition and creates an instance of
00185     // BlankInfoBarOp.  Also pBlankInfoBarOp, the ptr to the tool's infobar, is set up
00186     // after the infobar is successfully read and created.
00187     if (ok)
00188     {
00189         s_pBlankInfoBarOp = new BlankInfoBarOp(this);
00190         ERROR2IF(s_pBlankInfoBarOp==NULL, FALSE, "Can't create Blank tool Infobar");
00191     }
00192 
00193     return (ok);
00194 }

static BOOL BlankTool::IsCurrentTool  )  [inline, static]
 

Definition at line 145 of file blnktool.h.

00145 { return s_bCurrentTool; }

void BlankTool::OnClick DocCoord  PointerPos,
ClickType  Click,
ClickModifiers  ClickMods,
Spread pSpread
[virtual]
 

To handle a Mouse Click event for the Blank Tool.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
PointerPos - The DocCoord of the point where the mouse button was clicked [INPUTS] Click - Describes the type of click that was detected. ClickMods - Indicates which buttons caused the click and which modifers were pressed at the same time pSpread - The spread in which the click happened
Returns:
-
See also:
Tool::MouseClick; ClickType; ClickModifiers

Reimplemented from Tool_v1.

Definition at line 358 of file blnktool.cpp.

00360 {
00361     if (ClickMods.Menu) return;                         // Don't do anything if the user clicked the Menu button
00362 
00363     // Make sure this click is one that we want
00364     if ( Click == CLICKTYPE_SINGLE || Click == CLICKTYPE_DOUBLE)
00365     {
00366     }
00367 
00368     if ( Click == CLICKTYPE_DRAG )
00369     {
00370     }
00371 }

void BlankTool::OnMouseMove DocCoord  PointerPos,
Spread pSpread,
ClickModifiers  ClickMods
[virtual]
 

To handle a Mouse Move event for the Blank Tool.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
PointerPos - The DocCoord of the point where the mouse has moved to [INPUTS] pSpread - The spread in which the move occurred ClickMods - The state of the various modifiers at the time of the mouse move
Returns:
TRUE if it handled the Click, FALSE otherwise
See also:
Tool::MouseClick; ClickType; ClickModifiers

Reimplemented from Tool_v1.

Definition at line 388 of file blnktool.cpp.

00389 {
00390     // You can use this func to do things like change the pointer shape, or
00391     // alter the text in the status bar
00392 
00393     // Use this func to change your curor
00394     //      CursorStack::GSetTop(Cursor* pCursor, CurrentCursorID)
00395 
00396     // Display status bar text for the current position
00397     DisplayStatusBarHelp(PointerPos, pSpread, ClickMods);
00398 }

void BlankTool::RenderToolBlobs Spread pSpread,
DocRect pDocRect
[virtual]
 

Handles the RenderToolBlobs method. Renders the tool's blobs into the selected doc view.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
pSpread = ptr to a spread [INPUTS] pDocRect = ptr to DocRect of spread to render in
Returns:
-
See also:

Reimplemented from Tool_v1.

Definition at line 415 of file blnktool.cpp.

00416 {
00417     // Render into the selected doc view
00418     DocView* pDocView = DocView::GetSelected();
00419     if (pDocView != NULL)
00420     {
00421         // render you tool's blobs (if any) here
00422     }
00423 }

void BlankTool::SelectChange BOOL  isSelected  )  [virtual]
 

Starts up and closes down the blank tool.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
isSelected - TRUE = tool has been selected [INPUTS]
  • FALSE = tool has been deselected
- [OUTPUTS]
Returns:
-

Errors: Debug warning if creating the cursor fails.

See also:
-

Reimplemented from Tool_v1.

Definition at line 251 of file blnktool.cpp.

00252 {
00253     if (isSelected)
00254     {
00255         if (!CreateCursors()) return;
00256         m_CurrentCursorID = CursorStack::GPush(m_pcNormalBlankCursor, FALSE);       // Push cursor but don't display now
00257         m_pcCurrentCursor = m_pcNormalBlankCursor;
00258 
00259         // This tool is now the current one
00260         s_bCurrentTool = TRUE;
00261 
00262         // Create and display the tool's info bar
00263         s_pBlankInfoBarOp->Create();
00264     }
00265     else
00266     {
00267         // Deselection - destroy the tool's cursors, if they exist.
00268         if (m_pcCurrentCursor != NULL)
00269         {
00270             CursorStack::GPop(m_CurrentCursorID);
00271             m_pcCurrentCursor = NULL;
00272             m_CurrentCursorID = 0;
00273         }
00274         DestroyCursors();
00275 
00276         // Remove the info bar from view by deleting the actual underlying window
00277         s_pBlankInfoBarOp->Delete();
00278 
00279         // ensure any tool object blobs are removed.
00280         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00281         if (BlobMgr != NULL)
00282         {
00283             BlobStyle bsRemoves;
00284             bsRemoves.ToolObject = TRUE;
00285             BlobMgr->RemoveInterest(bsRemoves);
00286         }
00287 
00288         // No longer the current tool
00289         s_bCurrentTool = FALSE;
00290     }
00291 }


Member Data Documentation

LPTSTR BlankTool::Author = _T("Buster") [static, private]
 

Definition at line 165 of file blnktool.h.

LPTSTR BlankTool::FamilyName = _T("Blank Tools") [static, private]
 

Definition at line 162 of file blnktool.h.

INT32 BlankTool::m_CurrentCursorID [private]
 

Definition at line 159 of file blnktool.h.

Cursor* BlankTool::m_pcCurrentCursor [private]
 

Definition at line 158 of file blnktool.h.

Cursor* BlankTool::m_pcNormalBlankCursor [private]
 

Definition at line 157 of file blnktool.h.

LPTSTR BlankTool::Purpose = _T("Blank manipulation") [static, private]
 

Definition at line 164 of file blnktool.h.

BOOL BlankTool::s_bCurrentTool = FALSE [static, private]
 

Definition at line 154 of file blnktool.h.

BlankInfoBarOp * BlankTool::s_pBlankInfoBarOp = NULL [static, private]
 

Definition at line 155 of file blnktool.h.

LPTSTR BlankTool::ToolName = _T("Blank Tool") [static, private]
 

Definition at line 163 of file blnktool.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:25 2007 for Camelot by  doxygen 1.4.4