#include <oilruler.h>
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 |
OILHorizontalRuler * | m_pHorzRuler |
Friends | |
class | OILHorizontalRuler |
Definition at line 130 of file oilruler.h.
|
Creates an OILDockingBar object.
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 }
|
|
Destroys an LegendLabel object.
Definition at line 2374 of file oilruler.cpp.
|
|
convert coord relative to this window to a coord relative to the parent window Note: Nice if this was in a parent CCWnd class
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 }
|
|
Creates an LegendLabel object.
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 }
|
|
Paints the client area of the Legend Label.
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 }
|
|
if over a ruler legend return status line help
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 }
|
|
handle left button double click events - pass on to parent ruler
Definition at line 2602 of file oilruler.cpp. 02603 { 02604 // ((OILHorizontalRuler*)GetParent())->OnLButtonDblClk(event); 02605 m_pHorzRuler->OnLButtonDblClk(event); 02606 }
|
|
handle left button down events - pass on to parent ruler
Definition at line 2568 of file oilruler.cpp. 02569 { 02570 // ((OILHorizontalRuler*)GetParent())->OnLButtonDown(event); 02571 m_pHorzRuler->OnLButtonDown(event); 02572 }
|
|
handle mousemoves over ruler legend label
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 }
|
|
Redraws the colour bar.
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 }
|
|
handle left button up events - pass on to parent ruler
Definition at line 2585 of file oilruler.cpp. 02586 { 02587 // ((OILHorizontalRuler*)GetParent())->OnRButtonUp(event); 02588 m_pHorzRuler->OnRButtonUp(event); 02589 }
|
|
|
|
Called by Horizontal ruler to position the LegendLabel.
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 }
|
|
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).
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 }
|
|
Called to set legend text - resize and reposition Legend.
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 }
|
|
Shows or hides this label.
Definition at line 2360 of file oilruler.cpp.
|
|
Definition at line 132 of file oilruler.h. |
|
Definition at line 165 of file oilruler.h. |
|
Definition at line 166 of file oilruler.h. |
|
Definition at line 164 of file oilruler.h. |
|
Definition at line 167 of file oilruler.h. |