2001-07-24 11:27:12 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2002-01-18 17:34:01 -05:00
|
|
|
// Name: bardragpl.h
|
|
|
|
// Purpose: cbBarDragPlugin class
|
2001-07-24 11:27:12 -04:00
|
|
|
// Author: Aleksandras Gluchovas
|
|
|
|
// Modified by:
|
|
|
|
// Created: 23/09/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 __BARDRAGPL_G__
|
|
|
|
#define __BARDRAGPL_G__
|
|
|
|
|
|
|
|
#include "wx/fl/controlbar.h"
|
|
|
|
#include "wx/fl/toolwnd.h"
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
/*
|
|
|
|
Plugin class implementing bar dragging.
|
|
|
|
*/
|
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
class WXDLLIMPEXP_FL cbBarDragPlugin : public cbPluginBase
|
2001-07-24 11:27:12 -04:00
|
|
|
{
|
2002-01-21 17:34:42 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS( cbBarDragPlugin )
|
2001-07-24 11:27:12 -04:00
|
|
|
protected:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// plugin is active only in bar-dragging state
|
|
|
|
bool mBarDragStarted;
|
|
|
|
bool mCanStick; // flag used to prevent "bouncing" of hint-rectangle
|
|
|
|
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
|
|
|
wxCursor* mpCurCursor;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// rectangle shows the position/dimensions of the bar,
|
|
|
|
// if it would be docked now
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxRect mPrevHintRect;
|
|
|
|
wxRect mHintRect;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
int mMouseInRectX;
|
|
|
|
int mMouseInRectY;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
cbDockPane* mpSrcPane; // pane, from which the bar was originally taken
|
|
|
|
int mBarWidthInSrcPane;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
cbDockPane* mpCurPane;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
cbBarInfo* mpDraggedBar; // bar, which is being dragged
|
|
|
|
bool mBarWasFloating;
|
|
|
|
wxRect mFloatedBarBounds;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
public: /*** public properties ***/
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
int mInClientHintBorder; // when hint-rect moves within client window area,
|
2001-07-24 11:27:12 -04:00
|
|
|
// the thicker rectangle is drawn using hatched brush,
|
2002-01-21 17:34:42 -05:00
|
|
|
// the default border width for this rectangle is 8 pix.
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
void AdjustHintRect( wxPoint& mousePos );
|
|
|
|
|
|
|
|
// Internal implementation function.
|
|
|
|
void ClipRectInFrame( wxRect& rect );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
void ClipPosInFrame( wxPoint& pos );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function. Finds the pane
|
|
|
|
// under the specified rectangle.
|
|
|
|
cbDockPane* HitTestPanes( wxRect& rect );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function. Finds the pane
|
|
|
|
// under the specified point.
|
|
|
|
cbDockPane* HitTestPanes( wxPoint& pos );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
bool HitsPane( cbDockPane* pPane, wxRect& rect );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
void CalcOnScreenDims( wxRect& rect );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
int GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
bool IsInOtherPane ( wxPoint& mousePos );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
bool IsInClientArea( wxPoint& mousePos );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
bool IsInClientArea( wxRect& rect );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
void StickToPane( cbDockPane* pPane, wxPoint& mousePos );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
void UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
int GetBarWidthInPane( cbDockPane* pPane );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
int GetBarHeightInPane( cbDockPane* pPane );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// on-screen hint-tracking related methods
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
// Start showing a visual hint while dragging.
|
|
|
|
void StartTracking();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
// Draw the visual hint while dragging.
|
|
|
|
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
// Erase the visual hint while dragging.
|
|
|
|
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
// Stop showing the visual hint while dragging.
|
|
|
|
void FinishTracking();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
// Draw the hint rectangle.
|
|
|
|
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
// Converts the given rectangle from window to screen coordinates.
|
|
|
|
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Internal implementation function.
|
|
|
|
// Show the hint; called within OnMouseMove.
|
|
|
|
void ShowHint( bool prevWasInClient );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
public:
|
2002-01-21 17:34:42 -05:00
|
|
|
// Default constructor.
|
|
|
|
cbBarDragPlugin(void);
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Constructor taking a parent frame, and flag. See cbPluginBase.
|
|
|
|
cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Destructor.
|
|
|
|
virtual ~cbBarDragPlugin();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handler for plugin event.
|
|
|
|
void OnMouseMove( cbMotionEvent& event );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handler for plugin event.
|
|
|
|
void OnLButtonUp( cbLeftUpEvent& event );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handler for plugin event.
|
|
|
|
void OnLButtonDown( cbLeftDownEvent& event );
|
2002-01-18 17:34:01 -05:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handler for plugin event.
|
|
|
|
void OnLDblClick( cbLeftDClickEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handles event, which originates from itself.
|
|
|
|
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handler for plugin event.
|
|
|
|
void OnStartBarDragging( cbStartBarDraggingEvent& 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
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __BARDRAGPL_G__ */
|
|
|
|
|