OriginGadget Class Reference

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

#include <oilruler.h>

List of all members.

Public Member Functions

 OriginGadget ()
 Creates an OILDockingBar object.
virtual ~OriginGadget ()
 Destroys an OriginGadget object.
BOOL Create (CCamView *pOwnerView, INT32 id)
 Creates an OriginGadget object.
void ShowGadget (BOOL show)
 Shows or hides this gadget.
void CalcPosFromParentClient (WinRect *lpRect)
 Called by CCamView when its size changes, so it knows where to reposition the OriginGadget.
BOOL GetStatusLineText (String_256 *pText, WinCoord MousePos, CWindowID hWnd)
 if over origin gadget return status line help

Static Public Member Functions

static TCHARBubbleHelpCallBack (CWindowID hWnd, UINT32 PaneIndex, void *UserData)
 Bubble help call back handler (called some time after call to DoBubbleHelpOn() if mouse ha not moved).

Protected Member Functions

void DoPaint (wxDC *pDC)
 Paints the client area of the Origin Gadget Mask plots the origin glyph.
void OnPaint (wxPaintEvent &event)
 Redraws the colour bar.
void OnLButtonDown (wxMouseEvent &event)
 handle left button downs
void OnLButtonDblClk (wxMouseEvent &event)
 handle left button double clicks
void OnRButtonUp (wxMouseEvent &event)
 Handle left button up events - pop-up context sensitive menu.
void OnMouseMove (wxMouseEvent &event)
 handle mouse moves over Origin

Protected Attributes

CCamViewm_pOwnerView
wxBitmap * pGlyph


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 362 of file oilruler.h.


Constructor & Destructor Documentation

OriginGadget::OriginGadget  ) 
 

Creates an OILDockingBar object.

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

Definition at line 1972 of file oilruler.cpp.

01973 { 
01974     pGlyph = NULL;
01975     pGlyph = CamArtProvider::Get()->FindBitmap(_R(IDB_ORIGINBMP)); //, (CamArtFlags)(CAF_DEFAULT|(Disabled?CAF_GREYED:0)));
01976 }

OriginGadget::~OriginGadget  )  [virtual]
 

Destroys an OriginGadget object.

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

Definition at line 2002 of file oilruler.cpp.

02003 {
02004     // NOTE: CamArtProvider owns pGlyph and will delete it itself
02005 }


Member Function Documentation

TCHAR * OriginGadget::BubbleHelpCallBack CWindowID  hWnd,
UINT32  PaneIndex,
void *  UserData
[static]
 

Bubble help call back handler (called some time after call to DoBubbleHelpOn() if mouse ha not moved).

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/10/95
Parameters:
hWnd - not used [INPUTS] PaneID - not used UserData - not used
Returns:
pointer to text, or NULL if fails

Definition at line 2286 of file oilruler.cpp.

02287 {
02288     static String_64 BubbleHelpText("");
02289 
02290     BubbleHelpText.Load(_R(IDS_ORIGIN_BH));
02291 
02292     return (TCHAR*)BubbleHelpText;
02293 }

void OriginGadget::CalcPosFromParentClient WinRect lpRect  ) 
 

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

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/8/95
Parameters:
A long pointer to a rectangle which describes the dimensions of the client [INPUTS] area of the window containing the gadget.
Changes lpRect to the position a horizontal scroll bar would occupy [OUTPUTS] normally, ie. along the bottom of the owning window.

Definition at line 2092 of file oilruler.cpp.

02093 {
02094     wxRect parentRect;
02095     parentRect = m_pOwnerView->GetParentFrame()->GetClientRect();
02096 
02097     lpRect->x   = parentRect.x ;
02098     lpRect->y    = parentRect.y;
02099     lpRect->SetRightEx(parentRect.x + OILRuler::GetWidth());
02100     lpRect->SetBottomEx(parentRect.y  + OILRuler::GetWidth());
02101 
02102     // we need to take into account camelots new floating toolbar ....
02103 
02104 PORTNOTE("ruler", "Removed use of Kernel toolbars")
02105 #if !defined(EXCLUDE_FROM_XARALX)
02106     DockBarType DockBarType;// = DOCKBAR_FLOAT;
02107     KernelBarPos * pKernelBarPos;
02108 
02109     // find out where the toolbar is docked
02110     GetMainFrame()->GetBarPosInfo(&(String_32 ("Toolbar")), &DockBarType, &pKernelBarPos);
02111 
02112     if (DockBarType == DOCKBAR_FLOAT)
02113     {
02114         RECT MainFrameWindowRect = *lpRect;
02115         //::GetWindowRect (GetSafeHwnd (), &MainFrameWindowRect);
02116         ClientToScreen (&MainFrameWindowRect);
02117 
02118         POINT ToolbarTL;
02119         ToolbarTL.x = pKernelBarPos->x;
02120         ToolbarTL.y = pKernelBarPos->y;
02121 
02122         if (PtInRect (&MainFrameWindowRect, ToolbarTL))
02123         {
02124             KernelBarPos NewToolBarPos = *pKernelBarPos;
02125             BaseBar* PtrToToolBar = BaseBar::GetPtrToToolBar ();
02126             
02127             INT32 dy = MainFrameWindowRect.bottom - ToolbarTL.y;
02128             INT32 dx = MainFrameWindowRect.right - ToolbarTL.x;
02129 
02130             NewToolBarPos.y += dy;
02131             NewToolBarPos.x += dx;
02132 
02133             if (PtrToToolBar)
02134             {
02135                 PtrToToolBar->MoveBar ((WPARAM) DOCKBAR_FLOAT, (LPARAM) &NewToolBarPos);
02136             }
02137         }
02138     }
02139 #endif
02140     
02141 }

BOOL OriginGadget::Create CCamView pOwnerView,
INT32  id
 

Creates an OriginGadget object.

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

Definition at line 2154 of file oilruler.cpp.

02155 { 
02156     ENSURE(pOwnerView,"DockingBar must have a Parent");
02157 
02158     m_pOwnerView = pOwnerView;
02159 
02160     if (!wxWindow::Create(pOwnerView->GetParentFrame(), id, wxDefaultPosition, wxSize(OILRuler::GetWidth(), OILRuler::GetWidth()), wxNO_BORDER))
02161         return(FALSE);
02162 
02163     return TRUE;
02164 }

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

Paints the client area of the Origin Gadget Mask plots the origin glyph.

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

Definition at line 2042 of file oilruler.cpp.

02043 {
02044     // read the necessary colours
02045     wxColour BackCol  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
02046     wxColour TopLeft  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT);
02047     wxColour BotRight = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW);
02048     wxColour TextCol  = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
02049 
02050     // get info about client rect
02051     wxRect ClientRect = GetClientRect();
02052     INT32 left   = ClientRect.x;
02053     INT32 top    = ClientRect.y;
02054     INT32 width  = ClientRect.GetWidth();
02055     INT32 height = ClientRect.GetHeight();
02056     INT32 right  = left + width;
02057     INT32 bottom = top  + height;
02058 
02059     // render the background
02060     wxPen penNoOutline(BackCol, 0, wxTRANSPARENT);
02061     pDC->SetPen(penNoOutline);
02062     OILRuler::PatB(pDC, left,top, width,height, BackCol);
02063     
02064     pDC->SetBackgroundMode(wxTRANSPARENT);
02065 
02066     // plot the little orign bitmap in the centre of this window
02067     INT32 BitmapSize = 15;  
02068     INT32 offset     = (width-BitmapSize)/2;
02069     pDC->DrawBitmap(*pGlyph, offset, offset, true);
02070 
02071     // paint the hi/lo lights
02072     OILRuler::PatB(pDC,  left,top,    width-1,1,        TopLeft);       // top
02073     OILRuler::PatB(pDC,  left,top,          1,height-1, TopLeft);       // left
02074     OILRuler::PatB(pDC,  left,bottom,   width,-1,       BotRight);  // bottom
02075     OILRuler::PatB(pDC, right,top,         -1,height,   BotRight);  // right
02076 }

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

if over origin gadget 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 2309 of file oilruler.cpp.

02310 {
02311     ERROR2IF(pText==NULL,FALSE,"OILRuler::GetStatusLineText() - pText==NULL");
02312 
02313     if (this!=hWnd)
02314         return FALSE;
02315 
02316     return (pText->Load(_R(IDS_ORIGIN_SH))!=0);
02317 }

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

handle left button double clicks

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

Definition at line 2219 of file oilruler.cpp.

02220 {
02221     /*UINT32 nFlags =*/ ClickModifiers::SynthesizeMouseEventFlags(event);
02222     wxPoint point = event.GetPosition();
02223 
02224     if (OpResetSpreadOrigin::GetState(NULL,NULL).Greyed==FALSE)
02225     {
02226         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_RESETSPREADORIGIN);
02227         if (pOpDesc!=NULL)
02228             pOpDesc->Invoke();
02229         else
02230             ERROR3("OriginGadget::OnLButtonDblClk() - FindOpDescriptor(OPTOKEN_RESETSPREADORIGIN) failed");
02231     }
02232 }

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

handle left button downs

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/94
Parameters:
nFlags - [INPUTS] point -

Definition at line 2177 of file oilruler.cpp.

02178 {
02179     UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
02180     wxPoint point = event.GetPosition();
02181 
02182     String_256 OpToken(OPTOKEN_SPREADORIGIN);
02183 
02184     if (m_pOwnerView != NULL)
02185         m_pOwnerView->InvokeDragOp(&OpToken, NULL, nFlags, point);
02186 }

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

handle mouse moves over Origin

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

Definition at line 2245 of file oilruler.cpp.

02246 {
02247 //  UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
02248     wxPoint MousePos = event.GetPosition();
02249 
02250     static wxPoint OldMousePos = wxPoint(0,0);
02251     if (MousePos==OldMousePos)
02252         return;
02253 
02254 PORTNOTE("rulers", "Bubble help removed from OriginGadget")
02255 #if !defined(EXCLUDE_FROM_XARALX)
02256     ControlHelper::DoBubbleHelpOn(GetSafeHwnd(), 0, BubbleHelpCallBack,this);
02257 #endif
02258 
02259     StatusLine* pStatusLine=GetApplication()->GetpStatusLine();
02260     if (pStatusLine)
02261     {
02262         String_256 Text("");
02263         GetStatusLineText(&Text, WinCoord(MousePos.x, MousePos.y), this);
02264         pStatusLine->UpdateText(&Text, STATUSLINE_SELDESC_STATBAR);
02265     }
02266 
02267     OldMousePos = MousePos;
02268 }

void OriginGadget::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 2020 of file oilruler.cpp.

02021 {
02022     // Always create this so that the area is validated
02023     wxPaintDC dc(this);
02024 
02025     if (!CCamApp::IsDisabled())
02026     {
02027         DoPaint(&dc);
02028     }
02029 }

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

Handle left button up events - pop-up context sensitive menu.

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

Definition at line 2199 of file oilruler.cpp.

02200 {
02201 //  UINT32 nFlags = ClickModifiers::SynthesizeMouseEventFlags(event);
02202     wxPoint point = event.GetPosition();
02203 
02204     OriginContextMenu* pOriginMenu = new OriginContextMenu;
02205     pOriginMenu->Show();
02206 }

void OriginGadget::ShowGadget BOOL  show  ) 
 

Shows or hides this gadget.

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

Definition at line 1988 of file oilruler.cpp.

01989 {
01990     Show(show);
01991 }


Member Data Documentation

CCamView* OriginGadget::m_pOwnerView [protected]
 

Definition at line 391 of file oilruler.h.

wxBitmap* OriginGadget::pGlyph [protected]
 

Definition at line 393 of file oilruler.h.


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