LegendLabel Class Reference

This is the class for the "set origin" gadget,. More...

#include <oilruler.h>

List of all members.

Public Member Functions

 LegendLabel ()
 Creates an OILDockingBar object.
virtual ~LegendLabel ()
 Destroys an LegendLabel object.
BOOL Create (OILHorizontalRuler *pHorzRuler, wxWindow *pParentWindow, INT32 id)
 Creates an LegendLabel object.
void ShowLabel (BOOL show)
 Shows or hides this label.
BOOL PositionLegend ()
 Called by Horizontal ruler to position the LegendLabel.
wxPoint ClientToParentClient (wxPoint point)
 convert coord relative to this window to a coord relative to the parent window Note: Nice if this was in a parent CCWnd class
BOOL GetStatusLineText (String_256 *pText, WinCoord MousePos, CWindowID hWnd)
 if over a ruler legend return status line help

Protected Member Functions

BOOL SetLegendText (StringBase *pText)
 Called to set legend text - resize and reposition Legend.
BOOL SetLegendSize ()
 Sets the width of the window to fit the legend text. Note: The actual Legend window may be 1 pixel larger to ensure that it is vertically centred correctly in ruler (ie gap above == gap below).
void DoPaint (wxDC *pDC)
 Paints the client area of the Legend Label.
void OnPaint (wxPaintEvent &event)
 Redraws the colour bar.
void OnSize (wxSizeEvent &event)
void OnLButtonDown (wxMouseEvent &event)
 handle left button down events - pass on to parent ruler
void OnLButtonDblClk (wxMouseEvent &event)
 handle left button double click events - pass on to parent ruler
void OnRButtonUp (wxMouseEvent &event)
 handle left button up events - pass on to parent ruler
void OnMouseMove (wxMouseEvent &event)
 handle mousemoves over ruler legend label

Protected Attributes

UINT32 LegendWidth
UINT32 LegendHeight
String_256 LegendText
OILHorizontalRulerm_pHorzRuler

Friends

class OILHorizontalRuler


Detailed Description

This is the class for the "set origin" gadget,.

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

Definition at line 130 of file oilruler.h.


Constructor & Destructor Documentation

LegendLabel::LegendLabel  ) 
 

Creates an OILDockingBar object.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95

Definition at line 2342 of file oilruler.cpp.

02343 {
02344     LegendText = _R(IDS_OILRULER_INCHES); // "Inches";
02345     LegendWidth = 0;
02346     LegendHeight = 0;
02347     m_pHorzRuler = NULL;
02348 }

LegendLabel::~LegendLabel  )  [virtual]
 

Destroys an LegendLabel object.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95

Definition at line 2374 of file oilruler.cpp.

02375 {
02376 }


Member Function Documentation

wxPoint LegendLabel::ClientToParentClient wxPoint  point  ) 
 

convert coord relative to this window to a coord relative to the parent window Note: Nice if this was in a parent CCWnd class

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
point - [INPUTS]
Returns:
the point relative to the parent window

Definition at line 2674 of file oilruler.cpp.

02675 {
02676     ClientToScreen(point);
02677 //  GetParent()->ScreenToClient(point);
02678     m_pHorzRuler->ScreenToClient(point);
02679     return point;
02680 }

BOOL LegendLabel::Create OILHorizontalRuler pHorzRuler,
wxWindow *  pParentWindow,
INT32  id
 

Creates an LegendLabel object.

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

Definition at line 2544 of file oilruler.cpp.

02545 { 
02546     ERROR2IF(pHorzRuler==NULL, FALSE, "DockingBar must have a Parent");
02547     ERROR2IF(pParentWindow==NULL, FALSE, "DockingBar must have a Parent");
02548 
02549     m_pHorzRuler = pHorzRuler;
02550 
02551     if (!wxWindow::Create(pParentWindow, id, wxDefaultPosition, wxSize(10, 20), wxNO_BORDER))
02552         return(FALSE);
02553 
02554     return TRUE;
02555 }

void LegendLabel::DoPaint wxDC *  pDC  )  [protected]
 

Paints the client area of the Legend Label.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95

Definition at line 2412 of file oilruler.cpp.

02413 {
02414     // read the necessary colours
02415     wxColour BackCol  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
02416     wxColour TopLeft  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT);
02417     wxColour BotRight = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW);
02418     wxColour TextCol  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
02419 
02420     // get info about client rect
02421     wxRect ClientRect = GetClientRect();
02422     INT32 left   = ClientRect.x;
02423     INT32 top    = ClientRect.y;
02424     INT32 width  = ClientRect.GetWidth();
02425     INT32 height = ClientRect.GetHeight();
02426     INT32 right  = left + width;
02427     INT32 bottom = top  + height;
02428 
02429     // render the background
02430     wxPen penNoOutline(BackCol, 0, wxTRANSPARENT);
02431     pDC->SetPen(penNoOutline);
02432     OILRuler::PatB(pDC, left,top, width,height, BackCol);
02433     
02434     // set up dc to paint transparent black text in correct font
02435     pDC->SetTextForeground(TextCol);
02436     pDC->SetBackgroundMode(wxTRANSPARENT);
02437     pDC->SetFont(OILRuler::GetRulerFont());
02438 
02439     // now draw the legend text formated into the client area
02440     wxString Text((LPCTSTR)LegendText);
02441     pDC->DrawText(Text, ClientRect.x+3, ClientRect.y+1);
02442 
02443     // paint hi/lo light
02444     OILRuler::PatB(pDC,  left,top,    width-1,1,        TopLeft);       // top
02445     OILRuler::PatB(pDC,  left,top,          1,height-1, TopLeft);       // left
02446     OILRuler::PatB(pDC,  left,bottom,   width,-1,       BotRight);  // bottom
02447     OILRuler::PatB(pDC, right,top,         -1,height,   BotRight);  // right
02448 }

BOOL LegendLabel::GetStatusLineText String_256 pText,
WinCoord  MousePos,
CWindowID  hWnd
 

if over a ruler legend return status line help

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/10/95
Parameters:
MousePos - position in window (not used) [INPUTS] hWnd - handle of window
pText - [OUTPUTS]
Returns:
TRUE if ptext hold valid text, else FALSE if not over a pane

Definition at line 2652 of file oilruler.cpp.

02653 {
02654     ERROR2IF(pText==NULL,FALSE,"LegendLabel::GetStatusLineText() - pText==NULL");
02655 
02656     if (this!=hWnd)
02657         return FALSE;
02658 
02659     return (pText->Load(_R(IDS_RULER_LEGEND_SH))!=0);
02660 }

void LegendLabel::OnLButtonDblClk wxMouseEvent &  event  )  [protected]
 

handle left button double click events - pass on to parent ruler

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
nFlags - [INPUTS] point -

Definition at line 2602 of file oilruler.cpp.

02603 {
02604 //  ((OILHorizontalRuler*)GetParent())->OnLButtonDblClk(event);
02605     m_pHorzRuler->OnLButtonDblClk(event);
02606 }

void LegendLabel::OnLButtonDown wxMouseEvent &  event  )  [protected]
 

handle left button down events - pass on to parent ruler

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
nFlags - [INPUTS] point -

Definition at line 2568 of file oilruler.cpp.

02569 {
02570 //  ((OILHorizontalRuler*)GetParent())->OnLButtonDown(event);
02571     m_pHorzRuler->OnLButtonDown(event);
02572 }

void LegendLabel::OnMouseMove wxMouseEvent &  event  )  [protected]
 

handle mousemoves over ruler legend label

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/10/95
Parameters:
nFlags - [INPUTS] point -

Definition at line 2619 of file oilruler.cpp.

02620 {
02621 //  UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
02622     wxPoint MousePos = event.GetPosition();
02623 
02624     static wxPoint OldMousePos = wxPoint(0,0);
02625     if (MousePos==OldMousePos)
02626         return;
02627 
02628     StatusLine* pStatusLine=GetApplication()->GetpStatusLine();
02629     if (pStatusLine)
02630     {
02631         String_256 Text("");
02632         GetStatusLineText(&Text, WinCoord(MousePos.x, MousePos.y), this);
02633         pStatusLine->UpdateText(&Text,STATUSLINE_SELDESC_STATBAR);
02634     }
02635 
02636     OldMousePos = MousePos;
02637 }

void LegendLabel::OnPaint wxPaintEvent &  evnt  )  [protected]
 

Redraws the colour bar.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

Definition at line 2391 of file oilruler.cpp.

02392 {
02393     // Always create this so that the area is validated
02394     wxPaintDC dc(this);
02395 
02396     if (!CCamApp::IsDisabled())
02397     {
02398         DoPaint(&dc);
02399     }
02400 }

void LegendLabel::OnRButtonUp wxMouseEvent &  event  )  [protected]
 

handle left button up events - pass on to parent ruler

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/95
Parameters:
nFlags - [INPUTS] point -

Definition at line 2585 of file oilruler.cpp.

02586 {
02587 //  ((OILHorizontalRuler*)GetParent())->OnRButtonUp(event);
02588     m_pHorzRuler->OnRButtonUp(event);
02589 }

void LegendLabel::OnSize wxSizeEvent &  event  )  [protected]
 

BOOL LegendLabel::PositionLegend  ) 
 

Called by Horizontal ruler to position the LegendLabel.

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

Definition at line 2511 of file oilruler.cpp.

02512 {
02513     // get the client area of the horizontal ruler
02514     ERROR2IF(m_pHorzRuler==NULL, FALSE, "No Horz ruler pointer in LegendLable::PositionLegend");
02515 
02516     WinRect ParentRect;
02517     ParentRect = m_pHorzRuler->GetClientRect();
02518     
02519     // determine position of window
02520     WinRect LegendRect;
02521     LegendRect.y      = (ParentRect.GetHeight()-LegendHeight)/2;        // centre vertically
02522     LegendRect.x   = ParentRect.GetWidth()-LegendWidth-LegendRect.y-6;  // align right with same gap as vertical (plus a bit)
02523     LegendRect.SetWidth(LegendWidth);                                   // and this gap plus some from right end of ruler
02524     LegendRect.SetHeight(LegendHeight);                                 // with same gap at bottom
02525 TRACEUSER("Phil", _T("LegendRect %d %d %d %d\n"), LegendRect.x, LegendRect.y, LegendRect.width, LegendRect.height);
02526 
02527     // actually move the window
02528     SetSize(LegendRect);
02529 
02530     return TRUE;
02531 }

BOOL LegendLabel::SetLegendSize  )  [protected]
 

Sets the width of the window to fit the legend text. Note: The actual Legend window may be 1 pixel larger to ensure that it is vertically centred correctly in ruler (ie gap above == gap below).

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

Definition at line 2488 of file oilruler.cpp.

02489 {
02490     WinRect WinTextSize;
02491     BOOL ok=OILRuler::GetTextSize(&WinTextSize, (LPCTSTR)LegendText);
02492     if (!ok)
02493         return FALSE;
02494 
02495     LegendHeight = WinTextSize.GetHeight() +2;      // add pixel border top and bottom
02496     LegendWidth  = WinTextSize.GetWidth()  +2+7;    // add border + 3 pixel gap each end + pixel to right to balance 1 to left
02497 
02498     return TRUE;
02499 }

BOOL LegendLabel::SetLegendText StringBase pText  )  [protected]
 

Called to set legend text - resize and reposition Legend.

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

Definition at line 2460 of file oilruler.cpp.

02461 {
02462     ERROR2IF(pText==NULL,FALSE,"SetLegendText called with a NULL string");
02463     LegendText = *pText;
02464     
02465     BOOL ok=SetLegendSize();
02466     if (ok)
02467     {
02468         ok=PositionLegend();
02469         Refresh();
02470         Update();
02471     }
02472 
02473     return ok;
02474 }

void LegendLabel::ShowLabel BOOL  show  ) 
 

Shows or hides this label.

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

Definition at line 2360 of file oilruler.cpp.

02361 {
02362     Show(show);
02363 }


Friends And Related Function Documentation

friend class OILHorizontalRuler [friend]
 

Definition at line 132 of file oilruler.h.


Member Data Documentation

UINT32 LegendLabel::LegendHeight [protected]
 

Definition at line 165 of file oilruler.h.

String_256 LegendLabel::LegendText [protected]
 

Definition at line 166 of file oilruler.h.

UINT32 LegendLabel::LegendWidth [protected]
 

Definition at line 164 of file oilruler.h.

OILHorizontalRuler* LegendLabel::m_pHorzRuler [protected]
 

Definition at line 167 of file oilruler.h.


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