home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2233.zip / wxOS2-2_3_3.zip / wxWindows-2.3.3 / contrib / include / wx / fl / bardragpl.h < prev    next >
C/C++ Source or Header  |  2002-09-08  |  6KB  |  174 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name:        bardragpl.h
  3. // Purpose:     cbBarDragPlugin class
  4. // Author:      Aleksandras Gluchovas
  5. // Modified by:
  6. // Created:     23/09/98
  7. // RCS-ID:      $Id: bardragpl.h,v 1.4 2002/09/07 12:10:19 GD Exp $
  8. // Copyright:   (c) Aleksandras Gluchovas
  9. // Licence:     wxWindows licence
  10. /////////////////////////////////////////////////////////////////////////////
  11.  
  12. #ifndef __BARDRAGPL_G__
  13. #define __BARDRAGPL_G__
  14.  
  15. #if defined(__GNUG__) && !defined(__APPLE__)
  16.     #pragma interface "bardragpl.h"
  17. #endif
  18.  
  19. #include "wx/fl/controlbar.h"
  20. #include "wx/fl/toolwnd.h"
  21.  
  22. /*
  23. Plugin class implementing bar dragging.
  24. */
  25.  
  26. class cbBarDragPlugin : public cbPluginBase
  27. {
  28.     DECLARE_DYNAMIC_CLASS( cbBarDragPlugin )
  29. protected:
  30.  
  31.     // plugin is active only in bar-dragging state
  32.     bool           mBarDragStarted;
  33.     bool           mCanStick;          // flag used to prevent "bouncing" of hint-rectangle
  34.     wxScreenDC*    mpScrDc;            // created while tracking hint-rect
  35.     wxCursor*      mpCurCursor;
  36.  
  37.     // rectangle shows the position/dimensions of the bar,
  38.     // if it would be docked now
  39.  
  40.     wxRect         mPrevHintRect;
  41.     wxRect         mHintRect;
  42.  
  43.  
  44.     int            mMouseInRectX;
  45.     int            mMouseInRectY;
  46.  
  47.     cbDockPane*    mpSrcPane;          // pane, from which the bar was originally taken
  48.     int            mBarWidthInSrcPane;
  49.  
  50.     cbDockPane*    mpCurPane;
  51.  
  52.     cbBarInfo*     mpDraggedBar;       // bar, which is being dragged
  53.     bool           mBarWasFloating;
  54.     wxRect         mFloatedBarBounds;
  55.  
  56. public: /*** public properties ***/
  57.  
  58.     int            mInClientHintBorder; // when hint-rect moves within client window area,
  59.                                         // the thicker rectangle is drawn using hatched brush,
  60.                                         // the default border width for this rectangle is 8 pix.
  61.  
  62. protected:
  63.  
  64.         // Internal implementation function.
  65.     void AdjustHintRect( wxPoint& mousePos );
  66.  
  67.         // Internal implementation function.
  68.     void ClipRectInFrame( wxRect& rect );
  69.  
  70.         // Internal implementation function.
  71.     void ClipPosInFrame( wxPoint& pos );
  72.  
  73.         // Internal implementation function. Finds the pane
  74.         // under the specified rectangle.
  75.     cbDockPane* HitTestPanes( wxRect& rect );
  76.  
  77.         // Internal implementation function. Finds the pane
  78.         // under the specified point.
  79.     cbDockPane* HitTestPanes( wxPoint& pos );
  80.  
  81.         // Internal implementation function.
  82.     bool HitsPane( cbDockPane* pPane, wxRect& rect );
  83.  
  84.         // Internal implementation function.
  85.     void CalcOnScreenDims( wxRect& rect );
  86.  
  87.         // Internal implementation function.
  88.     int  GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos );
  89.  
  90.         // Internal implementation function.
  91.     bool IsInOtherPane ( wxPoint& mousePos );
  92.  
  93.         // Internal implementation function.
  94.     bool IsInClientArea( wxPoint& mousePos );
  95.  
  96.         // Internal implementation function.
  97.     bool IsInClientArea( wxRect& rect );
  98.  
  99.         // Internal implementation function.
  100.     void StickToPane( cbDockPane* pPane, wxPoint& mousePos );
  101.  
  102.         // Internal implementation function.
  103.     void UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos );
  104.  
  105.         // Internal implementation function.
  106.     int GetBarWidthInPane( cbDockPane* pPane );
  107.  
  108.         // Internal implementation function.
  109.     int GetBarHeightInPane( cbDockPane* pPane );
  110.  
  111.         // on-screen hint-tracking related methods
  112.  
  113.         // Internal implementation function.
  114.         // Start showing a visual hint while dragging.
  115.     void StartTracking();
  116.  
  117.         // Internal implementation function.
  118.         // Draw the visual hint while dragging.
  119.     void DrawHintRect ( wxRect& rect, bool isInClientRect);
  120.  
  121.         // Internal implementation function.
  122.         // Erase the visual hint while dragging.
  123.     void EraseHintRect( wxRect& rect, bool isInClientRect);
  124.  
  125.         // Internal implementation function.
  126.         // Stop showing the visual hint while dragging.
  127.     void FinishTracking();
  128.  
  129.         // Internal implementation function.
  130.         // Draw the hint rectangle.
  131.     void DoDrawHintRect( wxRect& rect, bool isInClientRect);
  132.  
  133.         // Internal implementation function.
  134.         // Converts the given rectangle from window to screen coordinates.
  135.     void RectToScr( wxRect& frameRect, wxRect& scrRect );
  136.  
  137.         // Internal implementation function.
  138.         // Show the hint; called within OnMouseMove.
  139.     void ShowHint( bool prevWasInClient );
  140.  
  141. public:
  142.         // Default constructor.
  143.     cbBarDragPlugin(void);
  144.  
  145.         // Constructor taking a parent frame, and flag. See cbPluginBase.
  146.     cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
  147.  
  148.         // Destructor.
  149.     virtual ~cbBarDragPlugin();
  150.  
  151.         // Handler for plugin event.
  152.     void OnMouseMove( cbMotionEvent& event );
  153.  
  154.         // Handler for plugin event.
  155.     void OnLButtonUp( cbLeftUpEvent& event );
  156.  
  157.         // Handler for plugin event.
  158.     void OnLButtonDown( cbLeftDownEvent& event );
  159.  
  160.         // Handler for plugin event.
  161.     void OnLDblClick( cbLeftDClickEvent& event );
  162.  
  163.         // Handles event, which originates from itself.
  164.     void OnDrawHintRect( cbDrawHintRectEvent& event );
  165.  
  166.         // Handler for plugin event.
  167.     void OnStartBarDragging( cbStartBarDraggingEvent& event );
  168.  
  169.     DECLARE_EVENT_TABLE()
  170. };
  171.  
  172. #endif /* __BARDRAGPL_G__ */
  173.  
  174.