OILHorizontalRuler Class Reference

#include <oilruler.h>

Inheritance diagram for OILHorizontalRuler:

OILRuler List of all members.

Public Member Functions

 OILHorizontalRuler ()
 Creates an OILHorizontalRuler object.
 ~OILHorizontalRuler ()
 destructor for OILHorizontalRuler object - delete the legend label;.
virtual BOOL PostCreate ()
 Called from the base class Create() to create the legend label.
void CalcPosFromParentClient (WinRect *lpRect)
 Called by CCamView when its size changes, so it knows where to reposition the CHorzScroller.
void ScrollRuler (INT32 amount)
 Scroll the ruler.
virtual void ShowRuler (BOOL show)
 Shows or hides this ruler.
virtual BOOL DrawMajorGraticule (OilCoord GratOilPos, LPCTSTR str)
 Draw a major graticule on the horizontal ruler Note: Must be called from within the scope of the OILRuler::OnPaint() as it is this function which is responsible for creating a DC and selecting the correct objects into it.
BOOL PositionLegend ()
 Ask the Legend Label to position itself.
BOOL SetLegendText (StringBase *pText)
 Ask the Legend Label to position itself.
LegendLabelGetpLegendLabel ()

Protected Member Functions

virtual BOOL StartDrag (UINT32 nFlags, wxPoint point)
 StartDrag function .
virtual BOOL IsHorizontal ()

Private Attributes

LegendLabelpLegend

Friends

class LegendLabel

Detailed Description

Definition at line 297 of file oilruler.h.


Constructor & Destructor Documentation

OILHorizontalRuler::OILHorizontalRuler  ) 
 

Creates an OILHorizontalRuler object.

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

Definition at line 1581 of file oilruler.cpp.

01582 {
01583     pLegend = NULL; 
01584 }

OILHorizontalRuler::~OILHorizontalRuler  ) 
 

destructor for OILHorizontalRuler object - delete the legend label;.

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

Definition at line 1595 of file oilruler.cpp.

01596 {
01597     if (pLegend)
01598     {
01599         delete pLegend;
01600         pLegend=NULL;
01601     }    
01602 }


Member Function Documentation

void OILHorizontalRuler::CalcPosFromParentClient WinRect lpRect  ) 
 

Called by CCamView when its size changes, so it knows where to reposition the CHorzScroller.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
A long pointer to a rectangle which describes the dimensions of the client [INPUTS] area of the window containing the scroller.
Changes lpRect to the position a horizontal ruler would occupy [OUTPUTS] normally, ie. along the top of the owning window.

Definition at line 1683 of file oilruler.cpp.

01684 {
01685     WinRect parentRect;
01686     parentRect = m_pOwnerView->GetParentFrame()->GetClientRect();
01687     
01688     lpRect->x   = parentRect.x + RulerWidth;
01689     lpRect->y    = parentRect.y;
01690     lpRect->SetRightEx(parentRect.GetRightEx()); //+1);
01691     lpRect->SetBottomEx(parentRect.y  + RulerWidth);
01692     
01693 }

BOOL OILHorizontalRuler::DrawMajorGraticule OilCoord  GratOilPos,
LPCTSTR  str
[virtual]
 

Draw a major graticule on the horizontal ruler Note: Must be called from within the scope of the OILRuler::OnPaint() as it is this function which is responsible for creating a DC and selecting the correct objects into it.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/9/95
Parameters:
GratOilPos - position of graticule on ruler in OilCoords (y ignored) [INPUTS] pGratLabel - label for the graticule
Returns:
FALSE if fails

Reimplemented from OILRuler.

Definition at line 1710 of file oilruler.cpp.

01711 {
01712     ERROR2IF(str          ==NULL,FALSE,"OILHorizontalRuler::DrawMajorGraticule() - pGrtaLabel==NULL");
01713     ERROR2IF(pPaintDC     ==NULL,FALSE,"OILHorizontalRuler::DrawMajorGraticule() - pPaintDC==NULL");
01714     ERROR2IF(pPaintDocView==NULL,FALSE,"OILHorizontalRuler::DrawMajorGraticule() - pPaintDocView==NULL");
01715 
01716     // convert to ruler relative win coords
01717     WinCoord GratWinPos = GratOilPos.ToWin(pPaintDocView);
01718     GratWinPos -= RulerToDocOffset;
01719 
01720     // draw the major graticule in 2 halves with a gap for the text between
01721     INT32 GratLen = MAJOR_GRAT_LEN;
01722     WinRect GratWinRect(GratWinPos.x, RenderWidth-MAJOR_GRAT_LEN, GratWinPos.x+1, RenderWidth);
01723     pPaintDC->DrawRectangle(GratWinRect);
01724 
01725     // draw the graticule label (centred about grat pos)
01726     wxSize TextSize(0,0);
01727     wxString Text(str);
01728     pPaintDC->GetTextExtent(Text, &TextSize.x, &TextSize.y);
01729 
01730     INT32   Textx    = GratWinPos.x-TextSize.x/2;               // centre text about grat (+1 for gap to right - left inclusive)
01731     INT32   Texty    = RenderWidth-(GratLen+TextSize.y);
01732     pPaintDC->DrawText(Text, Textx, Texty);                     // actual digits drawn 1 pixel beyond, and 2 pixels below this point
01733 
01734     return TRUE;
01735 }

LegendLabel* OILHorizontalRuler::GetpLegendLabel  )  [inline]
 

Definition at line 316 of file oilruler.h.

00316 { return pLegend; }

virtual BOOL OILHorizontalRuler::IsHorizontal  )  [inline, protected, virtual]
 

Reimplemented from OILRuler.

Definition at line 320 of file oilruler.h.

00320 { return TRUE ;};

BOOL OILHorizontalRuler::PositionLegend  ) 
 

Ask the Legend Label to position itself.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/9/95
Returns:
FALSE if fails

Definition at line 1747 of file oilruler.cpp.

01748 {
01749 //  ERROR2IF(pLegend==NULL,FALSE,"OILHorizontalRuler::PositionLegend() - pLegend==NULL");
01750     if (pLegend==NULL)
01751     {
01752         TRACE( _T("This should never be NULL but is regularly on Win95 implying the creation order is wrong\n"));
01753         return FALSE;
01754     }
01755 
01756     return pLegend->PositionLegend();
01757 }

BOOL OILHorizontalRuler::PostCreate void   )  [virtual]
 

Called from the base class Create() to create the legend label.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/94
Returns:
FALSE if fails

Reimplemented from OILRuler.

Definition at line 1614 of file oilruler.cpp.

01615 {
01616     pLegend = new LegendLabel;
01617     if (pLegend == NULL)
01618         return FALSE;
01619 
01620 //  pLegend->Create(this, -1);
01621     pLegend->Create(this, m_pOwnerView->GetParentFrame(), -1);
01622 
01623     return TRUE;
01624 }

void OILHorizontalRuler::ScrollRuler INT32  amount  ) 
 

Scroll the ruler.

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

Definition at line 1635 of file oilruler.cpp.

01636 { 
01637     WinRect ClipRect;
01638     ClipRect = GetClientRect();
01639 //  ClipRect.x+=1;
01640 //  ClipRect.SetWidth(ClipRect.GetWidth()-2);
01641 
01642     ScrollWindow(amount, 0, &ClipRect);
01643     Update();
01644 }

BOOL OILHorizontalRuler::SetLegendText StringBase pText  ) 
 

Ask the Legend Label to position itself.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/9/95
Returns:
FALSE if fails

Definition at line 1769 of file oilruler.cpp.

01770 {
01771 //  ERROR2IF(pLegend==NULL,FALSE,"OILHorizontalRuler::SetLegendText() - pLegend==NULL");
01772     if (pLegend==NULL)
01773     {
01774         TRACE( _T("This should never be NULL but is regularly on Win95 implying the creation order is wrong\n"));
01775         return FALSE;
01776     }
01777 
01778     return pLegend->SetLegendText(pText);
01779 }

void OILHorizontalRuler::ShowRuler BOOL  show  )  [virtual]
 

Shows or hides this ruler.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95
Parameters:
show - FALSE to hide the ruler [INPUTS]

Reimplemented from OILRuler.

Definition at line 1791 of file oilruler.cpp.

01792 {
01793     OILRuler::ShowRuler(show);
01794     if (pLegend)
01795         pLegend->ShowLabel(show);
01796 } 

BOOL OILHorizontalRuler::StartDrag UINT32  nFlags,
wxPoint  point
[protected, virtual]
 

StartDrag function .

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/94
Returns:
FALSE if fails

Reimplemented from OILRuler.

Definition at line 1656 of file oilruler.cpp.

01657 { 
01658     NewGuidelineParam.Method    = GUIDELINEOPMETHOD_NEW_DRAG;
01659     NewGuidelineParam.Type      = GUIDELINE_HORZ;
01660 
01661     String_256 OpToken(OPTOKEN_GUIDELINE);
01662 
01663     if (m_pOwnerView != NULL)
01664         m_pOwnerView->InvokeDragOp(&OpToken ,&NewGuidelineParam, nFlags, point);
01665 
01666     return TRUE;
01667 }


Friends And Related Function Documentation

friend class LegendLabel [friend]
 

Definition at line 299 of file oilruler.h.


Member Data Documentation

LegendLabel* OILHorizontalRuler::pLegend [private]
 

Definition at line 320 of file oilruler.h.


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