2001-07-24 11:27:12 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2002-01-21 17:34:42 -05:00
|
|
|
// Name: rowdragpl.h
|
|
|
|
// Purpose: cbRowDragPlugin class header.
|
2001-07-24 11:27:12 -04:00
|
|
|
// Author: Aleksandras Gluchovas
|
|
|
|
// Modified by:
|
|
|
|
// Created: 06/10/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 __ROWDRAGPL_G__
|
|
|
|
#define __ROWDRAGPL_G__
|
|
|
|
|
|
|
|
#include "wx/fl/controlbar.h"
|
|
|
|
|
|
|
|
/*
|
2002-01-21 17:34:42 -05:00
|
|
|
This plugin adds row-dragging functionality to the pane.
|
|
|
|
It handles mouse movement and pane background-erasing plugin events.
|
|
|
|
The behaviour and appearance resembles drag and drop positioning
|
|
|
|
of the toolbar rows in Netscape Communicator 4.xx.
|
|
|
|
*/
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
class WXDLLIMPEXP_FL cbRowDragPlugin : public cbPluginBase
|
2001-07-24 11:27:12 -04:00
|
|
|
{
|
2002-01-21 17:34:42 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS( cbRowDragPlugin )
|
2001-07-24 11:27:12 -04:00
|
|
|
public:
|
2002-01-21 17:34:42 -05:00
|
|
|
// background colours for the highlighted/unhighlighted icons
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxColour mHightColor; // light-blue for NC-look
|
|
|
|
wxColour mLowColor; // light-gray -/-
|
|
|
|
wxColour mTrianInnerColor; // blue -/-
|
|
|
|
wxPen mTrianInnerPen; // black -/-
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
protected:
|
2002-01-21 17:34:42 -05:00
|
|
|
friend class cbRowDragPluginSerializer;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// drag & drop state variables
|
|
|
|
bool mDragStarted;
|
|
|
|
bool mDecisionMode;
|
|
|
|
wxPoint mDragOrigin;
|
|
|
|
int mCurDragOfs;
|
|
|
|
bool mCaptureIsOn;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// saved margins of the pane
|
|
|
|
int mSvTopMargin;
|
|
|
|
int mSvBottomMargin;
|
|
|
|
int mSvLeftMargin;
|
|
|
|
int mSvRightMargin;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// on-screen drawing state variables
|
|
|
|
wxBitmap* mpPaneImage;
|
|
|
|
wxBitmap* mpRowImage;
|
|
|
|
wxBitmap* mpCombinedImage;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxScreenDC* mpScrDc;
|
|
|
|
wxRect mCombRect;
|
|
|
|
wxSize mRowImgDim;
|
|
|
|
int mInitialRowOfs;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// NOTE:: if mpRowInFocus is not NULL, then mCollapsedIconInFocus is -1,
|
|
|
|
// and v.v. (two different items cannot be in focus at the same time)
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
cbRowInfo* mpRowInFocus;
|
|
|
|
int mCollapsedIconInFocus;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
cbDockPane* mpPane; // is set up temorarely, while handling event
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
wxList mHiddenBars;
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
wxBitmap* CaptureDCArea( wxDC& dc, wxRect& area );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
int GetHRowsCountForPane( cbDockPane* pPane );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
void SetMouseCapture( bool captureOn );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
void PrepareForRowDrag();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
void ShowDraggedRow( int offset );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
void ShowPaneImage();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
void FinishOnScreenDraw();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
void CollapseRow( cbRowInfo* pRow );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Helper for drag and drop.
|
|
|
|
void ExpandRow( int collapsedIconIdx );
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
void InsertDraggedRowBefore( cbRowInfo* pBeforeRow );
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
bool ItemIsInFocus();
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
void CheckPrevItemInFocus( cbRowInfo* pRow, int iconIdx );
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
void UnhighlightItemInFocus();
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
cbRowInfo* GetFirstRow();
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void DrawTrianUp( wxRect& inRect, wxDC& dc );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void DrawTrianDown( wxRect& inRect, wxDC& dc );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void DrawTrianRight( wxRect& inRect, wxDC& dc );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void Draw3DPattern( wxRect& inRect, wxDC& dc );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void DrawRombShades( wxPoint& p1, wxPoint& p2, wxPoint& p3, wxPoint& p4, wxDC& dc );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void DrawOrtoRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void DrawRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void Draw3DRect( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
|
|
|
|
|
|
|
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
|
|
|
virtual void DrawRectShade( wxRect& inRect, wxDC& dc,
|
|
|
|
int level, wxPen& upperPen, wxPen& lowerPen );
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
virtual void GetRowHintRect( cbRowInfo* pRow, wxRect& rect );
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
virtual void GetCollapsedInconRect( int iconIdx, wxRect& rect );
|
|
|
|
|
|
|
|
// Helper for drag and drop.
|
|
|
|
virtual int GetCollapsedIconsPos();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Default constructor.
|
|
|
|
cbRowDragPlugin();
|
|
|
|
|
|
|
|
// Constructor, taking paren layout frame and pane mask.
|
|
|
|
cbRowDragPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
|
|
|
|
|
|
|
|
// Destructor.
|
|
|
|
virtual ~cbRowDragPlugin();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Clone function, returning a new instance of this class.
|
|
|
|
virtual cbPluginBase* Clone() { return new cbRowDragPlugin(NULL,0); }
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Called to initialize this plugin.
|
|
|
|
virtual void OnInitPlugin();
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handles mouse move plugin events (appearance-independent logic).
|
|
|
|
void OnMouseMove ( cbMotionEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handles left button down plugin events (appearance-independent logic).
|
|
|
|
void OnLButtonDown( cbLeftDownEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handles left button up plugin events (appearance-independent logic).
|
|
|
|
void OnLButtonUp ( cbLeftUpEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Handles pane drawing plugin events (appearance-independent logic).
|
|
|
|
void OnDrawPaneBackground( cbDrawPaneDecorEvent& event );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Draws collapsed row icon (appearance-dependent).
|
|
|
|
virtual void DrawCollapsedRowIcon( int index, wxDC& dc, bool isHighlighted );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Draws collapsed rows border (appearance-dependent).
|
|
|
|
virtual void DrawCollapsedRowsBorder( wxDC& dc );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Draws rows drag hints border (appearance-dependent).
|
|
|
|
virtual void DrawRowsDragHintsBorder( wxDC& dc );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Draws row drag hint (appearance-dependent).
|
|
|
|
virtual void DrawRowDragHint( cbRowInfo* pRow, wxDC& dc, bool isHighlighted );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Draws empty row (appearance-dependent).
|
|
|
|
virtual void DrawEmptyRow( wxDC& dc, wxRect& rowBounds );
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
// Gets the collapsed row icon height.
|
|
|
|
virtual int GetCollapsedRowIconHeight();
|
|
|
|
|
|
|
|
// Gets the row drag hint width.
|
|
|
|
virtual int GetRowDragHintWidth();
|
|
|
|
|
|
|
|
// Sets the pane margins.
|
|
|
|
virtual void SetPaneMargins();
|
|
|
|
|
|
|
|
// Test for the collapsed row icon position.
|
|
|
|
virtual bool HitTestCollapsedRowIcon( int iconIdx, const wxPoint& pos );
|
|
|
|
|
|
|
|
// Test for the row drag hint position.
|
|
|
|
virtual bool HitTestRowDragHint( cbRowInfo* pRow, const wxPoint& pos );
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2001-07-24 11:27:12 -04:00
|
|
|
};
|
|
|
|
|
2002-01-21 17:34:42 -05:00
|
|
|
/*
|
|
|
|
Internal helper class.
|
|
|
|
*/
|
2001-07-24 11:27:12 -04:00
|
|
|
|
2003-07-08 16:47:17 -04:00
|
|
|
class WXDLLIMPEXP_FL cbHiddenBarInfo : public wxObject
|
2001-07-24 11:27:12 -04:00
|
|
|
{
|
2002-01-21 17:34:42 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS( cbHiddenBarInfo )
|
2001-07-24 11:27:12 -04:00
|
|
|
public:
|
2002-01-21 17:34:42 -05:00
|
|
|
cbBarInfo* mpBar;
|
|
|
|
int mRowNo;
|
|
|
|
int mIconNo;
|
|
|
|
int mAlignment;
|
2001-07-24 11:27:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ROWDRAGPL_G__ */
|
|
|
|
|