2001-07-24 11:27:12 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2002-01-21 17:34:42 -05:00
|
|
|
// Name: hintanimpl.h
|
|
|
|
// Purpose: Header for cbHintAnimationPlugin class.
|
2001-07-24 11:27:12 -04:00
|
|
|
// Author: Aleksandras Gluchovas
|
|
|
|
// Modified by:
|
|
|
|
// Created: 9/11/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Aleksandras Gluchovas
|
2002-01-21 17:34:42 -05:00
|
|
|
// Licence: wxWindows licence
|
2001-07-24 11:27:12 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __HINTANIMPL_G__
|
|
|
|
#define __HINTANIMPL_G__
|
|
|
|
|
|
|
|
#include "wx/fl/controlbar.h"
|
|
|
|
|
|
|
|
#include "wx/timer.h"
|
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
class WXDLLIMPEXP_FL cbHintAnimTimer;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
/*
|
|
|
|
A plugin to draw animated hints when the user drags a pane.
|
|
|
|
*/
|
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
class WXDLLIMPEXP_FL cbHintAnimationPlugin : public cbPluginBase
|
2001-07-24 11:27:12 -04:00
|
|
|
{
|
2002-01-21 17:34:42 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS( cbHintAnimationPlugin )
|
2001-07-24 11:27:12 -04:00
|
|
|
protected:
|
2002-01-21 17:34:42 -05:00
|
|
|
friend class cbHintAnimTimer;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
|
|
|
cbHintAnimTimer* mpAnimTimer;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// FOR NOW:: try it without mutually exculisve locks
|
|
|
|
volatile wxRect mCurRect;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// state variables
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
bool mAnimStarted;
|
|
|
|
bool mStopPending;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
bool mPrevInClient;
|
|
|
|
bool mCurInClient;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxRect mPrevRect;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
public:
|
2002-01-21 17:34:42 -05:00
|
|
|
int mMorphDelay; // delay between frames in miliseconds, default: 20
|
|
|
|
int mMaxFrames; // number of iterations for hint morphing, default: 30
|
|
|
|
// (morph duration = mMorphDelay * mMaxFrames msec)
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
int mInClientHintBorder; // default: 4 pixels
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2004-06-07 12:02:23 -04:00
|
|
|
bool mAccelerationOn; // true, if morph accelerates, otherwise morph
|
|
|
|
// speed is constant. Default: true
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// TBD:: get/set methods for above members
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal function for starting tracking.
|
|
|
|
void StartTracking();
|
|
|
|
|
|
|
|
// Internal function for drawing a hint rectangle.
|
|
|
|
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal function for erasing a hint rectangle.
|
|
|
|
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal function for finishing tracking.
|
|
|
|
void FinishTracking();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal function for drawing a hint rectangle.
|
|
|
|
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
|
|
|
|
|
|
|
// Internal function for translating coordinates.
|
|
|
|
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
public:
|
2002-01-21 17:34:42 -05:00
|
|
|
// Default constructor.
|
|
|
|
cbHintAnimationPlugin();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Constructor, taking a layout panel and pane mask.
|
|
|
|
cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Destructor.
|
|
|
|
~cbHintAnimationPlugin();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Event handler respoding to hint draw events.
|
|
|
|
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-07-24 11:27:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
/*
|
|
|
|
A private helper class.
|
|
|
|
*/
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
struct WXDLLIMPEXP_FL MorphInfoT
|
2001-07-24 11:27:12 -04:00
|
|
|
{
|
2002-01-21 17:34:42 -05:00
|
|
|
wxPoint mFrom;
|
|
|
|
wxPoint mTill;
|
2001-07-24 11:27:12 -04:00
|
|
|
};
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
/*
|
|
|
|
A private helper class.
|
|
|
|
*/
|
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
class WXDLLIMPEXP_FL cbHintAnimTimer : public wxTimer
|
2001-07-24 11:27:12 -04:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
friend class cbHintAnimationPlugin;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxRect mPrevMorphed;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
MorphInfoT mUpperLeft;
|
|
|
|
MorphInfoT mLowerRight;
|
|
|
|
int mCurIter;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
long mLock;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
cbHintAnimationPlugin* mpPl;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
void MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
cbHintAnimTimer(void);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
virtual void Notify(void);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
virtual bool Init( cbHintAnimationPlugin* pAnimPl, bool reinit );
|
2001-07-24 11:27:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __HINTANIMPL_G__ */
|
|
|
|
|